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

Fixed column widths test

This commit is contained in:
Max Guglielmi 2015-06-06 22:22:13 +10:00
parent 8768f653ac
commit 8f835ab1fe
59 changed files with 9644 additions and 197 deletions

View file

@ -2,6 +2,7 @@ module.exports = function (grunt) {
var webpack = require('webpack');
var webpackConfig = require('./webpack.config.js');
var Clean = require('clean-webpack-plugin');
var fs = require('fs');
var path = require('path');
// var pkg = grunt.file.readJSON('package.json');
@ -38,16 +39,10 @@ module.exports = function (grunt) {
},
copy: {
build: {
src: ['**'],
cwd: 'static/style',
dest: 'build/tablefilter',
expand: true
},
dist: {
src: ['**'],
cwd: 'static/style',
dest: 'dist/tablefilter',
dest: 'dist/tablefilter/style',
expand: true
}
},
@ -55,7 +50,7 @@ module.exports = function (grunt) {
'webpack-dev-server': {
options: {
webpack: webpack.dev,
publicPath: '/build/'
publicPath: '/dist/'
},
start: {
keepAlive: true,
@ -67,44 +62,31 @@ module.exports = function (grunt) {
},
webpack: {
dist: webpackConfig.dist,
build: webpackConfig.build
// 'dev': {
// entry: __dirname + '/src/tablefilter.js',
// // entry: {
// // tablefilter: __dirname + '/src/tablefilter.js',
// // colsVisibility: __dirname +
// // '/src/extensions/colsVisibility/colsVisibility.js'
// // },
// output: {
// publicPath: '/src/',
// path: __dirname + '/src',
// filename: 'tablefilter.js',
// chunkFilename: '[name].js',
// libraryTarget: 'umd'
// },
// resolve: {
// extensions: ['', '.js']
// },
// module: {
// loaders: [{
// test: path.join(__dirname, 'src'),
// exclude: /node_modules/,
// query: {
// compact: false
// },
// loader: 'babel-loader'
// }]
// },
// devtool: 'sourcemap',
// debug: true
// },
options: webpackConfig,
build: {
plugins: [
new Clean(['dist']),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.MinChunkSizePlugin(
{minChunkSize: 10000}),
new webpack.optimize.UglifyJsPlugin()
]
},
// build: webpackConfig.build,
'build-dev': {
devtool: 'sourcemap',
debug: true,
plugins: [
new Clean(['dist']),
new webpack.optimize.DedupePlugin()
]
}
},
watch: {
app: {
files: ["src/**/*"],
tasks: ["dev"],
files: ['src/**/*'],
tasks: ['dev'],
options: {
spawn: false
}
@ -122,7 +104,7 @@ module.exports = function (grunt) {
expand: true,
cwd: 'src',
src: ['**/*.js'],
dest: 'build/tablefilter'
dest: 'dist/tablefilter'
}]
}
}
@ -136,23 +118,22 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-webpack');
grunt.loadNpmTasks('grunt-babel');
grunt.registerTask('default',
['jshint', 'webpack:dist', 'copy:dist', 'test']);
['jshint', 'webpack:build', 'copy:dist', 'test']);
// The development server (the recommended option for development)
grunt.registerTask('server', ['webpack-dev-server:start']);
grunt.registerTask('dev',
['jshint', 'webpack:build', 'copy:build', 'watch:app']);
['jshint', 'webpack:build-dev', 'copy:dist', 'watch:app']);
// Production build
grunt.registerTask('dist',
['jshint', 'webpack:dist', 'copy:dist']);
grunt.registerTask('build',
['jshint', 'webpack:build', 'copy:dist']);
// Transpile with Babel
grunt.registerTask('dev-modules', ['babel', 'copy:build']);
grunt.registerTask('dev-modules', ['babel', 'copy:dist']);
// Tests
grunt.registerTask('test', ['qunit:all']);

File diff suppressed because one or more lines are too long

1891
dist/tablefilter/1-eda749d2ef2fcdb2e245.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -1,22 +0,0 @@
/*====================================================
- HTML Table Filter Generator
- Filters Row Visibility Manager Extension v1.1
- do not hesitate to edit classes below to
change extension appearance
=====================================================*/
/* container */
span.expClpFlt{ }
/* icon */
span.expClpFlt img{
vertical-align:middle;
border:1px solid #ccc;
padding:1px 1px 1px 1px;
margin:1px 1px 1px 1px;
background:#f4f4f4;
}
span.expClpFlt img:hover{ background:#fff; border:1px solid #666; }
/* button */
.btnExpClpFlt{ margin:0 5px 0 5px; }

View file

@ -0,0 +1,26 @@
/*====================================================
- HTML Table Filter Generator
- Filters Row Visibility Manager Extension v1.1
- do not hesitate to edit classes below to
change extension appearance
=====================================================*/
/* container */
span.expClpFlt{ }
/* icon */
span.expClpFlt img{
vertical-align:middle;
border:0;
/*border:1px solid #ccc;*/
padding:1px 1px 1px 1px;
margin:1px 1px 1px 1px;
/*background:#f4f4f4;*/
}
span.expClpFlt img:hover{
background:#fff;
/*border:1px solid #666; */
}
/* button */
.btnExpClpFlt{ margin:0 5px 0 5px; }

View file

Before

Width:  |  Height:  |  Size: 441 B

After

Width:  |  Height:  |  Size: 441 B

View file

Before

Width:  |  Height:  |  Size: 469 B

After

Width:  |  Height:  |  Size: 469 B

View file

Before

Width:  |  Height:  |  Size: 144 B

After

Width:  |  Height:  |  Size: 144 B

View file

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 360 B

View file

Before

Width:  |  Height:  |  Size: 325 B

After

Width:  |  Height:  |  Size: 325 B

View file

Before

Width:  |  Height:  |  Size: 63 B

After

Width:  |  Height:  |  Size: 63 B

View file

Before

Width:  |  Height:  |  Size: 61 B

After

Width:  |  Height:  |  Size: 61 B

View file

Before

Width:  |  Height:  |  Size: 59 B

After

Width:  |  Height:  |  Size: 59 B

View file

Before

Width:  |  Height:  |  Size: 58 B

After

Width:  |  Height:  |  Size: 58 B

View file

Before

Width:  |  Height:  |  Size: 303 B

After

Width:  |  Height:  |  Size: 303 B

View file

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 326 B

View file

Before

Width:  |  Height:  |  Size: 356 B

After

Width:  |  Height:  |  Size: 356 B

View file

Before

Width:  |  Height:  |  Size: 332 B

After

Width:  |  Height:  |  Size: 332 B

View file

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 331 B

View file

Before

Width:  |  Height:  |  Size: 187 B

After

Width:  |  Height:  |  Size: 187 B

View file

Before

Width:  |  Height:  |  Size: 440 B

After

Width:  |  Height:  |  Size: 440 B

View file

Before

Width:  |  Height:  |  Size: 640 B

After

Width:  |  Height:  |  Size: 640 B

View file

Before

Width:  |  Height:  |  Size: 427 B

After

Width:  |  Height:  |  Size: 427 B

View file

Before

Width:  |  Height:  |  Size: 393 B

After

Width:  |  Height:  |  Size: 393 B

View file

Before

Width:  |  Height:  |  Size: 395 B

After

Width:  |  Height:  |  Size: 395 B

View file

Before

Width:  |  Height:  |  Size: 290 B

After

Width:  |  Height:  |  Size: 290 B

View file

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 201 B

View file

Before

Width:  |  Height:  |  Size: 68 B

After

Width:  |  Height:  |  Size: 68 B

View file

Before

Width:  |  Height:  |  Size: 78 B

After

Width:  |  Height:  |  Size: 78 B

View file

Before

Width:  |  Height:  |  Size: 300 B

After

Width:  |  Height:  |  Size: 300 B

View file

Before

Width:  |  Height:  |  Size: 303 B

After

Width:  |  Height:  |  Size: 303 B

View file

Before

Width:  |  Height:  |  Size: 928 B

After

Width:  |  Height:  |  Size: 928 B

View file

Before

Width:  |  Height:  |  Size: 63 B

After

Width:  |  Height:  |  Size: 63 B

View file

Before

Width:  |  Height:  |  Size: 61 B

After

Width:  |  Height:  |  Size: 61 B

View file

Before

Width:  |  Height:  |  Size: 59 B

After

Width:  |  Height:  |  Size: 59 B

View file

Before

Width:  |  Height:  |  Size: 58 B

After

Width:  |  Height:  |  Size: 58 B

View file

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View file

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 554 B

View file

Before

Width:  |  Height:  |  Size: 118 B

After

Width:  |  Height:  |  Size: 118 B

View file

Before

Width:  |  Height:  |  Size: 118 B

After

Width:  |  Height:  |  Size: 118 B

View file

Before

Width:  |  Height:  |  Size: 97 B

After

Width:  |  Height:  |  Size: 97 B

View file

Before

Width:  |  Height:  |  Size: 97 B

After

Width:  |  Height:  |  Size: 97 B

View file

Before

Width:  |  Height:  |  Size: 601 B

After

Width:  |  Height:  |  Size: 601 B

View file

Before

Width:  |  Height:  |  Size: 847 B

After

Width:  |  Height:  |  Size: 847 B

View file

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 201 B

File diff suppressed because one or more lines are too long

View file

@ -2,7 +2,7 @@
<html lang="en">
<head>
<title>HTML Table Filter Generator</title>
<link rel="stylesheet" type="text/css" href="../build/tablefilter/tablefilter.css">
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
</head>
<body>
<div id="test"></div>
@ -86,7 +86,7 @@
<button onclick="tf.init();">Reset</button>
</div>
<script type="text/javascript" src="../build/tablefilter/tablefilter.js"></script>
<script type="text/javascript" src="../dist/tablefilter/tablefilter.js"></script>
<script>
var table = document.getElementById('demo');
var totRowIndex = table.getElementsByTagName("tr").length;
@ -95,7 +95,7 @@
col_0: 'select',
col_2: 'checklist',
col_3: 'select',
base_path: '../build/tablefilter/',
base_path: '../dist/tablefilter/',
// fill_slc_on_demand: true,
rows_counter: true,
// enable_default_theme: true,

View file

@ -120,10 +120,7 @@ export default class ColsVisibility{
}
//Loads extension stylesheet
// tf.import(
// f.name+'Style', this.path +'/'+ this.stylesheet, null, 'link');
tf.import(
f.name+'Style', tf.basePath + this.stylesheet, null, 'link');
tf.import(f.name+'Style', tf.stylePath + this.stylesheet, null, 'link');
this.tf = tf;
}

View file

@ -16,7 +16,7 @@ export default class FiltersVisibility{
this.desc = f.description || 'Filters row visibility manager';
// Path and image filenames
this.path = f.path || tf.basePath;
this.path = f.path || tf.stylePath;
this.stylesheet = f.stylesheet || 'filtersVisibility.css';
this.icnExpand = f.expand_icon_name || 'icn_exp.png';
this.icnCollapse = f.collapse_icon_name || 'icn_clp.png';
@ -74,12 +74,14 @@ export default class FiltersVisibility{
this.onAfterHide = Types.isFn(f.on_after_hide) ? f.on_after_hide : null;
//Loads extension stylesheet
tf.import(
f.name+'Style', tf.basePath + this.stylesheet, null, 'link');
tf.import(f.name+'Style', tf.stylePath + this.stylesheet, null, 'link');
this.tf = tf;
}
/**
* Initialise extension
*/
init(){
if(this.initialized){
return;
@ -89,6 +91,9 @@ export default class FiltersVisibility{
this.initialized = true;
}
/**
* Build UI elements
*/
buildUI(){
let tf = this.tf;
let span = Dom.create('span',['id', this.prfx+tf.id]);
@ -129,6 +134,9 @@ export default class FiltersVisibility{
}
}
/**
* Toggle filters visibility
*/
toggle(){
let tf = this.tf;
let tbl = tf.gridLayout? tf.Cpt.gridLayout.headTbl : tf.tbl;
@ -156,6 +164,9 @@ export default class FiltersVisibility{
}
}
/**
* Destroy the UI
*/
destroy(){
if(!this.btnEl && !this.contEl){
return;

View file

@ -99,7 +99,8 @@ export class TableFilter{
//default script base path
this.basePath = f.base_path || 'tablefilter/';
this.extensionsPath = f.extensions_path || this.basePath+'extensions/';
//this.extensionsPath = f.extensions_path ||
// this.basePath+'extensions/';
/*** filter types ***/
this.fltTypeInp = 'input';
@ -179,7 +180,8 @@ export class TableFilter{
/*** filters' grid appearance ***/
//stylesheet file
this.stylesheet = f.stylesheet || this.basePath+'tablefilter.css';
this.stylePath = f.style_path || this.basePath + 'style/';
this.stylesheet = f.stylesheet || this.stylePath+'tablefilter.css';
this.stylesheetId = this.id + '_style';
//defines css class for filters row
this.fltsRowCssClass = f.flts_row_css_class || 'fltrow';
@ -486,7 +488,7 @@ export class TableFilter{
this.hasThemes = (this.enableDefaultTheme || Types.isArray(f.themes));
this.themes = f.themes || [];
//themes path
this.themesPath = f.themes_path || this.basePath + 'themes/';
this.themesPath = f.themes_path || this.stylePath + 'themes/';
// Features registry
this.Cpt = {

View file

@ -17,10 +17,7 @@ span.expClpFlt img{
margin:1px 1px 1px 1px;
/*background:#f4f4f4;*/
}
span.expClpFlt img:hover{
background:#fff;
/*border:1px solid #666; */
}
span.expClpFlt img:hover{}
/* button */
.btnExpClpFlt{ margin:0 5px 0 5px; }

View file

@ -9,11 +9,10 @@
module('Sanity checks');
test('Column widths', function() {
var filterRow = tf.tbl.rows[tf.getFiltersRowIndex()];
var cols = tf.tbl.getElementsByTagName('col');
deepEqual(tf instanceof TableFilter, true, 'TableFilter instanciated');
deepEqual(filterRow.cells[1].style.width,
'100px', 'Expected column width');
deepEqual(filterRow.cells[4].style.width, '', 'Expected column width');
deepEqual(cols[1].style.width, '100px', 'Expected column width');
deepEqual(cols[4].style.width, '', 'Expected column width');
});
test('Grid layout column widths', function() {
@ -26,10 +25,9 @@
sort: false
});
tf.init();
deepEqual(tf.getHeaderElement(0).style.width,
'150px', 'Expected column width');
deepEqual(tf.getHeaderElement(4).style.width,
'200px', 'Expected column width');
var cols = tf.Cpt.gridLayout.headTbl.getElementsByTagName('col');
deepEqual(cols[0].style.width, '150px', 'Expected column width');
deepEqual(cols[4].style.width, '200px', 'Expected column width');
});
})(window, TableFilter);
})(window, TableFilter);

View file

@ -1,99 +1,46 @@
var path = require('path');
var webpack = require('webpack');
var Clean = require('clean-webpack-plugin');
module.exports = {
build: {
entry: path.join(__dirname, '/src/tablefilter.js'),
output: {
publicPath: '/build/tablefilter/',
path: path.join(__dirname, '/build/tablefilter'),
filename: 'tablefilter.js',
chunkFilename: '[name]-[chunkhash].js',
// chunkFilename: '[name].js',
libraryTarget: 'umd'
},
resolve: {
extensions: ['', '.js'],
alias: {
sortabletable: '../../../libs/sortabletable.js'
}
},
module: {
// exprContextRegExp: /$^/,
// exprContextCritical: true,
loaders: [{
test: path.join(__dirname, 'src'),
exclude: /node_modules/,
query: {
compact: false
},
loader: 'babel-loader'
}]
},
plugins: [
// new webpack.DefinePlugin({
// 'process.env': {
// // This has effect on the react lib size
// 'NODE_ENV': JSON.stringify('production')
// }
// }),
new Clean(['build']),
new webpack.optimize.DedupePlugin()
],
devtool: 'source-map',
debug: true
cache: true,
entry: path.join(__dirname, '/src/tablefilter.js'),
output: {
publicPath: '/dist/tablefilter/',
path: path.join(__dirname, '/dist/tablefilter'),
filename: 'tablefilter.js',
chunkFilename: '[name]-[chunkhash].js',
// chunkFilename: '[name].js',
libraryTarget: 'umd'
},
dist: {
entry: path.join(__dirname, '/src/tablefilter.js'),
// entry: {
// tablefilter: __dirname + '/src/tablefilter.js',
// sortabletable: __dirname + '/libs/sortabletable.js'
// },
output: {
publicPath: '/dist/tablefilter/',
path: path.join(__dirname, '/dist/tablefilter'),
filename: 'tablefilter.js',
chunkFilename: '[name]-[chunkhash].js',
// chunkFilename: '[name].js',
libraryTarget: 'umd'
},
resolve: {
extensions: ['', '.js'],
alias: {
sortabletable: '../../../libs/sortabletable.js'
// ,
// adapterSortabletable:
// './extensions/sortabletable/adapterSortabletable'
}
},
// externals: {
// 'sortabletable': 'SortableTable'
// },
module: {
// exprContextRegExp: /$^/,
// exprContextCritical: true,
loaders: [{
test: path.join(__dirname, 'src'),
exclude: /node_modules/,
query: {
compact: false
},
loader: 'babel-loader'
}]
},
plugins: [
// new webpack.DefinePlugin({
// 'process.env': {
// // This has effect on the react lib size
// 'NODE_ENV': JSON.stringify('production')
// }
// }),
// new webpack.IgnorePlugin(/adapterSortabletable$/),
new Clean(['dist']),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.MinChunkSizePlugin({ minChunkSize: 10000 }),
new webpack.optimize.UglifyJsPlugin()
]
resolve: {
extensions: ['', '.js'],
alias: {
sortabletable: '../../../libs/sortabletable.js'
}
},
module: {
// exprContextRegExp: /$^/,
// exprContextCritical: true,
loaders: [{
test: path.join(__dirname, 'src'),
exclude: /node_modules/,
query: {
compact: false
},
loader: 'babel-loader'
}]
}
// ,
// plugins: [
// // new webpack.DefinePlugin({
// // 'process.env': {
// // // This has effect on the react lib size
// // 'NODE_ENV': JSON.stringify('production')
// // }
// // }),
// // new webpack.IgnorePlugin(/adapterSortabletable$/),
// new Clean(['dist']),
// new webpack.optimize.DedupePlugin(),
// new webpack.optimize.MinChunkSizePlugin({ minChunkSize: 10000 }),
// new webpack.optimize.UglifyJsPlugin()
// ]
};