1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-04 23:53:15 +02:00

Added eqeqeq eslint rule

This commit is contained in:
Max Guglielmi 2016-05-15 13:33:16 +10:00
parent 0d58349432
commit be3903d2eb
19 changed files with 107 additions and 109 deletions

View file

@ -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,

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.2.26 by Max Guglielmi
* build date: 2016-05-15T02:51:02.911Z
* build date: 2016-05-15T03:27:18.988Z
* 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.2.26 by Max Guglielmi
* build date: 2016-05-15T02:51:02.911Z
* build date: 2016-05-15T03:27:18.988Z
* 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.2.26 by Max Guglielmi
* build date: 2016-05-15T02:51:02.911Z
* build date: 2016-05-15T03:27:18.988Z
* MIT License
*/
.activeHeader{background-color:#66afe9 !important;color:#fff !important}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.2.26 by Max Guglielmi
* build date: 2016-05-15T02:51:02.911Z
* build date: 2016-05-15T03:27:18.988Z
* 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.2.26 by Max Guglielmi
* build date: 2016-05-15T02:51:02.911Z
* build date: 2016-05-15T03:27:18.988Z
* 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.2.26 by Max Guglielmi
* build date: 2016-05-15T02:51:02.911Z
* build date: 2016-05-15T03:27:18.988Z
* 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}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -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: function (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;
}
}

View file

@ -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;

View file

@ -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');
}

View file

@ -1,7 +1,7 @@
import {Feature} from '../../feature';
import Dom from '../../dom';
import Str from '../../string';
import {isFn, isUndef} from '../../types';
import {isArray, isFn, isUndef} from '../../types';
export default class ColOps extends Feature {
@ -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];

View file

@ -158,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;
};
@ -418,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;

View file

@ -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) {

View file

@ -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) {

View file

@ -1,17 +1,17 @@
import {Feature} from '../feature';
import Dom from '../dom';
import {isFn, isNull} 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,12 +64,12 @@ 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;
}
@ -81,14 +81,14 @@ export class GridLayout extends Feature{
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,12 +278,12 @@ 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]);
}
@ -291,8 +291,8 @@ export class GridLayout extends Feature{
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);

View file

@ -472,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
@ -499,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);
}
@ -1092,7 +1092,7 @@ export class TableFilter {
*/
isCustomOptions(colIndex) {
return this.hasCustomOptions &&
this.customOptions.cols.indexOf(colIndex) != -1;
this.customOptions.cols.indexOf(colIndex) !== -1;
}
/**
@ -1252,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
@ -1515,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;
@ -1524,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]),
@ -1674,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);
@ -2058,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
@ -2071,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 {
@ -2104,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) {

View file

@ -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');