1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-10 02:16:40 +02:00

Merge pull request #462 from koalyptus/refactor-popup-filters-options

Refactor popup filters options
This commit is contained in:
koalyptus 2017-05-31 20:55:06 +10:00 committed by GitHub
commit 9dde61e7a0
31 changed files with 100 additions and 72 deletions

View file

@ -6,13 +6,14 @@
"rules": {
"max-len": [2, 80, 2, {"ignoreUrls": true}],
"indent": [2, 4, {"SwitchCase": 1}],
"semi": ["error", "always"],
"no-trailing-spaces": 2,
"no-multi-spaces": 2,
"array-bracket-spacing": 2,
"keyword-spacing": ["error", { "after": true, "before": true }],
"max-depth": [2, 7],
"max-statements": [2, 143],
"complexity": [2, 80],
"complexity": [2, 81],
"no-unused-vars": 2,
"no-eval": 2,
"no-underscore-dangle": 0,

4
dist/starter.html vendored
View file

@ -1,10 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.5.18 - Starter</title>
<title>tablefilter v0.5.19 - Starter</title>
</head>
<body>
<h1>tablefilter v0.5.18</h1>
<h1>tablefilter v0.5.19</h1>

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.5.18 by Max Guglielmi
* build date: 2017-05-27T12:09:43.542Z
* tablefilter v0.5.19 by Max Guglielmi
* build date: 2017-05-29T03:24:32.741Z
* 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}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.5.18 by Max Guglielmi
* build date: 2017-05-27T12:09:43.542Z
* tablefilter v0.5.19 by Max Guglielmi
* build date: 2017-05-29T03:24:32.741Z
* 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}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.5.18 by Max Guglielmi
* build date: 2017-05-27T12:09:43.542Z
* tablefilter v0.5.19 by Max Guglielmi
* build date: 2017-05-29T03:24:32.741Z
* MIT License
*/
.activeHeader{background-color:#66afe9 !important;color:#fff !important}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.5.18 by Max Guglielmi
* build date: 2017-05-27T12:09:43.542Z
* tablefilter v0.5.19 by Max Guglielmi
* build date: 2017-05-29T03:24:32.741Z
* 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}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.5.18 by Max Guglielmi
* build date: 2017-05-27T12:09:43.542Z
* tablefilter v0.5.19 by Max Guglielmi
* build date: 2017-05-29T03:24:32.741Z
* 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}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.5.18 by Max Guglielmi
* build date: 2017-05-27T12:09:43.542Z
* tablefilter v0.5.19 by Max Guglielmi
* build date: 2017-05-29T03:24:32.741Z
* 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}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.5.18 by Max Guglielmi
* build date: 2017-05-27T12:09:43.542Z
* tablefilter v0.5.19 by Max Guglielmi
* build date: 2017-05-29T03:24:32.741Z
* MIT License
*/
table.TF{padding:0;color:inherit;border-right:1px solid transparent;border-top:1px solid transparent;border-left:1px solid transparent;border-bottom:0;}table.TF th{margin:0;color:inherit;background-color:transparent;border-color:transparent;border-width:1px;border-style:solid;}table.TF th:last-child{border-right:1px solid transparent}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid transparent;border-left:0;border-top:0;border-right:0}.fltrow{background-color:transparent;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px;border-bottom:1px solid transparent !important;}.fltrow th:last-child,.fltrow td:last-child{border-right:1px solid transparent}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4}input.flt{width:99% !important}.inf{background-color:transparent;border:1px solid transparent;height:$min-height;color:inherit}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:#f7f7f7 url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #f7f7f7 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#f7f7f7 url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #f7f7f7 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#f7f7f7 url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #f7f7f7 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#f7f7f7 url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #f7f7f7 !important}.activeHeader{background:#f7f7f7 !important;border:1px solid transparent;color:inherit !important}div.grd_Cont{-webkit-box-shadow:0 0 0 0 rgba(50,50,50,0.75);-moz-box-shadow:0 0 0 0 rgba(50,50,50,0.75);box-shadow:0 0 0 0 rgba(50,50,50,0.75);background-color:transparent;border:1px solid transparent;padding:0 !important;}div.grd_Cont .even{background-color:transparent}div.grd_Cont .odd{background-color:#f7f7f7}div.grd_headTblCont{background-color:transparent;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:transparent;border-bottom:1px solid transparent;border-right:1px solid transparent !important;border-left:1px solid transparent;border-top:1px solid transparent}div.grd_tblCont table td{border-bottom:1px solid transparent;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:transparent;color:inherit;border-top:1px solid transparent;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#f7f7f7;border:1px solid #f7f7f7;border-radius:5px;color:#000;text-shadow:none}.even{background-color:transparent}.odd{background-color:#f7f7f7}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ccc !important;color:inherit}.ezSelectedRow{background-color:#ccc !important;color:inherit}.ezActiveCell{background-color:transparent;color:inherit;font-weight:bold}.ezETSelectedCell{background-color:transparent;font-weight:bold;color:inherit}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.5.18 by Max Guglielmi
* build date: 2017-05-27T12:09:43.527Z
* tablefilter v0.5.19 by Max Guglielmi
* build date: 2017-05-29T03:24:32.725Z
* MIT License
*/

