1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-05 08:03:17 +02:00

Initial commit

This commit is contained in:
Max Guglielmi 2016-02-16 18:41:47 +11:00
parent 1910d93b9f
commit 4e8d4ec9da
14 changed files with 78 additions and 51 deletions

42
.eslintrc Normal file
View file

@ -0,0 +1,42 @@
{
"parser": "babel-eslint",
"rules": {
"max-len": [2, 80, 2, {"ignoreUrls": true}],
"max-depth": [2, 7],
"no-underscore-dangle": 0,
"no-loop-func": 2,
"curly": 2,
"quotes": [2, "single"],
//"indent": [2, 4],
"no-trailing-spaces": 2,
"no-multi-spaces": 2,
"array-bracket-spacing": 2,
"new-cap": 2
//"camelcase": [2, {"properties": "always"}]
/*"-W024": true,
"scripturl": true,
"evil": true,
"curly": true,
"indent": 4,
"es3": true,
"esnext": true,
"unused": true,
"maxlen" : 80,
"trailing": true,
"quotmark": "single",
"immed": true,
"maxstatements": 172,
"maxdepth": 7,
"maxcomplexity": 87,*/
},
"ecmaFeatures": {
"modules": true
},
"env": {
"es6": true,
"browser": true,
"node": false
}
}

View file

@ -1,17 +0,0 @@
{
"-W024": true,
"scripturl": true,
"evil": true,
"curly": true,
"indent": 4,
"es3": true,
"esnext": true,
"unused": true,
"maxlen" : 80,
"trailing": true,
"quotmark": "single",
"immed": true,
"maxstatements": 172,
"maxdepth": 7,
"maxcomplexity": 87
}

View file

