1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-23 16:52:26 +02:00

Removed isIE helper

This commit is contained in:
Max Guglielmi 2015-07-04 22:08:58 +10:00
parent ad6812391b
commit 3cf37e3c0f
12 changed files with 30 additions and 91 deletions

View file

@ -13012,7 +13012,7 @@
'number', 'number', 'number', 'number', 'number', 'number',
'number', 'number', 'number' 'number', 'number', 'number'
] ]
}] },{ name: 'colsVisibility' }]
}; };
var tf = new TableFilter('demo', filtersConfig); var tf = new TableFilter('demo', filtersConfig);

View file

@ -105,6 +105,7 @@
auto_filter_delay: 200, auto_filter_delay: 200,
loader: true, loader: true,
// themes: [{ name: 'skyblue'}], // themes: [{ name: 'skyblue'}],
popup_filters: true,
paging: true, paging: true,
paging_length: 3, paging_length: 3,
alternate_rows: true, alternate_rows: true,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,6 @@
import Dom from '../../dom'; import Dom from '../../dom';
import Types from '../../types'; import Types from '../../types';
import Event from '../../event'; import Event from '../../event';
import Helpers from '../../helpers';
import Arr from '../../array'; import Arr from '../../array';
export default class ColsVisibility{ export default class ColsVisibility{
@ -113,8 +112,8 @@ export default class ColsVisibility{
if(tf.gridLayout){ if(tf.gridLayout){
this.headersTbl = tf.feature('gridLayout').headTbl; //headers table this.headersTbl = tf.feature('gridLayout').headTbl; //headers table
this.headersIndex = 0; //headers index this.headersIndex = 0; //headers index
// this.onAfterColDisplayed = function(){}; this.onAfterColDisplayed = function(){};
// this.onAfterColHidden = function(){}; this.onAfterColHidden = function(){};
} }
//Loads extension stylesheet //Loads extension stylesheet
@ -370,44 +369,33 @@ export default class ColsVisibility{
var gridColElms; var gridColElms;
if(this.onAfterColHidden && hide){ if(this.onAfterColHidden && hide){
//This event is fired just after a column is displayed for //This event is fired just after a column is displayed for
//grid_layout compatibility //grid_layout support
//TODO: grid layout module should be responsible for those
//calculations
if(tf.gridLayout){ if(tf.gridLayout){
gridLayout = tf.feature('gridLayout'); gridLayout = tf.feature('gridLayout');
headTbl = gridLayout.headTbl; headTbl = gridLayout.headTbl;
gridColElms = gridLayout.gridColElms; gridColElms = gridLayout.gridColElms;
if(Helpers.isIE()){ var hiddenWidth = parseInt(
tbl.style.width = headTbl.clientWidth + 'px'; gridColElms[colIndex].style.width, 10);
} else {
var ths = headTbl.rows[this.headersIndex].cells;
var hiddenWidth = 0;
for(var i=0; i<tf.nbCells; i++){
if(ths[i].style.display === 'none'){
var w = parseInt(ths[i].style.width, 10);
ths[i].style.width = 0;
hiddenWidth += w;
}
}
var headTblW = parseInt(headTbl.style.width, 10);
headTbl.style.width = headTblW - hiddenWidth + 'px'; var headTblW = parseInt(headTbl.style.width, 10);
tbl.style.width = headTbl.style.width; headTbl.style.width = headTblW - hiddenWidth + 'px';
gridColElms[colIndex].style.display = 'none'; tbl.style.width = headTbl.style.width;
}
} }
this.onAfterColHidden.call(null, this, colIndex); this.onAfterColHidden.call(null, this, colIndex);
} }
if(this.onAfterColDisplayed && !hide){ if(this.onAfterColDisplayed && !hide){
//This event is fired just after a column is displayed for //This event is fired just after a column is displayed for
//grid_layout compatibility //grid_layout support
//TODO: grid layout module should be responsible for those
//calculations
if(tf.gridLayout){ if(tf.gridLayout){
gridLayout = tf.feature('gridLayout'); gridLayout = tf.feature('gridLayout');
headTbl = gridLayout.headTbl; headTbl = gridLayout.headTbl;
gridColElms = gridLayout.gridColElms; gridColElms = gridLayout.gridColElms;
gridColElms[colIndex].style.display = '';
var width = parseInt(gridColElms[colIndex].style.width, 10); var width = parseInt(gridColElms[colIndex].style.width, 10);
var header = tf.getHeaderElement(colIndex);
header.style.width = width +'px';
headTbl.style.width = headTbl.style.width =
(parseInt(headTbl.style.width, 10) + width) + 'px'; (parseInt(headTbl.style.width, 10) + width) + 'px';
tf.tbl.style.width = headTbl.style.width; tf.tbl.style.width = headTbl.style.width;

View file

@ -5,10 +5,6 @@
import Str from './string'; import Str from './string';
export default { export default {
isIE(){
return (/msie|MSIE/).test(navigator.userAgent);
},
removeNbFormat(data, format){ removeNbFormat(data, format){
if(!data){ if(!data){
return; return;
@ -17,7 +13,7 @@ export default {
format = 'us'; format = 'us';
} }
let n = data; let n = data;
if(Str.lower(format)==='us'){ if(Str.lower(format) === 'us'){
n =+ n.replace(/[^\d\.-]/g,''); n =+ n.replace(/[^\d\.-]/g,'');
} else { } else {
n =+ n.replace(/[^\d\,-]/g,'').replace(',','.'); n =+ n.replace(/[^\d\,-]/g,'').replace(',','.');

View file

@ -123,14 +123,8 @@ export class Help{
return; return;
} }
var divDisplay = this.cont.style.display; var divDisplay = this.cont.style.display;
if(divDisplay==='' || divDisplay==='none'){ if(divDisplay === '' || divDisplay === 'none'){
this.cont.style.display = 'inline'; this.cont.style.display = 'inline';
// TODO: use CSS instead for element positioning
// var btnLeft = Dom.position(this.btn).left;
// if(!this.contTgtId){
// this.cont.style.left =
// (btnLeft - this.cont.clientWidth + 25) + 'px';
// }
} else { } else {
this.cont.style.display = 'none'; this.cont.style.display = 'none';
} }

View file

@ -1,7 +1,6 @@
import Types from '../types'; import Types from '../types';
import Dom from '../dom'; import Dom from '../dom';
import Event from '../event'; import Event from '../event';
import Helpers from '../helpers';
export class PopupFilter{ export class PopupFilter{
@ -69,10 +68,6 @@ export class PopupFilter{
var popUpDiv = this.popUpFltElms[colIndex], var popUpDiv = this.popUpFltElms[colIndex],
header = this.tf.getHeaderElement(colIndex), header = this.tf.getHeaderElement(colIndex),
headerWidth = header.clientWidth * 0.95; headerWidth = header.clientWidth * 0.95;
if(Helpers.isIE()){
var headerLeft = Dom.position(header).left;
popUpDiv.style.left = (headerLeft) + 'px';
}
popUpDiv.style.width = parseInt(headerWidth, 10) + 'px'; popUpDiv.style.width = parseInt(headerWidth, 10) + 'px';
} }
Event.cancel(evt); Event.cancel(evt);

View file

@ -1,6 +1,5 @@
import Dom from '../dom'; import Dom from '../dom';
import Types from '../types'; import Types from '../types';
import Helpers from '../helpers';
export class RowsCounter{ export class RowsCounter{
@ -62,10 +61,6 @@ export class RowsCounter{
var targetEl = !this.rowsCounterTgtId ? var targetEl = !this.rowsCounterTgtId ?
tf.lDiv : Dom.id( this.rowsCounterTgtId ); tf.lDiv : Dom.id( this.rowsCounterTgtId );
//IE only: clears all for sure
if(this.rowsCounterDiv && Helpers.isIE()){
this.rowsCounterDiv.outerHTML = '';
}
//default container: 'lDiv' //default container: 'lDiv'
if(!this.rowsCounterTgtId){ if(!this.rowsCounterTgtId){
countDiv.appendChild(countText); countDiv.appendChild(countText);
@ -125,24 +120,16 @@ export class RowsCounter{
destroy(){ destroy(){
var tf = this.tf; var tf = this.tf;
if(!tf.hasGrid()){ if(!tf.hasGrid() || !this.rowsCounterSpan){
return;
}
if(!this.rowsCounterSpan){
return; return;
} }
if(!this.rowsCounterTgtId && this.rowsCounterDiv){ if(!this.rowsCounterTgtId && this.rowsCounterDiv){
//IE only: clears all for sure this.rowsCounterDiv.parentNode.removeChild(this.rowsCounterDiv);
if(Helpers.isIE()){
this.rowsCounterDiv.outerHTML = '';
} else {
this.rowsCounterDiv.parentNode.removeChild(this.rowsCounterDiv);
}
} else { } else {
Dom.id( this.rowsCounterTgtId ).innerHTML = ''; Dom.id(this.rowsCounterTgtId).innerHTML = '';
} }
this.rowsCounterSpan = null; this.rowsCounterSpan = null;
this.rowsCounterDiv = null; this.rowsCounterDiv = null;
} }
} }

View file

@ -1,6 +1,5 @@
import Dom from '../dom'; import Dom from '../dom';
import Types from '../types'; import Types from '../types';
// import Helpers from '../helpers';
var global = window; var global = window;
@ -70,11 +69,6 @@ export class StatusBar{
var targetEl = (!this.statusBarTgtId) ? var targetEl = (!this.statusBarTgtId) ?
tf.lDiv : Dom.id(this.statusBarTgtId); tf.lDiv : Dom.id(this.statusBarTgtId);
// TODO: use alternative to outerHTML
// if(this.statusBarDiv && Helpers.isIE()){
// this.statusBarDiv.outerHTML = '';
// }
//default container: 'lDiv' //default container: 'lDiv'
if(!this.statusBarTgtId){ if(!this.statusBarTgtId){
statusDiv.appendChild(statusSpanText); statusDiv.appendChild(statusSpanText);

View file

@ -35,7 +35,7 @@
'number', 'number', 'number', 'number', 'number', 'number',
'number', 'number', 'number' 'number', 'number', 'number'
] ]
}] },{ name: 'colsVisibility' }]
}; };
var tf = new TableFilter('demo', filtersConfig); var tf = new TableFilter('demo', filtersConfig);

View file

@ -72,18 +72,4 @@ module.exports = {
new StringReplacePlugin() new StringReplacePlugin()
] ]
} }
// ,
// 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()
// ]
}; };