View file

@ -1,6 +1,6 @@
{
"name": "tablefilter",
"version": "0.5.18",
"version": "0.5.19",
"description": "A Javascript library making HTML tables filterable and a bit more",
"license": "MIT",
"author": {
@ -65,7 +65,7 @@
"script-loader": "^0.7.0",
"string-replace-webpack-plugin": "^0.0.5",
"sugar-date": "2.0.4",
"webpack": "^2.5.1",
"webpack": "^2.6.1",
"webpack-dev-server": "^2.4.5"
},
"dependencies": {},

View file

@ -19,4 +19,4 @@ export const has = (arr, val, caseSensitive) => {
}
}
return false;
}
};

View file

@ -18,7 +18,7 @@ export const getText = (node) => {
return trim(node.innerText);
}
return trim(node.textContent);
}
};
/**
* Returns the first text node contained in the supplied node
@ -32,7 +32,7 @@ export const getFirstTextNode = (node) => {
return n.data;
}
}
}
};
/**
* Creates an html element with given collection of attributes
@ -56,7 +56,7 @@ export const createElm = (...args) => {
}
}
return el;
}
};
/**
* Removes passed node from DOM
@ -87,7 +87,7 @@ export const hasClass = (ele, cls) => {
return ele.classList.contains(cls);
}
return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
}
};
/**
* Adds the specified class to the passed element
@ -110,7 +110,7 @@ export const addClass = (ele, cls) => {
else if (!hasClass(ele, cls)) {
ele.className += ' ' + cls;
}
}
};
/**
* Removes the specified class to the passed element
@ -128,7 +128,7 @@ export const removeClass = (ele, cls) => {
}
let reg = new RegExp('(\\s|^)' + cls + '(\\s|$)', 'g');
ele.className = ele.className.replace(reg, '');
}
};
/**
* Creates and returns an option element
@ -144,7 +144,7 @@ export const createOpt = (text, value, isSel) => {
createElm('option', ['value', value]);
opt.appendChild(createText(text));
return opt;
}
};
/**
* Creates and returns a checklist item
@ -168,7 +168,7 @@ export const createCheckItem = (id, chkValue, labelText) => {
li.label = label;
li.check = check;
return li;
}
};
/**
* Returns the element matching the supplied Id

View file

@ -101,7 +101,7 @@ export class DateType extends Feature {
* @returns {String} Locale code (ie: 'en-us')
*/
getLocale(colIndex) {
return this.getOptions(colIndex).locale || this.locale
return this.getOptions(colIndex).locale || this.locale;
}
/**

View file

@ -21,7 +21,7 @@ export class PopupFilter extends Feature {
super(tf, 'popupFilters');
// Configuration object
let f = this.config;
let f = this.config.popup_filters || {};
// Enable external filters
tf.isExternalFlt = true;
@ -31,50 +31,47 @@ export class PopupFilter extends Feature {
* Close active popup filter upon filtering, enabled by default
* @type {Boolean}
*/
this.closeOnFiltering = f.popup_filters_close_on_filtering === false ?
false : true;
this.closeOnFiltering = f.close_on_filtering === false ? false : true;
/**
* Filter icon path
* @type {String}
*/
this.iconPath = f.popup_filters_image ||
tf.themesPath + 'icn_filter.gif';
this.iconPath = f.image || tf.themesPath + 'icn_filter.gif';
/**
* Active filter icon path
* @type {string}
*/
this.activeIconPath = f.popup_filters_image_active ||
this.activeIconPath = f.image_active ||
tf.themesPath + 'icn_filterActive.gif';
/**
* HTML for the filter icon
* @type {string}
*/
this.iconHtml = f.popup_filters_image_html ||
this.iconHtml = f.image_html ||
'<img src="' + this.iconPath + '" alt="Column filter" />';
/**
* Css class assigned to the popup container element
* @type {String}
*/
this.placeholderCssClass =
f.popup_placeholder_css_class || 'popUpPlaceholder';
this.placeholderCssClass = f.placeholder_css_class ||
'popUpPlaceholder';
/**
* Css class assigned to filter container element
* @type {String}
*/
this.containerCssClass = f.popup_div_css_class || 'popUpFilter';
this.containerCssClass = f.div_css_class || 'popUpFilter';
/**
* Ensure filter's container element width matches column width, enabled
* by default
* @type {Boolean}
*/
this.adjustToContainer =
f.popup_filters_adjust_to_container === false ? false : true;
this.adjustToContainer = f.adjust_to_container === false ? false : true;
/**
* Callback fired before a popup filter is opened

View file

@ -26,4 +26,4 @@ export const parse = (value, decimal = '.') => {
// This will fail silently
return !isNaN(unformatted) ? unformatted : 0;
}
};

View file

@ -15,7 +15,7 @@ export const ignoreCase = (a, b) => {
let x = a.toLowerCase();
let y = b.toLowerCase();
return x < y ? -1 : (x > y ? 1 : 0);
}
};
/**
* Compare function for sorting passed numbers in ascending manner
@ -63,8 +63,8 @@ export const sortNumberStr = (compareFn, decimal = ',') => {
let num1 = parseNb(numStr1, decimal);
let num2 = parseNb(numStr2, decimal);
return compareFn(num1, num2);
}
}
};
};
/**
* Curried compare function for sorting passed formatted dates in desired
@ -78,5 +78,5 @@ export const sortDateStr = (compareFn, locale = 'en-us') => {
let date1 = SugarDate.create(dateStr1, locale);
let date2 = SugarDate.create(dateStr2, locale);
return compareFn(date1, date2);
}
}
};
};

View file

@ -14,7 +14,7 @@ export const trim = (text) => {
return text.trim();
}
return text.replace(/^\s*|\s*$/g, '');
}
};
/**
* Checks if passed string is empty
@ -32,7 +32,7 @@ export const rgxEsc = (text) => {
let chars = /[-\/\\^$*+?.()|[\]{}]/g;
let escMatch = '\\$&';
return String(text).replace(chars, escMatch);
}
};
/**
* Returns passed string as lowercase if caseSensitive flag set false. By
@ -45,7 +45,7 @@ export const matchCase = (text, caseSensitive = false) => {
return text.toLowerCase();
}
return text;
}
};
/**
* Checks if passed data contains the searched term
@ -73,4 +73,4 @@ export const contains = (term, data, exactMatch = false, caseSensitive = false,
regexp = new RegExp(rgxEsc(term), modifier);
}
return regexp.test(data);
}
};

View file

@ -8,7 +8,7 @@ import {isEmpty as isEmptyString} from './string';
import {
isArray, isEmpty, isFn, isNumber, isObj, isString, isUndef, EMPTY_FN
} from './types';
import {parse as parseNb} from './number'
import {parse as parseNb} from './number';
import {root} from './root';
import {Emitter} from './emitter';
@ -494,7 +494,7 @@ export class TableFilter {
* Indicate whether pop-up filters UI is enabled
* @type {Boolean}
*/
this.popupFilters = Boolean(f.popup_filters);
this.popupFilters = isObj(f.popup_filters) || Boolean(f.popup_filters);
/**
* Indicate whether filtered (active) columns indicator is enabled

View file

@ -138,7 +138,7 @@
// setup
var clearActiveColumns = markActiveColumns.clearActiveColumns;
var hit = 0;
markActiveColumns.clearActiveColumns = function() { hit++ };
markActiveColumns.clearActiveColumns = function() { hit++; };
markActiveColumns.initialized = false;
// act

View file

@ -110,7 +110,7 @@ test('Cannot init if initialised', function() {
// setup
var processAll = altRows.processAll;
var hit = 0;
altRows.processAll = function() { hit++ };
altRows.processAll = function() { hit++; };
altRows.initialized = true;
// act
@ -126,7 +126,7 @@ test('Cannot processAll if not enabled', function() {
// setup
var setRowBg = altRows.setRowBg;
var hit = 0;
altRows.setRowBg = function() { hit++ };
altRows.setRowBg = function() { hit++; };
altRows.enabled = false;
// act
@ -142,7 +142,7 @@ test('Cannot setRowBg if not enabled', function() {
// setup
var removeRowBg = altRows.removeRowBg;
var hit = 0;
altRows.removeRowBg = function() { hit++ };
altRows.removeRowBg = function() { hit++; };
altRows.enabled = false;
// act
@ -171,7 +171,7 @@ test('Cannot destroy if not initialised', function() {
// setup
var getRowsNb = altRows.tf.getRowsNb;
var hit = 0;
altRows.tf.getRowsNb = function() { hit++ };
altRows.tf.getRowsNb = function() { hit++; };
altRows.initialized = false;
// act

View file

@ -21,7 +21,7 @@
test('Sanity checks', function() {
deepEqual(tf instanceof TableFilter, true, 'TableFilter instanciated');
deepEqual(tf.cellParser.cols.length, 1,
'Columns implementing cell parser')
'Columns implementing cell parser');
deepEqual(typeof tf.cellParser.parse, 'function', 'Parse function');
deepEqual(
tf.getFilterElement(0).nodeName, 'SELECT', 'Expected filter type');
@ -60,7 +60,7 @@
tf.cellParser.cols = [];
tf.cellParser.parse = function() {
hit++;
}
};
// act
tf.getCellValue(cell);

View file

@ -41,7 +41,7 @@ test('Can refresh all drop-down filters', function() {
tf.clearFilters();
var build = checkList.build;
var hit = 0;
checkList.build = function() { hit++ };
checkList.build = function() { hit++; };
//act
checkList.refreshAll();

View file

@ -41,7 +41,7 @@ test('Can refresh all drop-down filters', function() {
tf.clearFilters();
var build = dropdown.build;
var hit = 0;
dropdown.build = function() { hit++ };
dropdown.build = function() { hit++; };
//act
dropdown.refreshAll();

View file

@ -46,7 +46,7 @@ test('Can parse a URL hash', function() {
// URL-encoded version of:
// #{"page":2,"page_length":4,"col_2":{"flt":">500"}}
var hashStr = '#%7B%22page%22%3A2%2C%22page_length%22%3A4'+
'%2C%22col_2%22%3A%7B%22flt%22%3A%22%3E500%22%7D%7D'
'%2C%22col_2%22%3A%7B%22flt%22%3A%22%3E500%22%7D%7D';
// act
var result = hash.parse(hashStr);

View file

@ -18,7 +18,7 @@ test('Does not init if initialised', function() {
var hit = 0;
loader.show = function() {
hit++;
}
};
// act
loader.init();

View file

@ -3,7 +3,7 @@
module('TableFilter with no rows');
test('throws when no rows', function() {
throws(
function() { new TableFilter('demo') },
function() { new TableFilter('demo'); },
Error,
'Throws Error when DOM table does not contain rows'
);

View file

@ -204,6 +204,36 @@ test('TableFilter re-initialised', function() {
deepEqual(id(tf.fltIds[3]).nodeName, 'SELECT', 'Filter exists');
});
module('Properties');
test('Can set icon HTML', function() {
// setup
tf.destroy();
tf = new TableFilter('demo', {
base_path: '../dist/tablefilter/',
col_2: 'multiple',
col_3: 'select',
col_4: 'none',
popup_filters: {
image_html: '<span>hello world</span>'
}
});
var feature = tf.feature('popupFilter');
feature.filtersCache = [];
feature.fltElms = [];
// act
tf.init();
var headersRow = tf.dom().rows[tf.getHeadersRowIndex()];
// assert
deepEqual(
headersRow.cells[1].innerHTML
.indexOf('<span>hello world</span>') !== -1,
true,
'Custom HTML element present'
);
});
module('Grid-layout');
test('Re-instantiated with grid-layout', function() {
tf.destroy();

View file

@ -78,7 +78,7 @@
// setup
var importFile = tf1.import;
var hit = 0;
tf1.import = function() { hit++ };
tf1.import = function() { hit++; };
tf1.initialized = true;
// act