@ -11,15 +11,15 @@ module.exports = function (grunt) {
grunt.initConfig({
jshint: {
src: [
eslint: {
options: {
configFile: '.eslintrc'
},
target: [
'Gruntfile.js',
'webpack.config.js',
'src/**/*.js'
],
options: {
jshintrc: '.jshintrc'
}
]
},
qunit: {
@ -282,7 +282,7 @@ module.exports = function (grunt) {
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
@ -302,11 +302,11 @@ module.exports = function (grunt) {
// Dev dev/build/watch cycle
grunt.registerTask('dev',
['jshint', 'webpack:dev', 'copy:dist', 'stylus:compile', 'watch:app']);
['eslint', 'webpack:dev', 'copy:dist', 'stylus:compile', 'watch:app']);
// Production build
grunt.registerTask('build',
['jshint', 'webpack:build', 'copy:dist', 'stylus:compile']);
['eslint', 'webpack:build', 'copy:dist', 'stylus:compile']);
// Build demos
grunt.registerTask('dev-demos', ['build-demos', 'watch:templates']);
@ -317,7 +317,7 @@ module.exports = function (grunt) {
grunt.registerTask('dev-modules', ['babel', 'copy:dist']);
// Tests
grunt.registerTask('test', ['jshint', 'connect', 'qunit:all']);
grunt.registerTask('test', ['eslint', 'connect', 'qunit:all']);
// Publish to gh-pages
grunt.registerTask('publish', 'Publish from CLI', [
@ -428,7 +428,7 @@ module.exports = function (grunt) {
ret += 'branch: ' + env.TRAVIS_BRANCH + '\n';
ret += 'SHA: ' + env.TRAVIS_COMMIT + '\n';
ret += 'range SHA: ' + env.TRAVIS_COMMIT_RANGE + '\n';
ret += 'build id: ' + env.TRAVIS_BUILD_ID + '\n';
ret += 'build id: ' + env.TRAVIS_BUILD_ID + '\n';
ret += 'build number: ' + env.TRAVIS_BUILD_NUMBER + '\n';
return ret;
}

View file

@ -1,6 +1,6 @@
{
"name": "tablefilter",
"version": "0.1.14",
"version": "0.1.15",
"description": "A Javascript library making HTML tables filterable and a bit more",
"license": "MIT",
"author": {
@ -29,19 +29,21 @@
},
"devDependencies": {
"babel-core": "^6.1.2",
"babel-eslint": "4.1.8",
"babel-loader": "^6.0.1",
"babel-preset-es2015": "^6.3.13",
"clean-webpack-plugin": "^0.1.3",
"eslint": "2.1.0",
"grunt": "^0.4.5",
"grunt-babel": "^6.0.0",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-connect": "^0.10.1",
"grunt-contrib-copy": "^0.8.0",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-qunit": "^0.7.0",
"grunt-contrib-stylus": "^0.22.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-esdoc": "^0.0.1",
"grunt-eslint": "18.0.0",
"grunt-gh-pages": "^0.10.0",
"grunt-string-replace": "^1.2.0",
"grunt-webpack": "^1.0.8",

View file

@ -95,30 +95,30 @@ export default {
oDate = new Date(y2kDate(parts[2]),mmm2mm(parts[1])-1,parts[0]);
break;
case 'DMY':
/* jshint ignore:start */
/* eslint-disable */
parts = dateStr.replace(
/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,'$1 $3 $5').split(' ');
oDate = new Date(y2kDate(parts[2]),parts[1]-1,parts[0]);
/* jshint ignore:end */
/* eslint-enable */
break;
case 'MDY':
/* jshint ignore:start */
/* eslint-disable */
parts = dateStr.replace(
/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/,'$1 $3 $5').split(' ');
oDate = new Date(y2kDate(parts[2]),parts[0]-1,parts[1]);
/* jshint ignore:end */
/* eslint-enable */
break;
case 'YMD':
/* jshint ignore:start */
/* eslint-disable */
parts = dateStr.replace(/^((\d\d)?\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/,'$1 $4 $6').split(' ');
oDate = new Date(y2kDate(parts[0]),parts[1]-1,parts[2]);
/* jshint ignore:end */
/* eslint-enable */
break;
default: //in case format is not correct
/* jshint ignore:start */
/* eslint-disable */
parts = dateStr.replace(/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/,'$1 $3 $5').split(' ');
oDate = new Date(y2kDate(parts[2]),parts[1]-1,parts[0]);
/* jshint ignore:end */
/* eslint-enable */
break;
}
return oDate;

View file

@ -20,7 +20,7 @@ export default class AdapterEzEditTable {
this.err = 'Failed to instantiate EditTable object.\n"ezEditTable" ' +
'dependency not found.';
// Enable the ezEditTable's scroll into view behaviour if grid layout on
cfg.scroll_into_view = cfg.scroll_into_view===false ?
cfg.scroll_into_view = cfg.scroll_into_view===false ?
false : tf.gridLayout;
this._ezEditTable = null;
@ -72,7 +72,7 @@ export default class AdapterEzEditTable {
startRow = cfg.startRow || tf.refRow;
}
cfg.base_path = cfg.base_path || tf.basePath + 'ezEditTable/';
cfg.base_path = cfg.base_path || tf.basePath + 'ezEditTable/';
var editable = cfg.editable;
var selectable = cfg.selection;

View file

@ -55,7 +55,7 @@ export default class ColsVisibility{
//span containing show/hide cols button
this.prfx = 'colVis_';
//defines css class span containing show/hide cols
this.spanCssClass = f.span_css_class || 'colVisSpan';
this.spanCssClass = f.span_css_class || 'colVisSpan';
this.prfxCont = this.prfx + 'Cont_';
//defines css class div containing show/hide cols
this.contCssClass = f.cont_css_class || 'colVisCont';

View file

@ -32,7 +32,7 @@ export default class FiltersVisibility{
this.defaultText = 'Toggle filters';
//id of container element
this.targetId = f.target_id || null;
this.targetId = f.target_id || null;
//enables/disables expand/collapse icon
this.enableIcon = f.enable_icon===false ? false : true;
this.btnText = f.btn_text || '';
@ -41,7 +41,7 @@ export default class FiltersVisibility{
this.collapseBtnHtml = this.enableIcon ?
this.icnCollapseHtml + this.btnText :
this.btnText || this.defaultText;
this.expandBtnHtml = this.enableIcon ?
this.expandBtnHtml = this.enableIcon ?
this.icnExpandHtml + this.btnText :
this.btnText || this.defaultText;

View file

@ -25,7 +25,7 @@ export class Dropdown extends Feature{
//defines empty option text
this.nonEmptyText = f.non_empty_text || '(Non empty)';
//IE only, tooltip text appearing on select before it is populated
this.activateSlcTooltip = f.activate_slc_tooltip ||
this.activateSlcTooltip = f.activate_slc_tooltip ||
'Click to activate';
//tooltip text appearing on multiple select
this.multipleSlcTooltip = f.multiple_slc_tooltip ||
@ -183,7 +183,7 @@ export class Dropdown extends Feature{
(tf.paging && (!tf.validRowsIndex ||
(tf.validRowsIndex &&
tf.validRowsIndex.indexOf(k) != -1)) &&
((activeFlt===undefined || activeFlt==colIndex) ||
((activeFlt===undefined || activeFlt==colIndex) ||
(activeFlt!=colIndex &&
tf.validRowsIndex.indexOf(k) != -1 ))) ))){
let cell_data = tf.getCellData(cell[j]),

View file

@ -24,7 +24,7 @@ export class Help extends Feature{
this.contTgtId = f.help_instructions_container_target_id ||
null;
//defines help text
this.instrText = f.help_instructions_text ?
this.instrText = f.help_instructions_text ?
f.help_instructions_text :
'Use the filters above each column to filter and limit table ' +
'data. Advanced searches can be performed by using the following ' +

View file

@ -69,7 +69,7 @@ export class PopupFilter extends Feature{
var popUpDiv = this.popUpFltElms[colIndex],
header = this.tf.getHeaderElement(colIndex),
headerWidth = header.clientWidth * 0.95;
popUpDiv.style.width = parseInt(headerWidth, 10) + 'px';
popUpDiv.style.width = parseInt(headerWidth, 10) + 'px';
}
Event.cancel(evt);
Event.stop(evt);

View file

@ -29,7 +29,7 @@ export class StatusBar extends Feature{
//defines css class status bar
this.statusBarCssClass = f.status_bar_css_class || 'status';
//delay for status bar clearing
this.statusBarCloseDelay = 250;
this.statusBarCloseDelay = 250;
//calls function before message is displayed
this.onBeforeShowMsg = Types.isFn(f.on_before_show_msg) ?

View file

@ -133,7 +133,7 @@ export class TableFilter {
//defines css class for left div
this.lDivCssClass = f.left_div_css_class || 'ldiv';
//defines css class for right div
this.rDivCssClass = f.right_div_css_class || 'rdiv';
this.rDivCssClass = f.right_div_css_class || 'rdiv';
//defines css class for mid div
this.mDivCssClass = f.middle_div_css_class || 'mdiv';
//table container div css class
@ -1784,7 +1784,7 @@ export class TableFilter {
if(Types.isUndef(colIndex)){
return [];
}
let data = this.getFilteredData(),
let data = this.getFilteredData(),
colData = [];
if(includeHeaders){
colData.push(this.getHeadersText()[colIndex]);

View file

@ -48,7 +48,7 @@ export default {
* @return {Boolean}
*/
isUndef(o){
return o === UNDEFINED;
return o === UNDEFINED;
},
/**