diff --git a/src-es6/array.js b/src-es6/array.js index d28b78f3..9fb7ae0e 100644 --- a/src-es6/array.js +++ b/src-es6/array.js @@ -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; i2){ 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; diff --git a/src-es6/dom.js b/src-es6/dom.js index f131c23d..7341e361 100644 --- a/src-es6/dom.js +++ b/src-es6/dom.js @@ -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 1){ + for(let i=0; i 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); diff --git a/src-es6/modules/clearButton.js b/src-es6/modules/clearButton.js index f8539ab2..e4cf473a 100644 --- a/src-es6/modules/clearButton.js +++ b/src-es6/modules/clearButton.js @@ -1,5 +1,5 @@ -import {Dom} from '../dom'; -import {Event} from '../event'; +import Dom from '../dom'; +import Event from '../event'; export class ClearButton{ diff --git a/src-es6/modules/colOps.js b/src-es6/modules/colOps.js index 6e2ff4f5..0362cae6 100644 --- a/src-es6/modules/colOps.js +++ b/src-es6/modules/colOps.js @@ -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{ diff --git a/src-es6/modules/dropdown.js b/src-es6/modules/dropdown.js index 55755568..a90a10c5 100644 --- a/src-es6/modules/dropdown.js +++ b/src-es6/modules/dropdown.js @@ -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 y) ? 1 : 0)); } }; - -exports.Sort = Sort; \ No newline at end of file diff --git a/src-es6/string.js b/src-es6/string.js index 88987ef2..96a4fac1 100644 --- a/src-es6/string.js +++ b/src-es6/string.js @@ -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 1){ - for(var i=0; i 0){ fltrow = thead[0].insertRow(this.filtersRowIndex); } else { @@ -843,13 +843,13 @@ export class TableFilter{ this.nbVisibleRows = this.nbFilterableRows; this.nbRows = this.tbl.rows.length; - for(var i=0; i { - var inst = new mod(this, ext); + let inst = new mod(this, ext); inst.init(); this.ExtRegistry[name] = inst; }); @@ -1234,11 +1234,11 @@ export class TableFilter{ * Destroy all the extensions defined in the configuration object */ destroyExtensions(){ - var exts = this.extensions; + let exts = this.extensions; - for(var i=0, len=exts.length; i1) ? true : false, //multiple search parameter operator && @@ -1979,11 +1979,11 @@ export class TableFilter{ //multiple sarch parameters if(hasMultiOrSA || hasMultiAndSA){ - var cS, + let cS, occur = false, s = hasMultiOrSA ? sAOrSplit : sAAndSplit; - for(var w=0; w nrows if(row <= this.nbRows){ this.validateRow(row, true); @@ -2584,15 +2584,15 @@ export class TableFilter{ if(this.onBeforeReset){ this.onBeforeReset.call(null, this, this.getFiltersValue()); } - for(var i=0; i