mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-06-01 13:32:40 +02:00
commit
d4b14b13a7
|
@ -14,7 +14,7 @@
|
|||
"no-loop-func": 2,
|
||||
"no-floating-decimal": 2,
|
||||
"curly": 2,
|
||||
//"eqeqeq": [2, "smart"],
|
||||
"eqeqeq": [2, "smart"],
|
||||
"quotes": [2, "single"],
|
||||
"indent": [2, 4, {"SwitchCase": 1}],
|
||||
"no-trailing-spaces": 2,
|
||||
|
|
4
dist/starter.html
vendored
4
dist/starter.html
vendored
|
@ -1,10 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>tablefilter v0.2.25 - Starter</title>
|
||||
<title>tablefilter v0.2.26 - Starter</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>tablefilter v0.2.25</h1>
|
||||
<h1>tablefilter v0.2.26</h1>
|
||||
|
||||
|
||||
|
||||
|
|
4
dist/tablefilter/style/colsVisibility.css
vendored
4
dist/tablefilter/style/colsVisibility.css
vendored
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* tablefilter v0.2.25 by Max Guglielmi
|
||||
* build date: 2016-05-14T12:05:12.318Z
|
||||
* tablefilter v0.2.26 by Max Guglielmi
|
||||
* build date: 2016-05-15T03:36:44.888Z
|
||||
* 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}
|
4
dist/tablefilter/style/filtersVisibility.css
vendored
4
dist/tablefilter/style/filtersVisibility.css
vendored
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* tablefilter v0.2.25 by Max Guglielmi
|
||||
* build date: 2016-05-14T12:05:12.318Z
|
||||
* tablefilter v0.2.26 by Max Guglielmi
|
||||
* build date: 2016-05-15T03:36:44.888Z
|
||||
* 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}
|
4
dist/tablefilter/style/tablefilter.css
vendored
4
dist/tablefilter/style/tablefilter.css
vendored
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* tablefilter v0.2.25 by Max Guglielmi
|
||||
* build date: 2016-05-14T12:05:12.318Z
|
||||
* tablefilter v0.2.26 by Max Guglielmi
|
||||
* build date: 2016-05-15T03:36:44.888Z
|
||||
* MIT License
|
||||
*/
|
||||
.activeHeader{background-color:#66afe9 !important;color:#fff !important}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* tablefilter v0.2.25 by Max Guglielmi
|
||||
* build date: 2016-05-14T12:05:12.318Z
|
||||
* tablefilter v0.2.26 by Max Guglielmi
|
||||
* build date: 2016-05-15T03:36:44.888Z
|
||||
* 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}
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* tablefilter v0.2.25 by Max Guglielmi
|
||||
* build date: 2016-05-14T12:05:12.318Z
|
||||
* tablefilter v0.2.26 by Max Guglielmi
|
||||
* build date: 2016-05-15T03:36:44.888Z
|
||||
* 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}
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* tablefilter v0.2.25 by Max Guglielmi
|
||||
* build date: 2016-05-14T12:05:12.318Z
|
||||
* tablefilter v0.2.26 by Max Guglielmi
|
||||
* build date: 2016-05-15T03:36:44.888Z
|
||||
* 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}
|
12
dist/tablefilter/tablefilter.js
vendored
12
dist/tablefilter/tablefilter.js
vendored
File diff suppressed because one or more lines are too long
8
dist/tablefilter/tf-1.js
vendored
8
dist/tablefilter/tf-1.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "tablefilter",
|
||||
"version": "0.2.25",
|
||||
"version": "0.2.26",
|
||||
"description": "A Javascript library making HTML tables filterable and a bit more",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
import Str from './string';
|
||||
|
||||
export default {
|
||||
has: function(arr, val, caseSensitive){
|
||||
let sCase = caseSensitive===undefined ? false : caseSensitive;
|
||||
for (var i=0; i<arr.length; i++){
|
||||
if(Str.matchCase(arr[i].toString(), sCase) == val){
|
||||
has(arr, val, caseSensitive) {
|
||||
let sCase = Boolean(caseSensitive);
|
||||
for (var i = 0, l = arr.length; i < l; i++) {
|
||||
if (Str.matchCase(arr[i].toString(), sCase) === val) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ export default {
|
|||
format = 'DMY';
|
||||
}
|
||||
format = format.toUpperCase();
|
||||
if(format.length != 3) {
|
||||
if(format.length !== 3) {
|
||||
if(format === 'DDMMMYYYY'){
|
||||
let d = this.format(dateStr, format);
|
||||
dateStr = d.getDate() +'/'+ (d.getMonth()+1) +'/'+
|
||||
|
@ -71,10 +71,10 @@ export default {
|
|||
let dt = new Date(
|
||||
parseInt(yy, 10), parseInt(mm, 10)-1, parseInt(dd, 10),
|
||||
0, 0, 0, 0);
|
||||
if(parseInt(dd, 10) != dt.getDate()){
|
||||
if(parseInt(dd, 10) !== dt.getDate()){
|
||||
return false;
|
||||
}
|
||||
if(parseInt(mm, 10)-1 != dt.getMonth()){
|
||||
if(parseInt(mm, 10)-1 !== dt.getMonth()){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
66
src/dom.js
66
src/dom.js
|
@ -1,4 +1,4 @@
|
|||
import Types from './types';
|
||||
import {isUndef} from './types';
|
||||
import Str from './string';
|
||||
|
||||
/**
|
||||
|
@ -12,8 +12,8 @@ export default {
|
|||
* @param {NodeElement} node
|
||||
* @return {String}
|
||||
*/
|
||||
getText(node){
|
||||
if(Types.isUndef(node.textContent)) {
|
||||
getText(node) {
|
||||
if (isUndef(node.textContent)) {
|
||||
return Str.trim(node.innerText);
|
||||
}
|
||||
return Str.trim(node.textContent);
|
||||
|
@ -24,10 +24,10 @@ export default {
|
|||
* @param {NodeElement} node node
|
||||
* @return {String}
|
||||
*/
|
||||
getFirstTextNode(node){
|
||||
for(let i=0; i<node.childNodes.length; i++){
|
||||
getFirstTextNode(node) {
|
||||
for (let i = 0; i < node.childNodes.length; i++) {
|
||||
let n = node.childNodes[i];
|
||||
if(n.nodeType === 3){
|
||||
if (n.nodeType === 3) {
|
||||
return n.data;
|
||||
}
|
||||
}
|
||||
|
@ -40,18 +40,18 @@ export default {
|
|||
* items, the attribute name and its value ['id','myId']
|
||||
* @return {Object} created element
|
||||
*/
|
||||
create(tag){
|
||||
if(!tag || tag===''){
|
||||
create(tag) {
|
||||
if (!tag || tag === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
let el = document.createElement(tag),
|
||||
args = arguments;
|
||||
|
||||
if(args.length > 1){
|
||||
for(let i=0; i<args.length; i++){
|
||||
if (args.length > 1) {
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
let argtype = typeof args[i];
|
||||
if(argtype.toLowerCase() === 'object' && args[i].length === 2){
|
||||
if (argtype === 'object' && args[i].length === 2) {
|
||||
el.setAttribute(args[i][0], args[i][1]);
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ export default {
|
|||
* @param {DOMElement} node
|
||||
* @return {DOMElement} old node reference
|
||||
*/
|
||||
remove(node){
|
||||
remove(node) {
|
||||
return node.parentNode.removeChild(node);
|
||||
},
|
||||
|
||||
|
@ -73,43 +73,43 @@ export default {
|
|||
* @param {String} txt
|
||||
* @return {Object}
|
||||
*/
|
||||
text(txt){
|
||||
text(txt) {
|
||||
return document.createTextNode(txt);
|
||||
},
|
||||
|
||||
hasClass(ele, cls){
|
||||
if(!ele){ return false; }
|
||||
hasClass(ele, cls) {
|
||||
if (!ele) { return false; }
|
||||
|
||||
if(supportsClassList()){
|
||||
if (supportsClassList()) {
|
||||
return ele.classList.contains(cls);
|
||||
}
|
||||
return ele.className.match(new RegExp('(\\s|^)'+ cls +'(\\s|$)'));
|
||||
return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
|
||||
},
|
||||
|
||||
addClass(ele, cls){
|
||||
if(!ele){ return; }
|
||||
addClass(ele, cls) {
|
||||
if (!ele) { return; }
|
||||
|
||||
if(supportsClassList()){
|
||||
if (supportsClassList()) {
|
||||
ele.classList.add(cls);
|
||||
return;
|
||||
}
|
||||
|
||||
if(ele.className === ''){
|
||||
if (ele.className === '') {
|
||||
ele.className = cls;
|
||||
}
|
||||
else if(!this.hasClass(ele, cls)){
|
||||
else if (!this.hasClass(ele, cls)) {
|
||||
ele.className += ' ' + cls;
|
||||
}
|
||||
},
|
||||
|
||||
removeClass(ele, cls){
|
||||
if(!ele){ return; }
|
||||
removeClass(ele, cls) {
|
||||
if (!ele) { return; }
|
||||
|
||||
if(supportsClassList()){
|
||||
if (supportsClassList()) {
|
||||
ele.classList.remove(cls);
|
||||
return;
|
||||
}
|
||||
let reg = new RegExp('(\\s|^)'+ cls +'(\\s|$)', 'g');
|
||||
let reg = new RegExp('(\\s|^)' + cls + '(\\s|$)', 'g');
|
||||
ele.className = ele.className.replace(reg, '');
|
||||
},
|
||||
|
||||
|
@ -120,11 +120,11 @@ export default {
|
|||
* @param {Boolean} isSel whether option is selected
|
||||
* @return {Object} option element
|
||||
*/
|
||||
createOpt(text, value, isSel){
|
||||
createOpt(text, value, isSel) {
|
||||
let isSelected = isSel ? true : false,
|
||||
opt = isSelected ?
|
||||
this.create('option', ['value',value], ['selected','true']) :
|
||||
this.create('option', ['value',value]);
|
||||
this.create('option', ['value', value], ['selected', 'true']) :
|
||||
this.create('option', ['value', value]);
|
||||
opt.appendChild(this.text(text));
|
||||
return opt;
|
||||
},
|
||||
|
@ -136,7 +136,7 @@ export default {
|
|||
* @param {String} labelText check item label text
|
||||
* @return {Object} li DOM element
|
||||
*/
|
||||
createCheckItem(chkIndex, chkValue, labelText){
|
||||
createCheckItem(chkIndex, chkValue, labelText) {
|
||||
let li = this.create('li'),
|
||||
label = this.create('label', ['for', chkIndex]),
|
||||
check = this.create('input',
|
||||
|
@ -153,16 +153,16 @@ export default {
|
|||
return li;
|
||||
},
|
||||
|
||||
id(key){
|
||||
id(key) {
|
||||
return document.getElementById(key);
|
||||
},
|
||||
|
||||
tag(o, tagname){
|
||||
tag(o, tagname) {
|
||||
return o.getElementsByTagName(tagname);
|
||||
}
|
||||
};
|
||||
|
||||
// HTML5 classList API
|
||||
function supportsClassList(){
|
||||
function supportsClassList() {
|
||||
return document.documentElement.classList;
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ export default class AdapterEzEditTable extends Feature {
|
|||
paging.currentPageNb !== paging.nbPages) {
|
||||
paging.setPage('last');
|
||||
}
|
||||
else if ((rowIndex == validIndexes[0]) &&
|
||||
else if ((rowIndex === validIndexes[0]) &&
|
||||
paging.currentPageNb !== 1) {
|
||||
paging.setPage('first');
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {Feature} from '../../feature';
|
||||
import Dom from '../../dom';
|
||||
import Str from '../../string';
|
||||
import Types from '../../types';
|
||||
import {isArray, isFn, isUndef} from '../../types';
|
||||
|
||||
export default class ColOps extends Feature {
|
||||
|
||||
|
@ -13,10 +13,10 @@ export default class ColOps extends Feature {
|
|||
super(tf, opts.name);
|
||||
|
||||
//calls function before col operation
|
||||
this.onBeforeOperation = Types.isFn(opts.on_before_operation) ?
|
||||
this.onBeforeOperation = isFn(opts.on_before_operation) ?
|
||||
opts.on_before_operation : null;
|
||||
//calls function after col operation
|
||||
this.onAfterOperation = Types.isFn(opts.on_after_operation) ?
|
||||
this.onAfterOperation = isFn(opts.on_after_operation) ?
|
||||
opts.on_after_operation : null;
|
||||
|
||||
this.opts = opts;
|
||||
|
@ -67,7 +67,7 @@ export default class ColOps extends Feature {
|
|||
outputType = opts.write_method,
|
||||
totRowIndex = opts.tot_row_index,
|
||||
excludeRow = opts.exclude_row,
|
||||
decimalPrecision = Types.isUndef(opts.decimal_precision) ?
|
||||
decimalPrecision = isUndef(opts.decimal_precision) ?
|
||||
2 : opts.decimal_precision;
|
||||
|
||||
//nuovella: determine unique list of columns to operate on
|
||||
|
@ -90,9 +90,7 @@ export default class ColOps extends Feature {
|
|||
}
|
||||
}
|
||||
|
||||
if (Str.lower(typeof labelId) == 'object' &&
|
||||
Str.lower(typeof colIndex) == 'object' &&
|
||||
Str.lower(typeof operation) == 'object') {
|
||||
if (isArray(labelId) && isArray(colIndex) && isArray(operation)) {
|
||||
var rows = tf.tbl.rows,
|
||||
colvalues = [];
|
||||
|
||||
|
@ -134,8 +132,7 @@ export default class ColOps extends Feature {
|
|||
opsThisCol[mThisCol] = Str.lower(operation[k]);
|
||||
decThisCol[mThisCol] = decimalPrecision[k];
|
||||
labThisCol[mThisCol] = labelId[k];
|
||||
oTypeThisCol = outputType !== undefined &&
|
||||
Str.lower(typeof outputType) === 'object' ?
|
||||
oTypeThisCol = isArray(outputType) ?
|
||||
outputType[k] : null;
|
||||
|
||||
switch (opsThisCol[mThisCol]) {
|
||||
|
@ -166,7 +163,7 @@ export default class ColOps extends Feature {
|
|||
|
||||
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 ((q1Flag === 1) || (q3Flag === 1) || (medFlag === 1)) {
|
||||
if (j < colvalues[ucol].length - 1) {
|
||||
for (k = j + 1; k < colvalues[ucol].length; k++) {
|
||||
/* eslint-disable */
|
||||
|
@ -223,7 +220,7 @@ export default class ColOps extends Feature {
|
|||
if (q1Flag === 1) {
|
||||
posa = 0.0;
|
||||
posa = Math.floor(nbvalues / 4);
|
||||
if (4 * posa == nbvalues) {
|
||||
if (4 * posa === nbvalues) {
|
||||
q1Value = (theList[posa - 1] + theList[posa]) / 2;
|
||||
} else {
|
||||
q1Value = theList[posa];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {Feature} from '../../feature';
|
||||
import Dom from '../../dom';
|
||||
import Types from '../../types';
|
||||
import {isFn} from '../../types';
|
||||
import Event from '../../event';
|
||||
|
||||
export default class ColsVisibility extends Feature {
|
||||
|
@ -83,30 +83,27 @@ export default class ColsVisibility extends Feature {
|
|||
this.tblHasColTag = (Dom.tag(tf.tbl, 'col').length > 0);
|
||||
|
||||
//callback invoked just after cols manager is loaded
|
||||
this.onLoaded = Types.isFn(f.on_loaded) ? f.on_loaded : null;
|
||||
this.onLoaded = isFn(f.on_loaded) ? f.on_loaded : null;
|
||||
//calls function before cols manager is opened
|
||||
this.onBeforeOpen = Types.isFn(f.on_before_open) ?
|
||||
f.on_before_open : null;
|
||||
this.onBeforeOpen = isFn(f.on_before_open) ? f.on_before_open : null;
|
||||
//calls function after cols manager is opened
|
||||
this.onAfterOpen = Types.isFn(f.on_after_open) ? f.on_after_open : null;
|
||||
this.onAfterOpen = isFn(f.on_after_open) ? f.on_after_open : null;
|
||||
//calls function before cols manager is closed
|
||||
this.onBeforeClose = Types.isFn(f.on_before_close) ?
|
||||
f.on_before_close : null;
|
||||
this.onBeforeClose = isFn(f.on_before_close) ? f.on_before_close : null;
|
||||
//calls function after cols manager is closed
|
||||
this.onAfterClose = Types.isFn(f.on_after_close) ?
|
||||
f.on_after_close : null;
|
||||
this.onAfterClose = isFn(f.on_after_close) ? f.on_after_close : null;
|
||||
|
||||
//callback before col is hidden
|
||||
this.onBeforeColHidden = Types.isFn(f.on_before_col_hidden) ?
|
||||
this.onBeforeColHidden = isFn(f.on_before_col_hidden) ?
|
||||
f.on_before_col_hidden : null;
|
||||
//callback after col is hidden
|
||||
this.onAfterColHidden = Types.isFn(f.on_after_col_hidden) ?
|
||||
this.onAfterColHidden = isFn(f.on_after_col_hidden) ?
|
||||
f.on_after_col_hidden : null;
|
||||
//callback before col is displayed
|
||||
this.onBeforeColDisplayed = Types.isFn(f.on_before_col_displayed) ?
|
||||
this.onBeforeColDisplayed = isFn(f.on_before_col_displayed) ?
|
||||
f.on_before_col_displayed : null;
|
||||
//callback after col is displayed
|
||||
this.onAfterColDisplayed = Types.isFn(f.on_after_col_displayed) ?
|
||||
this.onAfterColDisplayed = isFn(f.on_after_col_displayed) ?
|
||||
f.on_after_col_displayed : null;
|
||||
|
||||
//Grid layout compatibility
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {Feature} from '../../feature';
|
||||
import Dom from '../../dom';
|
||||
import Types from '../../types';
|
||||
import {isFn, isUndef} from '../../types';
|
||||
import Event from '../../event';
|
||||
|
||||
export default class FiltersVisibility extends Feature {
|
||||
|
@ -52,26 +52,23 @@ export default class FiltersVisibility extends Feature {
|
|||
this.btnCssClass = f.btn_css_class || 'btnExpClpFlt';
|
||||
//defines css class span containing expand/collapse filters
|
||||
this.contCssClass = f.cont_css_class || 'expClpFlt';
|
||||
this.filtersRowIndex = !Types.isUndef(f.filters_row_index) ?
|
||||
this.filtersRowIndex = !isUndef(f.filters_row_index) ?
|
||||
f.filters_row_index : tf.getFiltersRowIndex();
|
||||
|
||||
this.visibleAtStart = !Types.isUndef(f.visible_at_start) ?
|
||||
this.visibleAtStart = !isUndef(f.visible_at_start) ?
|
||||
Boolean(f.visible_at_start) : true;
|
||||
|
||||
// Prefix
|
||||
this.prfx = 'fltsVis_';
|
||||
|
||||
//callback before filters row is shown
|
||||
this.onBeforeShow = Types.isFn(f.on_before_show) ?
|
||||
f.on_before_show : null;
|
||||
this.onBeforeShow = isFn(f.on_before_show) ? f.on_before_show : null;
|
||||
//callback after filters row is shown
|
||||
this.onAfterShow = Types.isFn(f.on_after_show) ?
|
||||
f.on_after_show : null;
|
||||
this.onAfterShow = isFn(f.on_after_show) ? f.on_after_show : null;
|
||||
//callback before filters row is hidden
|
||||
this.onBeforeHide = Types.isFn(f.on_before_hide) ?
|
||||
f.on_before_hide : null;
|
||||
this.onBeforeHide = isFn(f.on_before_hide) ? f.on_before_hide : null;
|
||||
//callback after filters row is hidden
|
||||
this.onAfterHide = Types.isFn(f.on_after_hide) ? f.on_after_hide : null;
|
||||
this.onAfterHide = isFn(f.on_after_hide) ? f.on_after_hide : null;
|
||||
|
||||
//Loads extension stylesheet
|
||||
tf.import(f.name + 'Style', tf.stylePath + this.stylesheet, null,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Feature} from '../../feature';
|
||||
import Types from '../../types';
|
||||
import {isArray, isFn, isUndef} from '../../types';
|
||||
import Dom from '../../dom';
|
||||
import Event from '../../event';
|
||||
import DateHelper from '../../date';
|
||||
|
@ -21,12 +21,11 @@ export default class AdapterSortableTable extends Feature {
|
|||
//indicates if table previously sorted
|
||||
this.sorted = false;
|
||||
|
||||
this.sortTypes = Types.isArray(opts.types) ? opts.types : [];
|
||||
this.sortColAtStart = Types.isArray(opts.sort_col_at_start) ?
|
||||
this.sortTypes = isArray(opts.types) ? opts.types : [];
|
||||
this.sortColAtStart = isArray(opts.sort_col_at_start) ?
|
||||
opts.sort_col_at_start : null;
|
||||
this.asyncSort = Boolean(opts.async_sort);
|
||||
this.triggerIds = Types.isArray(opts.trigger_ids) ?
|
||||
opts.trigger_ids : [];
|
||||
this.triggerIds = isArray(opts.trigger_ids) ? opts.trigger_ids : [];
|
||||
|
||||
// edit .sort-arrow.descending / .sort-arrow.ascending in
|
||||
// tablefilter.css to reflect any path change
|
||||
|
@ -39,14 +38,13 @@ export default class AdapterSortableTable extends Feature {
|
|||
this.customKey = opts.custom_key || 'data-tf-sortKey';
|
||||
|
||||
// callback invoked after sort is loaded and instanciated
|
||||
this.onSortLoaded = Types.isFn(opts.on_sort_loaded) ?
|
||||
this.onSortLoaded = isFn(opts.on_sort_loaded) ?
|
||||
opts.on_sort_loaded : null;
|
||||
// callback invoked before table is sorted
|
||||
this.onBeforeSort = Types.isFn(opts.on_before_sort) ?
|
||||
this.onBeforeSort = isFn(opts.on_before_sort) ?
|
||||
opts.on_before_sort : null;
|
||||
// callback invoked after table is sorted
|
||||
this.onAfterSort = Types.isFn(opts.on_after_sort) ?
|
||||
opts.on_after_sort : null;
|
||||
this.onAfterSort = isFn(opts.on_after_sort) ? opts.on_after_sort : null;
|
||||
|
||||
this.enable();
|
||||
}
|
||||
|
@ -59,7 +57,7 @@ export default class AdapterSortableTable extends Feature {
|
|||
let adpt = this;
|
||||
|
||||
// SortableTable class sanity check (sortabletable.js)
|
||||
if (Types.isUndef(SortableTable)) {
|
||||
if (isUndef(SortableTable)) {
|
||||
throw new Error('SortableTable class not found.');
|
||||
}
|
||||
|
||||
|
@ -160,7 +158,7 @@ export default class AdapterSortableTable extends Feature {
|
|||
SortableTable.getCellIndex = function (oTd) {
|
||||
let cells = oTd.parentNode.cells,
|
||||
l = cells.length, i;
|
||||
for (i = 0; cells[i] != oTd && i < l; i++) { }
|
||||
for (i = 0; cells[i] !== oTd && i < l; i++) { }
|
||||
return i;
|
||||
};
|
||||
|
||||
|
@ -420,7 +418,7 @@ function ipAddress(value) {
|
|||
function sortIP(a, b) {
|
||||
let aa = ipAddress(a.value.toLowerCase());
|
||||
let bb = ipAddress(b.value.toLowerCase());
|
||||
if (aa == bb) {
|
||||
if (aa === bb) {
|
||||
return 0;
|
||||
} else if (aa < bb) {
|
||||
return -1;
|
||||
|
|
|
@ -4,7 +4,7 @@ import Arr from '../array';
|
|||
import Str from '../string';
|
||||
import Sort from '../sort';
|
||||
import Event from '../event';
|
||||
import Types from '../types';
|
||||
import {isEmpty} from '../types';
|
||||
import {CHECKLIST, NONE} from '../const';
|
||||
|
||||
const SORT_ERROR = 'Filter options for column {0} cannot be sorted in ' +
|
||||
|
@ -180,8 +180,8 @@ export class CheckList extends Feature {
|
|||
((rows[k].style.display === '' && !tf.paging) ||
|
||||
(tf.paging && ((!activeIdx ||
|
||||
activeIdx === colIndex) ||
|
||||
(activeIdx != colIndex &&
|
||||
tf.validRowsIndex.indexOf(k) != -1)))))) {
|
||||
(activeIdx !== colIndex &&
|
||||
tf.validRowsIndex.indexOf(k) !== -1)))))) {
|
||||
|
||||
let cellData = tf.getCellData(cells[j]);
|
||||
//Vary Peter's patch
|
||||
|
@ -226,7 +226,7 @@ export class CheckList extends Feature {
|
|||
}
|
||||
}
|
||||
//asc sort
|
||||
if (tf.sortNumAsc.indexOf(colIndex) != -1) {
|
||||
if (tf.sortNumAsc.indexOf(colIndex) !== -1) {
|
||||
try {
|
||||
this.opts.sort(Sort.numSortAsc);
|
||||
if (this.excludedOpts) {
|
||||
|
@ -241,7 +241,7 @@ export class CheckList extends Feature {
|
|||
}//in case there are alphanumeric values
|
||||
}
|
||||
//desc sort
|
||||
if (tf.sortNumDesc.indexOf(colIndex) != -1) {
|
||||
if (tf.sortNumDesc.indexOf(colIndex) !== -1) {
|
||||
try {
|
||||
this.opts.sort(Sort.numSortDesc);
|
||||
if (this.excludedOpts) {
|
||||
|
@ -465,7 +465,7 @@ export class CheckList extends Feature {
|
|||
let tf = this.tf;
|
||||
let flt = tf.getFilterElement(colIndex);
|
||||
let fltAttr = flt.getAttribute('value');
|
||||
let values = Types.isEmpty(fltAttr) ? '' : fltAttr;
|
||||
let values = isEmpty(fltAttr) ? '' : fltAttr;
|
||||
|
||||
//removes last operator ||
|
||||
values = values.substr(0, values.length - 3);
|
||||
|
|
|
@ -175,11 +175,11 @@ export class Dropdown extends Feature {
|
|||
((rows[k].style.display === '' && !tf.paging) ||
|
||||
(tf.paging && (!tf.validRowsIndex ||
|
||||
(tf.validRowsIndex &&
|
||||
tf.validRowsIndex.indexOf(k) != -1)) &&
|
||||
tf.validRowsIndex.indexOf(k) !== -1)) &&
|
||||
((activeIdx === undefined ||
|
||||
activeIdx === colIndex) ||
|
||||
(activeIdx != colIndex &&
|
||||
tf.validRowsIndex.indexOf(k) != -1)))))) {
|
||||
(activeIdx !== colIndex &&
|
||||
tf.validRowsIndex.indexOf(k) !== -1)))))) {
|
||||
let cellData = tf.getCellData(cell[j]),
|
||||
//Vary Peter's patch
|
||||
cellString = Str.matchCase(cellData, matchCase);
|
||||
|
@ -224,7 +224,7 @@ export class Dropdown extends Feature {
|
|||
}
|
||||
|
||||
//asc sort
|
||||
if (tf.sortNumAsc.indexOf(colIndex) != -1) {
|
||||
if (tf.sortNumAsc.indexOf(colIndex) !== -1) {
|
||||
try {
|
||||
this.opts.sort(Sort.numSortAsc);
|
||||
if (excludedOpts) {
|
||||
|
@ -239,7 +239,7 @@ export class Dropdown extends Feature {
|
|||
}//in case there are alphanumeric values
|
||||
}
|
||||
//desc sort
|
||||
if (tf.sortNumDesc.indexOf(colIndex) != -1) {
|
||||
if (tf.sortNumDesc.indexOf(colIndex) !== -1) {
|
||||
try {
|
||||
this.opts.sort(Sort.numSortDesc);
|
||||
if (excludedOpts) {
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import {Feature} from '../feature';
|
||||
import Dom from '../dom';
|
||||
import Types from '../types';
|
||||
import {isFn, isNull, isUndef} from '../types';
|
||||
import Event from '../event';
|
||||
import Str from '../string';
|
||||
import {NONE} from '../const';
|
||||
|
||||
export class GridLayout extends Feature{
|
||||
export class GridLayout extends Feature {
|
||||
|
||||
/**
|
||||
* Grid layout, table with fixed headers
|
||||
* @param {Object} tf TableFilter instance
|
||||
*/
|
||||
constructor(tf){
|
||||
constructor(tf) {
|
||||
super(tf, 'gridLayout');
|
||||
|
||||
let f = this.config;
|
||||
|
@ -34,7 +34,7 @@ export class GridLayout extends Feature{
|
|||
//array of headers row indexes to be placed in header table
|
||||
this.gridHeadRows = f.grid_headers_rows || [0];
|
||||
//generate filters in table headers
|
||||
this.gridEnableFilters = f.grid_enable_default_filters!==undefined ?
|
||||
this.gridEnableFilters = !isUndef(f.grid_enable_default_filters) ?
|
||||
f.grid_enable_default_filters : true;
|
||||
this.noHeaders = Boolean(f.grid_no_headers);
|
||||
//default col width
|
||||
|
@ -64,31 +64,31 @@ export class GridLayout extends Feature{
|
|||
/**
|
||||
* Generates a grid with fixed headers
|
||||
*/
|
||||
init(){
|
||||
init() {
|
||||
let tf = this.tf;
|
||||
let f = this.config;
|
||||
let tbl = tf.tbl;
|
||||
|
||||
if(this.initialized){
|
||||
if (this.initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Override reference rows indexes
|
||||
tf.refRow = Types.isNull(tf.startRow) ? 0 : tf.startRow;
|
||||
tf.refRow = isNull(tf.startRow) ? 0 : tf.startRow;
|
||||
tf.headersRow = 0;
|
||||
tf.filtersRowIndex = 1;
|
||||
|
||||
tf.isExternalFlt = true;
|
||||
|
||||
// default width of 100px if column widths not set
|
||||
if(!tf.hasColWidths){
|
||||
if (!tf.hasColWidths) {
|
||||
tf.colWidths = [];
|
||||
for(let k=0; k<tf.nbCells; k++){
|
||||
for (let k = 0; k < tf.nbCells; k++) {
|
||||
let colW,
|
||||
cell = tbl.rows[this.gridHeadRowIndex].cells[k];
|
||||
if(cell.width !== ''){
|
||||
if (cell.width !== '') {
|
||||
colW = cell.width;
|
||||
} else if(cell.style.width !== ''){
|
||||
} else if (cell.style.width !== '') {
|
||||
colW = parseInt(cell.style.width, 10);
|
||||
} else {
|
||||
colW = this.gridDefaultColWidth;
|
||||
|
@ -100,10 +100,10 @@ export class GridLayout extends Feature{
|
|||
tf.setColWidths();
|
||||
|
||||
let tblW;//initial table width
|
||||
if(tbl.width !== ''){
|
||||
if (tbl.width !== '') {
|
||||
tblW = tbl.width;
|
||||
}
|
||||
else if(tbl.style.width !== ''){
|
||||
else if (tbl.style.width !== '') {
|
||||
tblW = parseInt(tbl.style.width, 10);
|
||||
} else {
|
||||
tblW = tbl.clientWidth;
|
||||
|
@ -113,7 +113,7 @@ export class GridLayout extends Feature{
|
|||
this.tblMainCont = Dom.create('div',
|
||||
['id', this.prfxMainTblCont + tf.id]);
|
||||
this.tblMainCont.className = this.gridMainContCssClass;
|
||||
if(this.gridWidth){
|
||||
if (this.gridWidth) {
|
||||
this.tblMainCont.style.width = this.gridWidth;
|
||||
}
|
||||
tbl.parentNode.insertBefore(this.tblMainCont, tbl);
|
||||
|
@ -121,14 +121,14 @@ export class GridLayout extends Feature{
|
|||
//Table container: div wrapping content table
|
||||
this.tblCont = Dom.create('div', ['id', this.prfxTblCont + tf.id]);
|
||||
this.tblCont.className = this.gridContCssClass;
|
||||
if(this.gridWidth){
|
||||
if(this.gridWidth.indexOf('%') != -1){
|
||||
if (this.gridWidth) {
|
||||
if (this.gridWidth.indexOf('%') !== -1) {
|
||||
this.tblCont.style.width = '100%';
|
||||
} else {
|
||||
this.tblCont.style.width = this.gridWidth;
|
||||
}
|
||||
}
|
||||
if(this.gridHeight){
|
||||
if (this.gridHeight) {
|
||||
this.tblCont.style.height = this.gridHeight;
|
||||
}
|
||||
tbl.parentNode.insertBefore(this.tblCont, tbl);
|
||||
|
@ -136,7 +136,7 @@ export class GridLayout extends Feature{
|
|||
this.tblCont.appendChild(t);
|
||||
|
||||
//In case table width is expressed in %
|
||||
if(tbl.style.width === ''){
|
||||
if (tbl.style.width === '') {
|
||||
tbl.style.width = (Str.contains('%', tblW) ?
|
||||
tbl.clientWidth : tblW) + 'px';
|
||||
}
|
||||
|
@ -146,10 +146,10 @@ export class GridLayout extends Feature{
|
|||
|
||||
//Headers table container: div wrapping headers table
|
||||
this.headTblCont = Dom.create(
|
||||
'div',['id', this.prfxHeadTblCont + tf.id]);
|
||||
'div', ['id', this.prfxHeadTblCont + tf.id]);
|
||||
this.headTblCont.className = this.gridHeadContCssClass;
|
||||
if(this.gridWidth){
|
||||
if(this.gridWidth.indexOf('%') != -1){
|
||||
if (this.gridWidth) {
|
||||
if (this.gridWidth.indexOf('%') !== -1) {
|
||||
this.headTblCont.style.width = '100%';
|
||||
} else {
|
||||
this.headTblCont.style.width = this.gridWidth;
|
||||
|
@ -164,11 +164,11 @@ export class GridLayout extends Feature{
|
|||
//Those ids are used by the sort feature
|
||||
let hRow = tbl.rows[this.gridHeadRowIndex];
|
||||
let sortTriggers = [];
|
||||
for(let n=0; n<tf.nbCells; n++){
|
||||
for (let n = 0; n < tf.nbCells; n++) {
|
||||
let c = hRow.cells[n];
|
||||
let thId = c.getAttribute('id');
|
||||
if(!thId || thId===''){
|
||||
thId = this.prfxGridTh+n+'_'+tf.id;
|
||||
if (!thId || thId === '') {
|
||||
thId = this.prfxGridTh + n + '_' + tf.id;
|
||||
c.setAttribute('id', thId);
|
||||
}
|
||||
sortTriggers.push(thId);
|
||||
|
@ -176,10 +176,10 @@ export class GridLayout extends Feature{
|
|||
|
||||
//Filters row is created
|
||||
let filtersRow = Dom.create('tr');
|
||||
if(this.gridEnableFilters && tf.fltGrid){
|
||||
if (this.gridEnableFilters && tf.fltGrid) {
|
||||
tf.externalFltTgtIds = [];
|
||||
for(let j=0; j<tf.nbCells; j++){
|
||||
let fltTdId = tf.prfxFlt+j+ this.prfxGridFltTd +tf.id;
|
||||
for (let j = 0; j < tf.nbCells; j++) {
|
||||
let fltTdId = tf.prfxFlt + j + this.prfxGridFltTd + tf.id;
|
||||
let cl = Dom.create(tf.fltCellTag, ['id', fltTdId]);
|
||||
filtersRow.appendChild(cl);
|
||||
tf.externalFltTgtIds[j] = fltTdId;
|
||||
|
@ -187,8 +187,8 @@ export class GridLayout extends Feature{
|
|||
}
|
||||
|
||||
//Headers row are moved from content table to headers table
|
||||
if(!this.noHeaders) {
|
||||
for(let i=0; i<this.gridHeadRows.length; i++){
|
||||
if (!this.noHeaders) {
|
||||
for (let i = 0; i < this.gridHeadRows.length; i++) {
|
||||
let headRow = tbl.rows[this.gridHeadRows[0]];
|
||||
tH.appendChild(headRow);
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ export class GridLayout extends Feature{
|
|||
}
|
||||
|
||||
this.headTbl.appendChild(tH);
|
||||
if(tf.filtersRowIndex === 0){
|
||||
if (tf.filtersRowIndex === 0) {
|
||||
tH.insertBefore(filtersRow, hRow);
|
||||
} else {
|
||||
tH.appendChild(filtersRow);
|
||||
|
@ -210,7 +210,7 @@ export class GridLayout extends Feature{
|
|||
|
||||
//THead needs to be removed in content table for sort feature
|
||||
let thead = Dom.tag(tbl, 'thead');
|
||||
if(thead.length>0){
|
||||
if (thead.length > 0) {
|
||||
tbl.removeChild(thead[0]);
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ export class GridLayout extends Feature{
|
|||
//
|
||||
|
||||
//scroll synchronisation
|
||||
Event.add(this.tblCont, 'scroll', (evt)=> {
|
||||
Event.add(this.tblCont, 'scroll', (evt) => {
|
||||
let elm = Event.target(evt);
|
||||
let scrollLeft = elm.scrollLeft;
|
||||
this.headTblCont.scrollLeft = scrollLeft;
|
||||
|
@ -255,10 +255,10 @@ export class GridLayout extends Feature{
|
|||
});
|
||||
|
||||
//Configure sort extension if any
|
||||
let sort = (f.extensions || []).filter(function(itm){
|
||||
let sort = (f.extensions || []).filter(function (itm) {
|
||||
return itm.name === 'sort';
|
||||
});
|
||||
if(sort.length === 1){
|
||||
if (sort.length === 1) {
|
||||
sort[0].async_sort = true;
|
||||
sort[0].trigger_ids = sortTriggers;
|
||||
}
|
||||
|
@ -268,9 +268,9 @@ export class GridLayout extends Feature{
|
|||
|
||||
//Col elements are enough to keep column widths after sorting and
|
||||
//filtering
|
||||
let createColTags = function(){
|
||||
for(let k=(tf.nbCells-1); k>=0; k--){
|
||||
let col = Dom.create('col', ['id', tf.id+'_col_'+k]);
|
||||
let createColTags = function () {
|
||||
for (let k = (tf.nbCells - 1); k >= 0; k--) {
|
||||
let col = Dom.create('col', ['id', tf.id + '_col_' + k]);
|
||||
tbl.insertBefore(col, tbl.firstChild);
|
||||
col.style.width = tf.colWidths[k];
|
||||
this.gridColElms[k] = col;
|
||||
|
@ -278,21 +278,21 @@ export class GridLayout extends Feature{
|
|||
this.tblHasColTag = true;
|
||||
};
|
||||
|
||||
if(!this.tblHasColTag){
|
||||
if (!this.tblHasColTag) {
|
||||
createColTags.call(this);
|
||||
} else {
|
||||
let cols = Dom.tag(tbl, 'col');
|
||||
for(let ii=0; ii<tf.nbCells; ii++){
|
||||
cols[ii].setAttribute('id', tf.id+'_col_'+ii);
|
||||
for (let ii = 0; ii < tf.nbCells; ii++) {
|
||||
cols[ii].setAttribute('id', tf.id + '_col_' + ii);
|
||||
cols[ii].style.width = tf.colWidths[ii];
|
||||
this.gridColElms.push(cols[ii]);
|
||||
}
|
||||
}
|
||||
|
||||
let afterColResizedFn = Types.isFn(f.on_after_col_resized) ?
|
||||
let afterColResizedFn = isFn(f.on_after_col_resized) ?
|
||||
f.on_after_col_resized : null;
|
||||
f.on_after_col_resized = function(o, colIndex){
|
||||
if(!colIndex){
|
||||
f.on_after_col_resized = function (o, colIndex) {
|
||||
if (!colIndex) {
|
||||
return;
|
||||
}
|
||||
let w = o.crWColsRow.cells[colIndex].style.width;
|
||||
|
@ -302,21 +302,21 @@ export class GridLayout extends Feature{
|
|||
let thCW = o.crWColsRow.cells[colIndex].clientWidth;
|
||||
let tdCW = o.crWRowDataTbl.cells[colIndex].clientWidth;
|
||||
|
||||
if(thCW != tdCW){
|
||||
o.headTbl.style.width = tbl.clientWidth+'px';
|
||||
if (thCW !== tdCW) {
|
||||
o.headTbl.style.width = tbl.clientWidth + 'px';
|
||||
}
|
||||
|
||||
if(afterColResizedFn){
|
||||
if (afterColResizedFn) {
|
||||
afterColResizedFn.call(null, o, colIndex);
|
||||
}
|
||||
};
|
||||
|
||||
if(tf.popupFilters){
|
||||
if (tf.popupFilters) {
|
||||
filtersRow.style.display = NONE;
|
||||
}
|
||||
|
||||
if(tbl.clientWidth !== this.headTbl.clientWidth){
|
||||
tbl.style.width = this.headTbl.clientWidth+'px';
|
||||
if (tbl.clientWidth !== this.headTbl.clientWidth) {
|
||||
tbl.style.width = this.headTbl.clientWidth + 'px';
|
||||
}
|
||||
|
||||
this.initialized = true;
|
||||
|
@ -325,11 +325,11 @@ export class GridLayout extends Feature{
|
|||
/**
|
||||
* Removes the grid layout
|
||||
*/
|
||||
destroy(){
|
||||
destroy() {
|
||||
let tf = this.tf;
|
||||
let tbl = tf.tbl;
|
||||
|
||||
if(!this.initialized){
|
||||
if (!this.initialized) {
|
||||
return;
|
||||
}
|
||||
let t = Dom.remove(tbl);
|
||||
|
|
|
@ -6,7 +6,7 @@ const location = root.location;
|
|||
const decodeURIComponent = root.decodeURIComponent;
|
||||
|
||||
export const hasHashChange = () => {
|
||||
var docMode = root.documentMode;
|
||||
let docMode = root.documentMode;
|
||||
return ('onhashchange' in root) && (docMode === undefined || docMode > 7);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Dom from '../dom';
|
||||
import Str from '../string';
|
||||
import Types from '../types';
|
||||
import {isArray} from '../types';
|
||||
|
||||
export class HighlightKeyword {
|
||||
|
||||
|
@ -100,7 +100,7 @@ export class HighlightKeyword {
|
|||
}
|
||||
// iterate filters values to unhighlight all values
|
||||
this.tf.getFiltersValue().forEach((val) => {
|
||||
if (Types.isArray(val)) {
|
||||
if (isArray(val)) {
|
||||
val.forEach((item) =>
|
||||
this.unhighlight(item, this.highlightCssClass));
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {Feature} from '../feature';
|
||||
import Dom from '../dom';
|
||||
import Types from '../types';
|
||||
import {isFn} from '../types';
|
||||
import {root} from '../root';
|
||||
import {NONE} from '../const';
|
||||
|
||||
|
@ -29,11 +29,9 @@ export class Loader extends Feature {
|
|||
//delay for hiding loader
|
||||
this.loaderCloseDelay = 250;
|
||||
//callback function before loader is displayed
|
||||
this.onShowLoader = Types.isFn(f.on_show_loader) ?
|
||||
f.on_show_loader : null;
|
||||
this.onShowLoader = isFn(f.on_show_loader) ? f.on_show_loader : null;
|
||||
//callback function after loader is closed
|
||||
this.onHideLoader = Types.isFn(f.on_hide_loader) ?
|
||||
f.on_hide_loader : null;
|
||||
this.onHideLoader = isFn(f.on_hide_loader) ? f.on_hide_loader : null;
|
||||
//loader div
|
||||
this.prfxLoader = 'load_';
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {Feature} from '../feature';
|
||||
import Dom from '../dom';
|
||||
import Types from '../types';
|
||||
import {isEmpty, isFn} from '../types';
|
||||
import {NONE} from '../const';
|
||||
|
||||
export class NoResults extends Feature{
|
||||
|
@ -18,23 +18,23 @@ export class NoResults extends Feature{
|
|||
this.content = f.content || 'No results';
|
||||
this.customContainer = f.custom_container || null;
|
||||
this.customContainerId = f.custom_container_id || null;
|
||||
this.isExternal = !Types.isEmpty(this.customContainer) ||
|
||||
!Types.isEmpty(this.customContainerId);
|
||||
this.isExternal = !isEmpty(this.customContainer) ||
|
||||
!isEmpty(this.customContainerId);
|
||||
this.cssClass = f.css_class || 'no-results';
|
||||
|
||||
this.cont = null;
|
||||
|
||||
//callback before message is displayed
|
||||
this.onBeforeShowMsg = Types.isFn(f.on_before_show_msg) ?
|
||||
this.onBeforeShowMsg = isFn(f.on_before_show_msg) ?
|
||||
f.on_before_show_msg : null;
|
||||
//callback after message is displayed
|
||||
this.onAfterShowMsg = Types.isFn(f.on_after_show_msg) ?
|
||||
this.onAfterShowMsg = isFn(f.on_after_show_msg) ?
|
||||
f.on_after_show_msg : null;
|
||||
//callback before message is hidden
|
||||
this.onBeforeHideMsg = Types.isFn(f.on_before_hide_msg) ?
|
||||
this.onBeforeHideMsg = isFn(f.on_before_hide_msg) ?
|
||||
f.on_before_hide_msg : null;
|
||||
//callback after message is hidden
|
||||
this.onAfterHideMsg = Types.isFn(f.on_after_hide_msg) ?
|
||||
this.onAfterHideMsg = isFn(f.on_after_hide_msg) ?
|
||||
f.on_after_hide_msg : null;
|
||||
|
||||
this.prfxNoResults = 'nores_';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {Feature} from '../feature';
|
||||
import Dom from '../dom';
|
||||
import Types from '../types';
|
||||
import {isArray, isFn, isNull} from '../types';
|
||||
import Str from '../string';
|
||||
import Event from '../event';
|
||||
import {INPUT, SELECT, NONE, ENTER_KEY} from '../const';
|
||||
|
@ -36,7 +36,7 @@ export class Paging extends Feature {
|
|||
//stores results per page text and values
|
||||
this.resultsPerPage = f.results_per_page || null;
|
||||
//enables/disables results per page drop-down
|
||||
this.hasResultsPerPage = Types.isArray(this.resultsPerPage);
|
||||
this.hasResultsPerPage = 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
|
||||
|
@ -86,10 +86,10 @@ export class Paging extends Feature {
|
|||
//defines previous page button html
|
||||
this.pageSelectorType = f.page_selector_type || SELECT;
|
||||
//calls function before page is changed
|
||||
this.onBeforeChangePage = Types.isFn(f.on_before_change_page) ?
|
||||
this.onBeforeChangePage = isFn(f.on_before_change_page) ?
|
||||
f.on_before_change_page : null;
|
||||
//calls function before page is changed
|
||||
this.onAfterChangePage = Types.isFn(f.on_after_change_page) ?
|
||||
this.onAfterChangePage = isFn(f.on_after_change_page) ?
|
||||
f.on_after_change_page : null;
|
||||
|
||||
//pages select
|
||||
|
@ -428,8 +428,7 @@ export class Paging extends Feature {
|
|||
var rowDisplayed = false;
|
||||
|
||||
if (h >= startPagingRow && h < endPagingRow) {
|
||||
if (Types.isNull(isRowValid) ||
|
||||
Boolean(isRowValid === 'true')) {
|
||||
if (isNull(isRowValid) || Boolean(isRowValid === 'true')) {
|
||||
r.style.display = '';
|
||||
rowDisplayed = true;
|
||||
}
|
||||
|
@ -505,7 +504,7 @@ export class Paging extends Feature {
|
|||
ev.target.blur();
|
||||
};
|
||||
|
||||
var slcR = Dom.create( SELECT, ['id', this.prfxSlcResults + tf.id]);
|
||||
var slcR = Dom.create(SELECT, ['id', this.prfxSlcResults + tf.id]);
|
||||
slcR.className = this.resultsSlcCssClass;
|
||||
var slcRText = this.resultsPerPage[0],
|
||||
slcROpts = this.resultsPerPage[1];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Feature} from '../feature';
|
||||
import Types from '../types';
|
||||
import {isFn} from '../types';
|
||||
import Dom from '../dom';
|
||||
import Event from '../event';
|
||||
import {INPUT, NONE} from '../const';
|
||||
|
@ -31,17 +31,16 @@ export class PopupFilter extends Feature{
|
|||
//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 = Types.isFn(f.on_before_popup_filter_open) ?
|
||||
this.onBeforePopUpOpen = isFn(f.on_before_popup_filter_open) ?
|
||||
f.on_before_popup_filter_open : null;
|
||||
//callback function after popup filtes is opened
|
||||
this.onAfterPopUpOpen = Types.isFn(f.on_after_popup_filter_open) ?
|
||||
this.onAfterPopUpOpen = isFn(f.on_after_popup_filter_open) ?
|
||||
f.on_after_popup_filter_open : null;
|
||||
//callback function before popup filtes is closed
|
||||
this.onBeforePopUpClose =
|
||||
Types.isFn(f.on_before_popup_filter_close) ?
|
||||
this.onBeforePopUpClose = isFn(f.on_before_popup_filter_close) ?
|
||||
f.on_before_popup_filter_close : null;
|
||||
//callback function after popup filtes is closed
|
||||
this.onAfterPopUpClose = Types.isFn(f.on_after_popup_filter_close) ?
|
||||
this.onAfterPopUpClose = isFn(f.on_after_popup_filter_close) ?
|
||||
f.on_after_popup_filter_close : null;
|
||||
|
||||
//stores filters spans
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {Feature} from '../feature';
|
||||
import Dom from '../dom';
|
||||
import Types from '../types';
|
||||
import {isFn} from '../types';
|
||||
|
||||
export class RowsCounter extends Feature{
|
||||
|
||||
|
@ -33,10 +33,10 @@ export class RowsCounter extends Feature{
|
|||
//label preceding nb rows label
|
||||
this.prfxTotRowsTxt = 'totRowsTextSpan_';
|
||||
//callback raised before counter is refreshed
|
||||
this.onBeforeRefreshCounter = Types.isFn(f.on_before_refresh_counter) ?
|
||||
this.onBeforeRefreshCounter = isFn(f.on_before_refresh_counter) ?
|
||||
f.on_before_refresh_counter : null;
|
||||
//callback raised after counter is refreshed
|
||||
this.onAfterRefreshCounter = Types.isFn(f.on_after_refresh_counter) ?
|
||||
this.onAfterRefreshCounter = isFn(f.on_after_refresh_counter) ?
|
||||
f.on_after_refresh_counter : null;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import {Feature} from '../feature';
|
|||
import {Hash} from './hash';
|
||||
import {Storage} from './storage';
|
||||
import Str from '../string';
|
||||
import Types from '../types';
|
||||
import {isArray, isNull, isString, isUndef} from '../types';
|
||||
|
||||
/**
|
||||
* Reflects the state of features to be persisted via hash, localStorage or
|
||||
|
@ -25,10 +25,10 @@ export class State extends Feature {
|
|||
let cfg = this.config.state;
|
||||
|
||||
this.enableHash = cfg === true ||
|
||||
(Types.isObj(cfg.types) && cfg.types.indexOf('hash') !== -1);
|
||||
this.enableLocalStorage = Types.isObj(cfg.types) &&
|
||||
(isArray(cfg.types) && cfg.types.indexOf('hash') !== -1);
|
||||
this.enableLocalStorage = isArray(cfg.types) &&
|
||||
cfg.types.indexOf('local_storage') !== -1;
|
||||
this.enableCookie = Types.isObj(cfg.types) &&
|
||||
this.enableCookie = isArray(cfg.types) &&
|
||||
cfg.types.indexOf('cookie') !== -1;
|
||||
this.persistFilters = cfg.filters === false ? false : true;
|
||||
this.persistPageNumber = Boolean(cfg.page_number);
|
||||
|
@ -107,7 +107,7 @@ export class State extends Feature {
|
|||
filterValues.forEach((val, idx) => {
|
||||
let key = `${this.prfxCol}${idx}`;
|
||||
|
||||
if (Types.isString(val) && Str.isEmpty(val)) {
|
||||
if (isString(val) && Str.isEmpty(val)) {
|
||||
if (state.hasOwnProperty(key)) {
|
||||
state[key].flt = undefined;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ export class State extends Feature {
|
|||
}
|
||||
|
||||
if (this.persistPageNumber) {
|
||||
if (Types.isNull(this.pageNb)) {
|
||||
if (isNull(this.pageNb)) {
|
||||
state[this.pageNbKey] = undefined;
|
||||
} else {
|
||||
state[this.pageNbKey] = this.pageNb;
|
||||
|
@ -127,7 +127,7 @@ export class State extends Feature {
|
|||
}
|
||||
|
||||
if (this.persistPageLength) {
|
||||
if (Types.isNull(this.pageLength)) {
|
||||
if (isNull(this.pageLength)) {
|
||||
state[this.pageLengthKey] = undefined;
|
||||
} else {
|
||||
state[this.pageLengthKey] = this.pageLength;
|
||||
|
@ -135,7 +135,7 @@ export class State extends Feature {
|
|||
}
|
||||
|
||||
if (this.persistSort) {
|
||||
if (!Types.isNull(this.sort)) {
|
||||
if (!isNull(this.sort)) {
|
||||
// Remove previuosly sorted column
|
||||
Object.keys(state).forEach((key) => {
|
||||
if (key.indexOf(this.prfxCol) !== -1 && state[key]) {
|
||||
|
@ -150,7 +150,7 @@ export class State extends Feature {
|
|||
}
|
||||
|
||||
if (this.persistColsVisibility) {
|
||||
if (!Types.isNull(this.hiddenCols)) {
|
||||
if (!isNull(this.hiddenCols)) {
|
||||
// Clear previuosly hidden columns
|
||||
Object.keys(state).forEach((key) => {
|
||||
if (key.indexOf(this.prfxCol) !== -1 && state[key]) {
|
||||
|
@ -167,7 +167,7 @@ export class State extends Feature {
|
|||
}
|
||||
|
||||
if (this.persistFiltersVisibility) {
|
||||
if (Types.isNull(this.filtersVisibility)) {
|
||||
if (isNull(this.filtersVisibility)) {
|
||||
state[this.filtersVisKey] = undefined;
|
||||
} else {
|
||||
state[this.filtersVisKey] = this.filtersVisibility;
|
||||
|
@ -319,7 +319,7 @@ export class State extends Feature {
|
|||
Object.keys(state).forEach((key) => {
|
||||
if (key.indexOf(this.prfxCol) !== -1) {
|
||||
let colIdx = parseInt(key.replace(this.prfxCol, ''), 10);
|
||||
if (!Types.isUndef(state[key].sort)) {
|
||||
if (!isUndef(state[key].sort)) {
|
||||
let sort = state[key].sort;
|
||||
this.emitter.emit('sort', tf, colIdx, sort.descending);
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ export class State extends Feature {
|
|||
Object.keys(state).forEach((key) => {
|
||||
if (key.indexOf(this.prfxCol) !== -1) {
|
||||
let colIdx = parseInt(key.replace(this.prfxCol, ''), 10);
|
||||
if (!Types.isUndef(state[key].hidden)) {
|
||||
if (!isUndef(state[key].hidden)) {
|
||||
hiddenCols.push(colIdx);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {Feature} from '../feature';
|
||||
import {root} from '../root';
|
||||
import Dom from '../dom';
|
||||
import Types from '../types';
|
||||
import {isFn} from '../types';
|
||||
|
||||
export class StatusBar extends Feature{
|
||||
|
||||
|
@ -31,10 +31,10 @@ export class StatusBar extends Feature{
|
|||
this.statusBarCloseDelay = 250;
|
||||
|
||||
//calls function before message is displayed
|
||||
this.onBeforeShowMsg = Types.isFn(f.on_before_show_msg) ?
|
||||
this.onBeforeShowMsg = isFn(f.on_before_show_msg) ?
|
||||
f.on_before_show_msg : null;
|
||||
//calls function after message is displayed
|
||||
this.onAfterShowMsg = Types.isFn(f.on_after_show_msg) ?
|
||||
this.onAfterShowMsg = isFn(f.on_after_show_msg) ?
|
||||
f.on_after_show_msg : null;
|
||||
|
||||
//status messages
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import Event from './event';
|
||||
import Dom from './dom';
|
||||
import Str from './string';
|
||||
import Types from './types';
|
||||
import {isArray, isEmpty, isFn, isNumber, isObj, isString, isUndef}
|
||||
from './types';
|
||||
import DateHelper from './date';
|
||||
import Helpers from './helpers';
|
||||
|
||||
|
@ -54,28 +55,25 @@ export class TableFilter {
|
|||
this.nbCells = null;
|
||||
this._hasGrid = false;
|
||||
|
||||
// TODO: use for-of with babel plug-in
|
||||
// TODO: use for-of
|
||||
args.forEach((arg) => {
|
||||
// for (let arg of args) {
|
||||
let argtype = typeof arg;
|
||||
if (argtype === 'object' && arg && arg.nodeName === 'TABLE') {
|
||||
if (typeof arg === 'object' && arg.nodeName === 'TABLE') {
|
||||
this.tbl = arg;
|
||||
this.id = arg.id || `tf_${new Date().getTime()}_`;
|
||||
} else if (argtype === 'string') {
|
||||
} else if (isString(arg)) {
|
||||
this.id = arg;
|
||||
this.tbl = Dom.id(arg);
|
||||
} else if (argtype === 'number') {
|
||||
} else if (isNumber(arg)) {
|
||||
this.startRow = arg;
|
||||
} else if (argtype === 'object') {
|
||||
} else if (isObj(arg)) {
|
||||
this.cfg = arg;
|
||||
}
|
||||
// }
|
||||
});
|
||||
|
||||
if (!this.tbl || this.tbl.nodeName !== 'TABLE' ||
|
||||
this.getRowsNb() === 0) {
|
||||
throw new Error('Could not instantiate TableFilter: HTML table ' +
|
||||
'DOMElement not found.');
|
||||
throw new Error(`Could not instantiate TableFilter: HTML table
|
||||
DOM element not found.`);
|
||||
}
|
||||
|
||||
// configuration object
|
||||
|
@ -104,7 +102,7 @@ export class TableFilter {
|
|||
(this.filtersRowIndex === 0 ? 1 : 0) : f.headers_row_index;
|
||||
|
||||
//defines tag of the cells containing filters (td/th)
|
||||
this.fltCellTag = Types.isString(f.filters_cell_tag) ?
|
||||
this.fltCellTag = isString(f.filters_cell_tag) ?
|
||||
f.filters_cell_tag : CELL_TAG;
|
||||
|
||||
//stores filters ids
|
||||
|
@ -147,7 +145,7 @@ export class TableFilter {
|
|||
//enables/disbles rows alternating bg colors
|
||||
this.alternateRows = Boolean(f.alternate_rows);
|
||||
//defines widths of columns
|
||||
this.hasColWidths = Types.isArray(f.col_widths);
|
||||
this.hasColWidths = isArray(f.col_widths);
|
||||
this.colWidths = this.hasColWidths ? f.col_widths : null;
|
||||
//defines css class for filters
|
||||
this.fltCssClass = f.flt_css_class || 'flt';
|
||||
|
@ -162,15 +160,14 @@ export class TableFilter {
|
|||
//enables/disables enter key
|
||||
this.enterKey = f.enter_key === false ? false : true;
|
||||
//calls function before filtering starts
|
||||
this.onBeforeFilter = Types.isFn(f.on_before_filter) ?
|
||||
this.onBeforeFilter = isFn(f.on_before_filter) ?
|
||||
f.on_before_filter : null;
|
||||
//calls function after filtering
|
||||
this.onAfterFilter = Types.isFn(f.on_after_filter) ?
|
||||
f.on_after_filter : null;
|
||||
this.onAfterFilter = 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 = Types.isArray(f.columns_exact_match);
|
||||
this.hasExactMatchByCol = isArray(f.columns_exact_match);
|
||||
this.exactMatchByCol = this.hasExactMatchByCol ?
|
||||
f.columns_exact_match : [];
|
||||
//enables/disbles exact match for search
|
||||
|
@ -192,26 +189,26 @@ export class TableFilter {
|
|||
//stores filters elements if isExternalFlt is true
|
||||
this.externalFltEls = [];
|
||||
//calls function when filters grid loaded
|
||||
this.onFiltersLoaded = Types.isFn(f.on_filters_loaded) ?
|
||||
this.onFiltersLoaded = 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 = Types.isFn(f.on_row_validated) ?
|
||||
this.onRowValidated = isFn(f.on_row_validated) ?
|
||||
f.on_row_validated : null;
|
||||
//array defining columns for customCellData event
|
||||
this.customCellDataCols = f.custom_cell_data_cols ?
|
||||
f.custom_cell_data_cols : [];
|
||||
//calls custom function for retrieving cell data
|
||||
this.customCellData = Types.isFn(f.custom_cell_data) ?
|
||||
this.customCellData = isFn(f.custom_cell_data) ?
|
||||
f.custom_cell_data : null;
|
||||
//input watermark text array
|
||||
this.watermark = f.watermark || '';
|
||||
this.isWatermarkArray = Types.isArray(this.watermark);
|
||||
this.isWatermarkArray = isArray(this.watermark);
|
||||
//id of toolbar container element
|
||||
this.toolBarTgtId = f.toolbar_target_id || null;
|
||||
//enables/disables help div
|
||||
this.help = Types.isUndef(f.help_instructions) ?
|
||||
this.help = isUndef(f.help_instructions) ?
|
||||
undefined : Boolean(f.help_instructions);
|
||||
//popup filters
|
||||
this.popupFilters = Boolean(f.popup_filters);
|
||||
|
@ -221,10 +218,10 @@ export class TableFilter {
|
|||
this.activeColumnsCssClass = f.active_columns_css_class ||
|
||||
'activeHeader';
|
||||
//calls function before active column header is marked
|
||||
this.onBeforeActiveColumn = Types.isFn(f.on_before_active_column) ?
|
||||
this.onBeforeActiveColumn = isFn(f.on_before_active_column) ?
|
||||
f.on_before_active_column : null;
|
||||
//calls function after active column header is marked
|
||||
this.onAfterActiveColumn = Types.isFn(f.on_after_active_column) ?
|
||||
this.onAfterActiveColumn = isFn(f.on_after_active_column) ?
|
||||
f.on_after_active_column : null;
|
||||
|
||||
/*** select filter's customisation and behaviours ***/
|
||||
|
@ -250,7 +247,7 @@ export class TableFilter {
|
|||
this.sortNumDesc = this.isSortNumDesc ? f.sort_num_desc : [];
|
||||
//Select filters are populated on demand
|
||||
this.loadFltOnDemand = Boolean(f.load_filters_on_demand);
|
||||
this.hasCustomOptions = Types.isObj(f.custom_options);
|
||||
this.hasCustomOptions = isObj(f.custom_options);
|
||||
this.customOptions = f.custom_options;
|
||||
|
||||
/*** Filter operators ***/
|
||||
|
@ -296,11 +293,10 @@ export class TableFilter {
|
|||
//defines css class for reset button
|
||||
this.btnResetCssClass = f.btn_reset_css_class || 'reset';
|
||||
//callback function before filters are cleared
|
||||
this.onBeforeReset = Types.isFn(f.on_before_reset) ?
|
||||
this.onBeforeReset = isFn(f.on_before_reset) ?
|
||||
f.on_before_reset : null;
|
||||
//callback function after filters are cleared
|
||||
this.onAfterReset = Types.isFn(f.on_after_reset) ?
|
||||
f.on_after_reset : null;
|
||||
this.onAfterReset = isFn(f.on_after_reset) ? f.on_after_reset : null;
|
||||
|
||||
/*** paging ***/
|
||||
//enables/disables table paging
|
||||
|
@ -323,11 +319,11 @@ export class TableFilter {
|
|||
this.highlightKeywords = Boolean(f.highlight_keywords);
|
||||
|
||||
/*** No results feature ***/
|
||||
this.noResults = Types.isObj(f.no_results_message) ||
|
||||
this.noResults = isObj(f.no_results_message) ||
|
||||
Boolean(f.no_results_message);
|
||||
|
||||
// stateful
|
||||
this.state = Types.isObj(f.state) || Boolean(f.state);
|
||||
this.state = isObj(f.state) || Boolean(f.state);
|
||||
|
||||
/*** data types ***/
|
||||
//defines default date type (european DMY)
|
||||
|
@ -338,11 +334,11 @@ export class TableFilter {
|
|||
//US & javascript = '.' EU = ','
|
||||
this.decimalSeparator = f.decimal_separator || '.';
|
||||
//enables number format per column
|
||||
this.hasColNbFormat = Types.isArray(f.col_number_format);
|
||||
this.hasColNbFormat = 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 = Types.isArray(f.col_date_type);
|
||||
this.hasColDateType = isArray(f.col_date_type);
|
||||
//array containing columns date type
|
||||
this.colDateType = this.hasColDateType ? f.col_date_type : null;
|
||||
|
||||
|
@ -372,12 +368,12 @@ export class TableFilter {
|
|||
/*** extensions ***/
|
||||
//imports external script
|
||||
this.extensions = f.extensions;
|
||||
this.hasExtensions = Types.isArray(this.extensions);
|
||||
this.hasExtensions = isArray(this.extensions);
|
||||
|
||||
/*** themes ***/
|
||||
this.enableDefaultTheme = Boolean(f.enable_default_theme);
|
||||
//imports themes
|
||||
this.hasThemes = (this.enableDefaultTheme || Types.isArray(f.themes));
|
||||
this.hasThemes = (this.enableDefaultTheme || isArray(f.themes));
|
||||
this.themes = f.themes || [];
|
||||
//themes path
|
||||
this.themesPath = f.themes_path || this.stylePath + 'themes/';
|
||||
|
@ -476,7 +472,7 @@ export class TableFilter {
|
|||
if (!this.gridLayout) {
|
||||
fltrow.appendChild(fltcell);
|
||||
}
|
||||
inpclass = (i == n - 1 && this.displayBtn) ?
|
||||
inpclass = (i === n - 1 && this.displayBtn) ?
|
||||
this.fltSmallCssClass : this.fltCssClass;
|
||||
|
||||
//only 1 input for single search
|
||||
|
@ -503,7 +499,7 @@ export class TableFilter {
|
|||
}
|
||||
|
||||
// this adds submit button
|
||||
if (i == n - 1 && this.displayBtn) {
|
||||
if (i === n - 1 && this.displayBtn) {
|
||||
this._buildSubmitButton(i, fltcell);
|
||||
}
|
||||
|
||||
|
@ -848,7 +844,7 @@ export class TableFilter {
|
|||
* @return {Boolean}
|
||||
*/
|
||||
hasExtension(name) {
|
||||
return !Types.isEmpty(this.ExtRegistry[name]);
|
||||
return !isEmpty(this.ExtRegistry[name]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -879,7 +875,7 @@ export class TableFilter {
|
|||
let defaultTheme = { name: 'default' };
|
||||
this.themes.push(defaultTheme);
|
||||
}
|
||||
if (Types.isArray(themes)) {
|
||||
if (isArray(themes)) {
|
||||
for (let i = 0, len = themes.length; i < len; i++) {
|
||||
let theme = themes[i];
|
||||
let name = theme.name;
|
||||
|
@ -971,7 +967,7 @@ export class TableFilter {
|
|||
// TODO: subcribe modules to destroy event instead
|
||||
Object.keys(Mod).forEach(function (key) {
|
||||
let feature = Mod[key];
|
||||
if (feature && Types.isFn(feature.destroy)) {
|
||||
if (feature && isFn(feature.destroy)) {
|
||||
feature.destroy();
|
||||
}
|
||||
});
|
||||
|
@ -1046,7 +1042,7 @@ export class TableFilter {
|
|||
this.mDiv = Dom.id(this.prfxMDiv + this.id);
|
||||
|
||||
// emit help initialisation only if undefined
|
||||
if (Types.isUndef(this.help)) {
|
||||
if (isUndef(this.help)) {
|
||||
// explicitily set enabled field to true to initialise help by
|
||||
// default, only if setting is undefined
|
||||
this.Mod.help.enabled = true;
|
||||
|
@ -1096,7 +1092,7 @@ export class TableFilter {
|
|||
*/
|
||||
isCustomOptions(colIndex) {
|
||||
return this.hasCustomOptions &&
|
||||
this.customOptions.cols.indexOf(colIndex) != -1;
|
||||
this.customOptions.cols.indexOf(colIndex) !== -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1106,7 +1102,7 @@ export class TableFilter {
|
|||
* @return {Array}
|
||||
*/
|
||||
getCustomOptions(colIndex) {
|
||||
if (Types.isEmpty(colIndex) || !this.isCustomOptions(colIndex)) {
|
||||
if (isEmpty(colIndex) || !this.isCustomOptions(colIndex)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1256,12 +1252,12 @@ export class TableFilter {
|
|||
// different date
|
||||
else if (isDFDate) {
|
||||
dte2 = DateHelper.format(sA.replace(re_d, ''), dtType);
|
||||
occurence = dte1.toString() != dte2.toString();
|
||||
occurence = dte1.toString() !== dte2.toString();
|
||||
}
|
||||
// equal date
|
||||
else if (isEQDate) {
|
||||
dte2 = DateHelper.format(sA.replace(re_eq, ''), dtType);
|
||||
occurence = dte1.toString() == dte2.toString();
|
||||
occurence = dte1.toString() === dte2.toString();
|
||||
}
|
||||
// searched keyword with * operator doesn't have to be a date
|
||||
else if (re_lk.test(sA)) {// like date
|
||||
|
@ -1429,11 +1425,11 @@ export class TableFilter {
|
|||
hasMultiAndSA = sAAndSplit.length > 1;
|
||||
|
||||
//detect operators or array query
|
||||
if (Types.isArray(sA) || hasMultiOrSA || hasMultiAndSA) {
|
||||
if (isArray(sA) || hasMultiOrSA || hasMultiAndSA) {
|
||||
let cS,
|
||||
s,
|
||||
occur = false;
|
||||
if (Types.isArray(sA)) {
|
||||
if (isArray(sA)) {
|
||||
s = sA;
|
||||
} else {
|
||||
s = hasMultiOrSA ? sAOrSplit : sAAndSplit;
|
||||
|
@ -1447,7 +1443,7 @@ export class TableFilter {
|
|||
(hasMultiAndSA && !occur)) {
|
||||
break;
|
||||
}
|
||||
if (Types.isArray(sA) && occur) {
|
||||
if (isArray(sA) && occur) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1519,7 +1515,7 @@ export class TableFilter {
|
|||
let isExludedRow = false;
|
||||
// checks if current row index appears in exclude array
|
||||
if (exclude.length > 0) {
|
||||
isExludedRow = exclude.indexOf(i) != -1;
|
||||
isExludedRow = exclude.indexOf(i) !== -1;
|
||||
}
|
||||
let cell = row[i].cells,
|
||||
nchilds = cell.length;
|
||||
|
@ -1528,7 +1524,7 @@ export class TableFilter {
|
|||
if (nchilds === this.nbCells && !isExludedRow) {
|
||||
// this loop retrieves cell data
|
||||
for (let j = 0; j < nchilds; j++) {
|
||||
if (j != colIndex || row[i].style.display !== '') {
|
||||
if (j !== colIndex || row[i].style.display !== '') {
|
||||
continue;
|
||||
}
|
||||
let cellData = this.getCellData(cell[j]),
|
||||
|
@ -1573,7 +1569,7 @@ export class TableFilter {
|
|||
}
|
||||
//return an empty string if collection is empty or contains a single
|
||||
//empty string
|
||||
if (Types.isArray(fltValue) && fltValue.length === 0 ||
|
||||
if (isArray(fltValue) && fltValue.length === 0 ||
|
||||
(fltValue.length === 1 && fltValue[0] === '')) {
|
||||
fltValue = '';
|
||||
}
|
||||
|
@ -1592,7 +1588,7 @@ export class TableFilter {
|
|||
let searchArgs = [];
|
||||
for (let i = 0, len = this.fltIds.length; i < len; i++) {
|
||||
let fltValue = this.getFilterValue(i);
|
||||
if (Types.isArray(fltValue)) {
|
||||
if (isArray(fltValue)) {
|
||||
searchArgs.push(fltValue);
|
||||
} else {
|
||||
searchArgs.push(Str.trim(fltValue));
|
||||
|
@ -1664,7 +1660,7 @@ export class TableFilter {
|
|||
* @return {Number} Number of filterable rows
|
||||
*/
|
||||
getRowsNb(includeHeaders) {
|
||||
let s = Types.isUndef(this.refRow) ? 0 : this.refRow,
|
||||
let s = isUndef(this.refRow) ? 0 : this.refRow,
|
||||
ntrs = this.tbl.rows.length;
|
||||
if (includeHeaders) { s = 0; }
|
||||
return parseInt(ntrs - s, 10);
|
||||
|
@ -1678,7 +1674,8 @@ export class TableFilter {
|
|||
getCellData(cell) {
|
||||
let idx = cell.cellIndex;
|
||||
//Check for customCellData callback
|
||||
if (this.customCellData && this.customCellDataCols.indexOf(idx) != -1) {
|
||||
if (this.customCellData &&
|
||||
this.customCellDataCols.indexOf(idx) !== -1) {
|
||||
return this.customCellData.call(null, this, cell, idx);
|
||||
} else {
|
||||
return Dom.getText(cell);
|
||||
|
@ -1771,7 +1768,7 @@ export class TableFilter {
|
|||
* TODO: provide an API returning data in JSON format
|
||||
*/
|
||||
getFilteredDataCol(colIndex, includeHeaders = false) {
|
||||
if (Types.isUndef(colIndex)) {
|
||||
if (isUndef(colIndex)) {
|
||||
return [];
|
||||
}
|
||||
let data = this.getFilteredData(),
|
||||
|
@ -1792,13 +1789,10 @@ export class TableFilter {
|
|||
|
||||
/**
|
||||
* Get the display value of a row
|
||||
* @param {RowElement} row DOM element of the row
|
||||
* @param {HTMLTableRowElement} row DOM element of the row
|
||||
* @return {String} Usually 'none' or ''
|
||||
*/
|
||||
getRowDisplay(row) {
|
||||
if (!Types.isObj(row)) {
|
||||
return null;
|
||||
}
|
||||
return row.style.display;
|
||||
}
|
||||
|
||||
|
@ -1873,7 +1867,7 @@ export class TableFilter {
|
|||
}
|
||||
//multiple selects
|
||||
else if (fltColType === MULTIPLE) {
|
||||
let values = Types.isArray(query) ? query :
|
||||
let values = isArray(query) ? query :
|
||||
query.split(' ' + this.orOperator + ' ');
|
||||
|
||||
if (this.loadFltOnDemand && !this.initialized) {
|
||||
|
@ -1890,7 +1884,7 @@ export class TableFilter {
|
|||
this.emitter.emit('build-checklist-filter', this, index,
|
||||
this.isExternalFlt);
|
||||
}
|
||||
if (Types.isArray(query)) {
|
||||
if (isArray(query)) {
|
||||
values = query;
|
||||
} else {
|
||||
query = Str.matchCase(query, this.caseSensitive);
|
||||
|
@ -2036,7 +2030,7 @@ export class TableFilter {
|
|||
* @param colIndex Index of a column
|
||||
*/
|
||||
activateFilter(colIndex) {
|
||||
if (Types.isUndef(colIndex)) {
|
||||
if (isUndef(colIndex)) {
|
||||
return;
|
||||
}
|
||||
this.setActiveFilterId(this.getFilterId(colIndex));
|
||||
|
@ -2065,10 +2059,10 @@ export class TableFilter {
|
|||
// Welcome to cyclomatic complexity hell :)
|
||||
// TODO: simplify/refactor if statement
|
||||
if (activeIdx !== slcIndex[i] ||
|
||||
(this.paging && slcA1.indexOf(slcIndex[i]) != -1 &&
|
||||
(this.paging && slcA1.indexOf(slcIndex[i]) !== -1 &&
|
||||
activeIdx === slcIndex[i]) ||
|
||||
(!this.paging && (slcA3.indexOf(slcIndex[i]) != -1 ||
|
||||
slcA2.indexOf(slcIndex[i]) != -1)) ||
|
||||
(!this.paging && (slcA3.indexOf(slcIndex[i]) !== -1 ||
|
||||
slcA2.indexOf(slcIndex[i]) !== -1)) ||
|
||||
slcSelectedValue === this.displayAllText) {
|
||||
|
||||
//1st option needs to be inserted
|
||||
|
@ -2078,7 +2072,7 @@ export class TableFilter {
|
|||
curSlc.appendChild(opt0);
|
||||
}
|
||||
|
||||
if (slcA3.indexOf(slcIndex[i]) != -1) {
|
||||
if (slcA3.indexOf(slcIndex[i]) !== -1) {
|
||||
this.emitter.emit('build-checklist-filter', this,
|
||||
slcIndex[i]);
|
||||
} else {
|
||||
|
@ -2111,7 +2105,7 @@ export class TableFilter {
|
|||
isImported(filePath, type) {
|
||||
let imported = false,
|
||||
importType = !type ? 'script' : type,
|
||||
attr = importType == 'script' ? 'src' : 'href',
|
||||
attr = importType === 'script' ? 'src' : 'href',
|
||||
files = Dom.tag(doc, importType);
|
||||
for (let i = 0, len = files.length; i < len; i++) {
|
||||
if (files[i][attr] === undefined) {
|
||||
|
|
131
src/types.js
131
src/types.js
|
@ -1,4 +1,3 @@
|
|||
import {root} from './root';
|
||||
|
||||
/**
|
||||
* Types utilities
|
||||
|
@ -6,87 +5,63 @@ import {root} from './root';
|
|||
|
||||
const UNDEFINED = void 0;
|
||||
|
||||
export default {
|
||||
/**
|
||||
* Check if argument is an object or a global object
|
||||
* @param {String or Object} v
|
||||
* @return {Boolean}
|
||||
*/
|
||||
isObj(v) {
|
||||
let isO = false;
|
||||
if (typeof v === 'string') {
|
||||
if (root[v] && typeof root[v] === 'object') {
|
||||
isO = true;
|
||||
}
|
||||
} else {
|
||||
if (v && typeof v === 'object') {
|
||||
isO = true;
|
||||
}
|
||||
}
|
||||
return isO;
|
||||
},
|
||||
/**
|
||||
* Check passed argument is an object
|
||||
* @param {Object} obj
|
||||
* @return {Boolean}
|
||||
*/
|
||||
export const isObj =
|
||||
obj => Object.prototype.toString.call(obj) === '[object Object]';
|
||||
|
||||
/**
|
||||
* Check if argument is a function
|
||||
* @param {Function} fn
|
||||
* @return {Boolean}
|
||||
*/
|
||||
isFn(fn) {
|
||||
return (fn && fn.constructor == Function);
|
||||
},
|
||||
/**
|
||||
* Check passed argument is a function
|
||||
* @param {Function} obj
|
||||
* @return {Boolean}
|
||||
*/
|
||||
export const isFn =
|
||||
obj => Object.prototype.toString.call(obj) === '[object Function]';
|
||||
|
||||
/**
|
||||
* Check if argument is an array
|
||||
* @param {Array} obj
|
||||
* @return {Boolean}
|
||||
*/
|
||||
isArray(obj) {
|
||||
return (obj && obj.constructor == Array);
|
||||
},
|
||||
/**
|
||||
* Check passed argument is an array
|
||||
* @param {Array} obj
|
||||
* @return {Boolean}
|
||||
*/
|
||||
export const isArray =
|
||||
obj => Object.prototype.toString.call(obj) === '[object Array]';
|
||||
|
||||
/**
|
||||
* Check argument is a string
|
||||
* @param {String} val Value
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isString(val) {
|
||||
return Object.prototype.toString.call(val) === '[object String]';
|
||||
},
|
||||
/**
|
||||
* Check passed argument is a string
|
||||
* @param {String} obj objue
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export const isString =
|
||||
obj => Object.prototype.toString.call(obj) === '[object String]';
|
||||
|
||||
/**
|
||||
* Check passed argument is a number
|
||||
* @param {Number} obj
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export const isNumber =
|
||||
obj => Object.prototype.toString.call(obj) === '[object Number]';
|
||||
|
||||
/**
|
||||
* Check argument is a number
|
||||
* @param {Number} val
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isNumber(val) {
|
||||
return Object.prototype.toString.call(val) === '[object Number]';
|
||||
},
|
||||
/**
|
||||
* Check passed argument is undefined
|
||||
* @param {Any} obj
|
||||
* @return {Boolean}
|
||||
*/
|
||||
export const isUndef = obj => obj === UNDEFINED;
|
||||
|
||||
/**
|
||||
* Determine if argument is undefined
|
||||
* @param {Any} o
|
||||
* @return {Boolean}
|
||||
*/
|
||||
isUndef(o) {
|
||||
return o === UNDEFINED;
|
||||
},
|
||||
/**
|
||||
* Check passed argument is null
|
||||
* @param {Any} obj
|
||||
* @return {Boolean}
|
||||
*/
|
||||
export const isNull = obj => obj === null;
|
||||
|
||||
/**
|
||||
* Determine if argument is null
|
||||
* @param {Any} o
|
||||
* @return {Boolean}
|
||||
*/
|
||||
isNull(o) {
|
||||
return o === null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Determine if argument is empty (undefined, null or empty string)
|
||||
* @param {Any} o
|
||||
* @return {Boolean}
|
||||
*/
|
||||
isEmpty(o) {
|
||||
return this.isUndef(o) || this.isNull(o) || o.length === 0;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Check passed argument is empty (undefined, null or empty string)
|
||||
* @param {Any} obj
|
||||
* @return {Boolean}
|
||||
*/
|
||||
export const isEmpty = obj => isUndef(obj) || isNull(obj) || obj.length === 0;
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
var header1 = tf.getHeaderElement(1);
|
||||
var header3 = tf.getHeaderElement(3);
|
||||
deepEqual(
|
||||
header1.className.indexOf('activeHeader') != -1,
|
||||
header1.className.indexOf('activeHeader') !== -1,
|
||||
true,
|
||||
'Active filter indicator');
|
||||
deepEqual(
|
||||
header3.className.indexOf('activeHeader') != -1,
|
||||
header3.className.indexOf('activeHeader') !== -1,
|
||||
true,
|
||||
'Active filter indicator');
|
||||
});
|
||||
|
@ -44,11 +44,11 @@
|
|||
var header1 = tf.getHeaderElement(1);
|
||||
var header3 = tf.getHeaderElement(3);
|
||||
deepEqual(
|
||||
header1.className.indexOf('activeHeader') != -1,
|
||||
header1.className.indexOf('activeHeader') !== -1,
|
||||
true,
|
||||
'Active filter indicator');
|
||||
deepEqual(
|
||||
header3.className.indexOf('activeHeader') != -1,
|
||||
header3.className.indexOf('activeHeader') !== -1,
|
||||
true,
|
||||
'Active filter indicator');
|
||||
});
|
||||
|
@ -69,11 +69,11 @@
|
|||
var header1 = tf.getHeaderElement(1);
|
||||
var header3 = tf.getHeaderElement(3);
|
||||
deepEqual(
|
||||
header1.className.indexOf('activeHeader') != -1,
|
||||
header1.className.indexOf('activeHeader') !== -1,
|
||||
true,
|
||||
'Active filter indicator');
|
||||
deepEqual(
|
||||
header3.className.indexOf('activeHeader') != -1,
|
||||
header3.className.indexOf('activeHeader') !== -1,
|
||||
true,
|
||||
'Active filter indicator');
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ var hash = state.hash;
|
|||
module('Sanity checks');
|
||||
test('State instance', function() {
|
||||
deepEqual(typeof hash, 'object', 'Hash is instantiated');
|
||||
deepEqual(hash.lastHash, '', 'Last store hash');
|
||||
deepEqual(hash.lastHash, '', 'Last stored hash');
|
||||
deepEqual(hash.state, state, 'State instance');
|
||||
deepEqual(hash.emitter, state.emitter, 'Emitter instance');
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue