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

Changed var into let

This commit is contained in:
Max Guglielmi 2015-05-30 22:23:33 +10:00
parent ec79d1410a
commit 36dd10fda8
28 changed files with 723 additions and 739 deletions

View file

@ -2,11 +2,11 @@
* Array utilities
*/
import {Str} from './string';
import Str from './string';
var Arr = {
export default {
has: function(arr, val, caseSensitive){
var sCase = caseSensitive===undefined ? false : caseSensitive;
let sCase = caseSensitive===undefined ? false : caseSensitive;
for (var i=0; i<arr.length; i++){
if(Str.matchCase(arr[i].toString(), sCase) == val){
return true;
@ -15,7 +15,7 @@ var Arr = {
return false;
},
indexByValue: function(arr, val, caseSensitive){
var sCase = caseSensitive===undefined ? false : caseSensitive;
let sCase = caseSensitive===undefined ? false : caseSensitive;
for (var i=0; i<arr.length; i++){
if(Str.matchCase(arr[i].toString(), sCase) == val){
return i;
@ -24,5 +24,3 @@ var Arr = {
return -1;
}
};
exports.Arr = Arr;

View file

@ -2,57 +2,57 @@
* Cookie utilities
*/
var Cookie = {};
export default {
Cookie.write = function(name, value, hours){
var expire = '';
if(hours){
expire = new Date((new Date()).getTime() + hours * 3600000);
expire = '; expires=' + expire.toGMTString();
}
document.cookie = name + '=' + escape(value) + expire;
};
Cookie.read = function(name){
var cookieValue = '',
search = name + '=';
if(document.cookie.length > 0){
var cookie = document.cookie,
offset = cookie.indexOf(search);
if(offset !== -1){
offset += search.length;
var end = cookie.indexOf(';', offset);
if(end === -1){
end = cookie.length;
}
cookieValue = unescape(cookie.substring(offset, end));
write(name, value, hours){
let expire = '';
if(hours){
expire = new Date((new Date()).getTime() + hours * 3600000);
expire = '; expires=' + expire.toGMTString();
}
document.cookie = name + '=' + escape(value) + expire;
},
read(name){
let cookieValue = '',
search = name + '=';
if(document.cookie.length > 0){
let cookie = document.cookie,
offset = cookie.indexOf(search);
if(offset !== -1){
offset += search.length;
let end = cookie.indexOf(';', offset);
if(end === -1){
end = cookie.length;
}
cookieValue = unescape(cookie.substring(offset, end));
}
}
return cookieValue;
},
remove(name){
this.write(name, '', -1);
},
valueToArray(name, separator){
if(!separator){
separator = ',';
}
//reads the cookie
let val = this.read(name);
//creates an array with filters' values
let arr = val.split(separator);
return arr;
},
getValueByIndex(name, index, separator){
if(!separator){
separator = ',';
}
//reads the cookie
let val = this.valueToArray(name, separator);
return val[index];
}
return cookieValue;
};
Cookie.remove = function(name){
this.write(name, '', -1);
};
Cookie.valueToArray = function(name, separator){
if(!separator){
separator = ',';
}
//reads the cookie
var val = this.read(name);
//creates an array with filters' values
var arr = val.split(separator);
return arr;
};
Cookie.getValueByIndex = function(name, index, separator){
if(!separator){
separator = ',';
}
//reads the cookie
var val = this.valueToArray(name, separator);
return val[index];
};
exports.Cookie = Cookie;

View file

@ -2,15 +2,15 @@
* Date utilities
*/
var DateHelper = {
isValid: function(dateStr, format){
export default {
isValid(dateStr, format){
if(!format) {
format = 'DMY';
}
format = format.toUpperCase();
if(format.length != 3) {
if(format==='DDMMMYYYY'){
var d = this.format(dateStr, format);
let d = this.format(dateStr, format);
dateStr = d.getDate() +'/'+ (d.getMonth()+1) +'/'+
d.getFullYear();
format = 'DMY';
@ -20,7 +20,7 @@ var DateHelper = {
(format.indexOf('Y') === -1)){
format = 'DMY';
}
var reg1, reg2;
let reg1, reg2;
// If the year is first
if(format.substring(0, 1) == 'Y') {
reg1 = /^\d{2}(\-|\/|\.)\d{1,2}\1\d{1,2}$/;
@ -38,8 +38,8 @@ var DateHelper = {
return false;
}
// Split into 3 parts based on what the divider was
var parts = dateStr.split(RegExp.$1);
var mm, dd, yy;
let parts = dateStr.split(RegExp.$1);
let mm, dd, yy;
// Check to see if the 3 parts end up making a valid date
if(format.substring(0, 1) === 'M'){
mm = parts[0];
@ -68,7 +68,7 @@ var DateHelper = {
if(parseInt(yy, 10) <= 99){
yy = (parseInt(yy, 10) + 1900).toString();
}
var dt = new Date(
let dt = new Date(
parseInt(yy, 10), parseInt(mm, 10)-1, parseInt(dd, 10),
0, 0, 0, 0);
if(parseInt(dd, 10) != dt.getDate()){
@ -79,16 +79,16 @@ var DateHelper = {
}
return true;
},
format: function(dateStr, format) {
if(!format){
format = 'DMY';
format(dateStr, formatStr) {
if(!formatStr){
formatStr = 'DMY';
}
if(!dateStr || dateStr === ''){
return new Date(1001, 0, 1);
}
var oDate;
let oDate;
switch(format.toUpperCase()){
switch(formatStr.toUpperCase()){
case 'DDMMMYYYY':
parts = dateStr.replace(/[- \/.]/g,' ').split(' ');
oDate = new Date(y2kDate(parts[2]),mmm2mm(parts[1])-1,parts[0]);
@ -131,7 +131,7 @@ function y2kDate(yr){
if(yr.length>2){
return yr;
}
var y;
let y;
//>50 belong to 1900
if(yr <= 99 && yr>50){
y = '19' + yr;
@ -147,15 +147,15 @@ function mmm2mm(mmm){
if(mmm === undefined){
return 0;
}
var mondigit;
var MONTH_NAMES = [
let mondigit;
let MONTH_NAMES = [
'january','february','march','april','may','june','july',
'august','september','october','november','december',
'jan','feb','mar','apr','may','jun','jul','aug','sep','oct',
'nov','dec'
];
for(var m_i=0; m_i < MONTH_NAMES.length; m_i++){
var month_name = MONTH_NAMES[m_i];
for(let m_i=0; m_i < MONTH_NAMES.length; m_i++){
let month_name = MONTH_NAMES[m_i];
if (mmm.toLowerCase() === month_name){
mondigit = m_i+1;
break;
@ -169,5 +169,3 @@ function mmm2mm(mmm){
}
return mondigit;
}
exports.DateHelper = DateHelper;

View file

@ -2,158 +2,157 @@
* DOM utilities
*/
var Dom = {};
export default {
/**
* Returns text + text of children of given node
* @param {NodeElement} node
* @return {String}
*/
Dom.getText = function(node){
var s = node.textContent || node.innerText ||
node.innerHTML.replace(/<[^<>]+>/g, '');
s = s.replace(/^\s+/, '').replace(/\s+$/, '');
return s;
};
/**
* Returns text + text of children of given node
* @param {NodeElement} node
* @return {String}
*/
getText(node){
let s = node.textContent || node.innerText ||
node.innerHTML.replace(/<[^<>]+>/g, '');
s = s.replace(/^\s+/, '').replace(/\s+$/, '');
return s;
},
/**
* Creates an html element with given collection of attributes
* @param {String} tag a string of the html tag to create
* @param {Array} an undetermined number of arrays containing the with 2
* items, the attribute name and its value ['id','myId']
* @return {Object} created element
*/
Dom.create = function(tag){
if(!tag || tag===''){
return;
}
/**
* Creates an html element with given collection of attributes
* @param {String} tag a string of the html tag to create
* @param {Array} an undetermined number of arrays containing the with 2
* items, the attribute name and its value ['id','myId']
* @return {Object} created element
*/
create(tag){
if(!tag || tag===''){
return;
}
var el = document.createElement(tag),
args = arguments;
let el = document.createElement(tag),
args = arguments;
if(args.length > 1){
for(var i=0; i<args.length; i++){
var argtype = typeof args[i];
if(argtype.toLowerCase() === 'object' && args[i].length === 2){
el.setAttribute(args[i][0], args[i][1]);
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){
el.setAttribute(args[i][0], args[i][1]);
}
}
}
return el;
},
/**
* Returns a text node with given text
* @param {String} text
* @return {Object}
*/
text(text){
return document.createTextNode(text);
},
/**
* Returns offset position of passed element
* @param {object} obj [description]
* @return {object} literal object with left and top values
*/
position(obj){
let l = 0, t = 0;
if (obj && obj.offsetParent){
do {
l += obj.offsetLeft;
t += obj.offsetTop;
} while (obj == obj.offsetParent);
}
return { 'left': l, 'top': t };
},
hasClass(ele, cls){
if(!ele){ return false; }
if(supportsClassList()){
return ele.classList.contains(cls);
}
return ele.className.match(new RegExp('(\\s|^)'+ cls +'(\\s|$)'));
},
addClass(ele, cls){
if(!ele){ return; }
if(supportsClassList()){
ele.classList.add(cls);
return;
}
if(ele.className === ''){
ele.className = cls;
}
else if(!this.hasClass(ele, cls)){
ele.className += " " + cls;
}
},
removeClass(ele, cls){
if(!ele){ return; }
if(supportsClassList()){
ele.classList.remove(cls);
return;
}
let reg = new RegExp('(\\s|^)'+ cls +'(\\s|$)', 'g');
ele.className = ele.className.replace(reg, '');
},
/**
* Creates and returns an option element
* @param {String} text option text
* @param {String} value option value
* @param {Boolean} isSel whether option is selected
* @return {Object} option element
*/
createOpt(text, value, isSel){
let isSelected = isSel ? true : false,
opt = isSelected ?
this.create('option', ['value',value], ['selected','true']) :
this.create('option', ['value',value]);
opt.appendChild(this.text(text));
return opt;
},
/**
* Creates and returns a checklist item
* @param {Number} chkIndex index of check item
* @param {String} chkValue check item value
* @param {String} labelText check item label text
* @return {Object} li DOM element
*/
createCheckItem(chkIndex, chkValue, labelText){
let li = this.create('li'),
label = this.create('label', ['for', chkIndex]),
check = this.create('input',
['id', chkIndex],
['name', chkIndex],
['type', 'checkbox'],
['value', chkValue]
);
label.appendChild(check);
label.appendChild(this.text(labelText));
li.appendChild(label);
li.label = label;
li.check = check;
return li;
},
id(_id){
return document.getElementById(_id);
},
tag(o, tagname){
return o.getElementsByTagName(tagname);
}
return el;
};
/**
* Returns a text node with given text
* @param {String} text
* @return {Object}
*/
Dom.text = function(text){
return document.createTextNode(text);
};
/**
* Returns offset position of passed element
* @param {object} obj [description]
* @return {object} literal object with left and top values
*/
Dom.position = function(obj){
var l = 0, t = 0;
if (obj && obj.offsetParent){
do {
l += obj.offsetLeft;
t += obj.offsetTop;
} while (obj == obj.offsetParent);
}
return { 'left': l, 'top': t };
};
Dom.hasClass = function (ele, cls){
if(!ele){ return false; }
if(supportsClassList()){
return ele.classList.contains(cls);
}
return ele.className.match(new RegExp('(\\s|^)'+ cls +'(\\s|$)'));
};
Dom.addClass = function (ele, cls){
if(!ele){ return; }
if(supportsClassList()){
ele.classList.add(cls);
return;
}
if(ele.className === ''){
ele.className = cls;
}
else if(!this.hasClass(ele, cls)){
ele.className += " " + cls;
}
};
Dom.removeClass = function (ele, cls){
if(!ele){ return; }
if(supportsClassList()){
ele.classList.remove(cls);
return;
}
var reg = new RegExp('(\\s|^)'+ cls +'(\\s|$)', 'g');
ele.className = ele.className.replace(reg, '');
};
/**
* Creates and returns an option element
* @param {String} text option text
* @param {String} value option value
* @param {Boolean} isSel whether option is selected
* @return {Object} option element
*/
Dom.createOpt = function(text, value, isSel){
var isSelected = isSel ? true : false,
opt = isSelected ?
this.create('option', ['value',value], ['selected','true']) :
this.create('option', ['value',value]);
opt.appendChild(this.text(text));
return opt;
};
/**
* Creates and returns a checklist item
* @param {Number} chkIndex index of check item
* @param {String} chkValue check item value
* @param {String} labelText check item label text
* @return {Object} li DOM element
*/
Dom.createCheckItem = function(chkIndex, chkValue, labelText){
var li = this.create('li'),
label = this.create('label', ['for', chkIndex]),
check = this.create('input',
['id', chkIndex],
['name', chkIndex],
['type', 'checkbox'],
['value', chkValue]
);
label.appendChild(check);
label.appendChild(this.text(labelText));
li.appendChild(label);
li.label = label;
li.check = check;
return li;
};
Dom.id = function(id){
return document.getElementById(id);
};
Dom.tag = function(o, tagname){
return o.getElementsByTagName(tagname);
};
// HTML5 classList API
function supportsClassList(){
return document.documentElement.classList;
}
exports.Dom = Dom;

View file

@ -2,7 +2,7 @@
* DOM event utilities
*/
export var Event = {
export default {
add(obj, type, func, capture){
if(obj.addEventListener){
obj.addEventListener(type, func, capture);

View file

@ -1,5 +1,5 @@
import {Dom} from '../../dom';
import {Arr} from '../../array';
import Dom from '../../dom';
import Arr from '../../array';
export default class AdapterEzEditTable {
/**

View file

@ -1,8 +1,8 @@
import {Dom} from '../../dom';
import {Types} from '../../types';
import {Event} from '../../event';
import {Helpers} from '../../helpers';
import {Arr} from '../../array';
import Dom from '../../dom';
import Types from '../../types';
import Event from '../../event';
import Helpers from '../../helpers';
import Arr from '../../array';
export default class ColsVisibility{

View file

@ -1,9 +1,9 @@
import {Types} from '../../types';
import {Dom} from '../../dom';
import {Arr} from '../../array';
import {Event} from '../../event';
import {DateHelper} from '../../date';
import {Helpers} from '../../helpers';
import Types from '../../types';
import Dom from '../../dom';
import Arr from '../../array';
import Event from '../../event';
import DateHelper from '../../date';
import Helpers from '../../helpers';
export default class AdapterSortableTable{

View file

@ -2,9 +2,9 @@
* Misc helpers
*/
import {Str} from './string';
import Str from './string';
var Helpers = {
export default {
isIE(){
return (/msie|MSIE/).test(navigator.userAgent);
},
@ -16,7 +16,7 @@ var Helpers = {
if(!format){
format = 'us';
}
var n = data;
let n = data;
if(Str.lower(format)==='us'){
n =+ n.replace(/[^\d\.-]/g,'');
} else {
@ -25,5 +25,3 @@ var Helpers = {
return n;
}
};
exports.Helpers = Helpers;

View file

@ -1,4 +1,4 @@
import {Dom} from '../dom';
import Dom from '../dom';
export class AlternateRows{

View file

@ -1,8 +1,8 @@
import {Dom} from '../dom';
import {Arr as array} from '../array';
import {Str} from '../string';
import {Sort} from '../sort';
import {Event} from '../event';
import Dom from '../dom';
import Arr from '../array';
import Str from '../string';
import Sort from '../sort';
import Event from '../event';
export class CheckList{
@ -96,7 +96,7 @@ export class CheckList{
var rows = tf.tbl.rows;
this.isCustom = (tf.hasCustomSlcOptions &&
array.has(tf.customSlcOptions.cols, colIndex));
Arr.has(tf.customSlcOptions.cols, colIndex));
var activeFlt;
if(tf.refreshFilters && tf.activeFilterId){
@ -113,7 +113,7 @@ export class CheckList{
for(var k=tf.refRow; k<tf.nbRows; k++){
// always visible rows don't need to appear on selects as always
// valid
if(tf.hasVisibleRows && array.has(tf.visibleRows, k) && !tf.paging){
if(tf.hasVisibleRows && Arr.has(tf.visibleRows, k) && !tf.paging){
continue;
}
@ -133,13 +133,13 @@ export class CheckList{
((rows[k].style.display === '' && !tf.paging) ||
(tf.paging && ((!activeFlt || activeFlt===colIndex )||
(activeFlt!=colIndex &&
array.has(tf.validRowsIndex, k))) )))){
Arr.has(tf.validRowsIndex, k))) )))){
var cell_data = tf.getCellData(j, cells[j]);
//Vary Peter's patch
var cell_string = Str.matchCase(
cell_data, tf.matchCase);
// checks if celldata is already in array
if(!array.has(this.opts, cell_string, tf.matchCase)){
if(!Arr.has(this.opts, cell_string, tf.matchCase)){
this.opts.push(cell_data);
}
var filteredCol = filteredDataCol[j];
@ -147,9 +147,9 @@ export class CheckList{
if(!filteredCol){
filteredDataCol[j] = tf.GetFilteredDataCol(j);
}
if(!array.has(filteredCol,
if(!Arr.has(filteredCol,
cell_string, tf.matchCase) &&
!array.has(excludedOpts,
!Arr.has(excludedOpts,
cell_string, tf.matchCase) &&
!tf.isFirstLoad){
excludedOpts.push(cell_data);
@ -180,7 +180,7 @@ export class CheckList{
}
}
//asc sort
if(tf.sortNumAsc && array.has(tf.sortNumAsc, colIndex)){
if(tf.sortNumAsc && Arr.has(tf.sortNumAsc, colIndex)){
try{
this.opts.sort(numSortAsc);
if(excludedOpts){
@ -200,7 +200,7 @@ export class CheckList{
}//in case there are alphanumeric values
}
//desc sort
if(tf.sortNumDesc && array.has(tf.sortNumDesc, colIndex)){
if(tf.sortNumDesc && Arr.has(tf.sortNumDesc, colIndex)){
try{
this.opts.sort(numSortDesc);
if(excludedOpts){
@ -242,7 +242,7 @@ export class CheckList{
store.getFilterValues(tf.fltsValuesCookie)[colIndex] : null;
if(tmpVal && Str.trim(tmpVal).length > 0){
if(tf.hasCustomSlcOptions &&
array.has(tf.customSlcOptions.cols, colIndex)){
Arr.has(tf.customSlcOptions.cols, colIndex)){
fltArr.push(tmpVal);
} else {
fltArr = tmpVal.split(' '+tf.orOperator+' ');
@ -256,7 +256,7 @@ export class CheckList{
tf.fltIds[colIndex]+'_'+(y+chkCt), val, lbl);
li.className = this.checkListItemCssClass;
if(tf.refreshFilters && tf.disableExcludedOptions &&
array.has(excludedOpts,
Arr.has(excludedOpts,
Str.matchCase(val, tf.matchCase), tf.matchCase)){
Dom.addClass(li, this.checkListItemDisabledCssClass);
li.check.disabled = true;
@ -276,9 +276,9 @@ export class CheckList{
/*** remember grid values ***/
if(tf.rememberGridValues){
if((tf.hasCustomSlcOptions &&
array.has(tf.customSlcOptions.cols, colIndex) &&
Arr.has(tf.customSlcOptions.cols, colIndex) &&
fltArr.toString().indexOf(val)!= -1) ||
array.has(fltArr,
Arr.has(fltArr,
Str.matchCase(val, tf.matchCase), tf.matchCase)){
li.check.checked = true;
this.setCheckListValues(li.check);

View file

@ -1,5 +1,5 @@
import {Dom} from '../dom';
import {Event} from '../event';
import Dom from '../dom';
import Event from '../event';
export class ClearButton{

View file

@ -1,6 +1,6 @@
import {Dom} from '../dom';
import {Str} from '../string';
import {Types} from '../types';
import Dom from '../dom';
import Str from '../string';
import Types from '../types';
export class ColOps{

View file

@ -1,7 +1,7 @@
import {Dom} from '../dom';
import {Arr as array} from '../array';
import {Str} from '../string';
import {Sort} from '../sort';
import Dom from '../dom';
import Arr from '../array';
import Str from '../string';
import Sort from '../sort';
export class Dropdown{
@ -79,7 +79,7 @@ export class Dropdown{
//custom select test
this.isCustom = (tf.hasCustomSlcOptions &&
array.has(tf.customSlcOptions.cols, colIndex));
Arr.has(tf.customSlcOptions.cols, colIndex));
//custom selects text
var activeFlt;
@ -111,7 +111,7 @@ export class Dropdown{
for(var k=tf.refRow; k<tf.nbRows; k++){
// always visible rows don't need to appear on selects as always
// valid
if(tf.hasVisibleRows && array.has(tf.visibleRows, k) &&
if(tf.hasVisibleRows && Arr.has(tf.visibleRows, k) &&
!tf.paging){
continue;
}
@ -133,16 +133,16 @@ export class Dropdown{
((rows[k].style.display === '' && !tf.paging) ||
(tf.paging && (!tf.validRowsIndex ||
(tf.validRowsIndex &&
array.has(tf.validRowsIndex, k))) &&
Arr.has(tf.validRowsIndex, k))) &&
((activeFlt===undefined || activeFlt==colIndex) ||
(activeFlt!=colIndex &&
array.has(tf.validRowsIndex, k) ))) ))){
Arr.has(tf.validRowsIndex, k) ))) ))){
var cell_data = tf.getCellData(j, cell[j]),
//Vary Peter's patch
cell_string = Str.matchCase(cell_data, matchCase);
// checks if celldata is already in array
if(!array.has(this.opts, cell_string, matchCase)){
if(!Arr.has(this.opts, cell_string, matchCase)){
this.opts.push(cell_data);
}
@ -151,8 +151,8 @@ export class Dropdown{
if(!filteredCol){
filteredCol = this.GetFilteredDataCol(j);
}
if(!array.has(filteredCol, cell_string, matchCase) &&
!array.has(
if(!Arr.has(filteredCol, cell_string, matchCase) &&
!Arr.has(
excludedOpts, cell_string, matchCase) &&
!this.isFirstLoad){
excludedOpts.push(cell_data);
@ -182,7 +182,7 @@ export class Dropdown{
}
//asc sort
if(tf.sortNumAsc && array.has(tf.sortNumAsc, colIndex)){
if(tf.sortNumAsc && Arr.has(tf.sortNumAsc, colIndex)){
try{
this.opts.sort( numSortAsc );
if(excludedOpts){
@ -202,7 +202,7 @@ export class Dropdown{
}//in case there are alphanumeric values
}
//desc sort
if(tf.sortNumDesc && array.has(tf.sortNumDesc, colIndex)){
if(tf.sortNumDesc && Arr.has(tf.sortNumDesc, colIndex)){
try{
this.opts.sort(numSortDesc);
if(excludedOpts){
@ -252,7 +252,7 @@ export class Dropdown{
var lbl = this.isCustom ? this.optsTxt[y] : val; //option text
var isDisabled = false;
if(isRefreshed && this.disableExcludedOptions &&
array.has(
Arr.has(
excludedOpts,
Str.matchCase(val, tf.matchCase),
tf.matchCase
@ -286,7 +286,7 @@ export class Dropdown{
opt = Dom.createOpt(
lbl,
val,
(array.has(fltArr,
(Arr.has(fltArr,
Str.matchCase(this.opts[y], tf.matchCase),
tf.matchCase) ||
fltArr.toString().indexOf(val)!== -1) ?

View file

@ -1,6 +1,6 @@
import {Dom} from '../dom';
import {Types} from '../types';
import {Event} from '../event';
import Dom from '../dom';
import Types from '../types';
import Event from '../event';
export class GridLayout{

View file

@ -1,5 +1,5 @@
import {Dom} from '../dom';
import {Event} from '../event';
import Dom from '../dom';
import Event from '../event';
export class Help{

View file

@ -1,5 +1,5 @@
import {Dom} from '../dom';
import {Str} from '../string';
import Dom from '../dom';
import Str from '../string';
export class HighlightKeyword{

View file

@ -1,6 +1,5 @@
import {Dom} from '../dom';
import {Types} from '../types';
import Dom from '../dom';
import Types from '../types';
var global = window;

View file

@ -1,7 +1,7 @@
import {Dom} from '../dom';
import {Types} from '../types';
import {Str} from '../string';
import {Event} from '../event';
import Dom from '../dom';
import Types from '../types';
import Str from '../string';
import Event from '../event';
export class Paging{

View file

@ -1,7 +1,7 @@
import {Types} from '../types';
import {Dom} from '../dom';
import {Event} from '../event';
import {Helpers} from '../helpers';
import Types from '../types';
import Dom from '../dom';
import Event from '../event';
import Helpers from '../helpers';
export class PopupFilter{

View file

@ -1,6 +1,6 @@
import {Dom} from '../dom';
import {Types} from '../types';
import {Helpers} from '../helpers';
import Dom from '../dom';
import Types from '../types';
import Helpers from '../helpers';
export class RowsCounter{

View file

@ -1,6 +1,6 @@
import {Dom} from '../dom';
import {Types} from '../types';
import {Helpers} from '../helpers';
import Dom from '../dom';
import Types from '../types';
import Helpers from '../helpers';
var global = window;

View file

@ -1,4 +1,4 @@
import {Cookie} from '../cookie';
import Cookie from '../cookie';
export class Store{

View file

@ -1,15 +1,9 @@
/**
* Sort helpers
*/
import Str from './string';
import {Str} from './string';
var Sort = {
export default {
ignoreCase(a, b){
var x = Str.lower(a);
var y = Str.lower(b);
let x = Str.lower(a);
let y = Str.lower(b);
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}
};
exports.Sort = Sort;

View file

@ -2,45 +2,45 @@
* String utilities
*/
var Str = {};
export default {
Str.lower = function(text){
return text.toLowerCase();
};
lower(text){
return text.toLowerCase();
},
Str.upper = function(text){
return text.toUpperCase();
};
upper(text){
return text.toUpperCase();
},
Str.trim = function(text){
if (text.trim){
return text.trim();
}
return text.replace(/^\s*|\s*$/g, '');
};
trim(text){
if (text.trim){
return text.trim();
}
return text.replace(/^\s*|\s*$/g, '');
},
Str.isEmpty = function(text){
return this.trim(text) === '';
};
isEmpty(text){
return this.trim(text) === '';
},
Str.rgxEsc = function(text){
function escape(e){
var a = new RegExp('\\'+e, 'g');
text = text.replace(a, '\\'+e);
rgxEsc(text){
function escape(e){
let a = new RegExp('\\'+e, 'g');
text = text.replace(a, '\\'+e);
}
let chars = ['\\','[','^','$','.','|','?','*','+','(',')'];
for(let e=0, len=chars.length; e<len; e++){
escape(chars[e]);
}
return text;
},
matchCase(text, mc){
if(!mc){
return this.lower(text);
}
return text;
}
var chars = ['\\','[','^','$','.','|','?','*','+','(',')'];
for(var e=0; e<chars.length; e++){
escape(chars[e]);
}
return text;
};
Str.matchCase = function(text, mc){
if(!mc){
return this.lower(text);
}
return text;
};
exports.Str = Str;

File diff suppressed because it is too large Load diff

View file

@ -2,54 +2,53 @@
* Types utilities
*/
var Types = {};
const UNDEFINED = void 0;
var UNDEFINED = void 0;
export default {
/**
* Checks if var exists and is an object
* @param {String or Object} v
* @return {Boolean}
*/
isObj(v){
let isO = false;
if(typeof v === 'string'){
if(window[v] && typeof window[v] === 'object'){
isO = true;
}
} else {
if(v && typeof v === 'object'){
isO = true;
}
}
return isO;
},
/**
* Checks if var exists and is an object
* @param {String or Object} v
* @return {Boolean}
*/
Types.isObj = function(v){
var isO = false;
if(typeof v === 'string'){
if(window[v] && typeof window[v] === 'object'){
isO = true;
}
} else {
if(v && typeof v === 'object'){
isO = true;
}
/**
* Checks if passed parameter is a function
* @param {Function} fn
* @return {Boolean}
*/
isFn(fn){
return (fn && fn.constructor == Function);
},
/**
* Checks if passed param is an array
* @param {Array} obj
* @return {Boolean}
*/
isArray(obj){
return (obj && obj.constructor == Array);
},
/**
* Determines if passed param is undefined
* @param {Any} o
* @return {Boolean}
*/
isUndef(o){
return o === UNDEFINED;
}
return isO;
};
/**
* Checks if passed parameter is a function
* @param {Function} fn
* @return {Boolean}
*/
Types.isFn = function(fn){
return (fn && fn.constructor == Function);
};
/**
* Checks if passed param is an array
* @param {Array} obj
* @return {Boolean}
*/
Types.isArray = function(obj){
return (obj && obj.constructor == Array);
};
/**
* Determines if passed param is undefined
* @param {Any} o
* @return {Boolean}
*/
Types.isUndef = function(o){
return o === UNDEFINED;
};
exports.Types = Types;

View file

@ -1,6 +1,5 @@
(function(win, TableFilter){
var id = function (id){ return document.getElementById(id); };
var tf = new TableFilter('demo', {
base_path: '../dist/tablefilter/',