1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-13 11:56:46 +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'
]
}]
},{ name: 'colsVisibility' }]
};
var tf = new TableFilter('demo', filtersConfig);

View file

@ -105,6 +105,7 @@
auto_filter_delay: 200,
loader: true,
// themes: [{ name: 'skyblue'}],
popup_filters: true,
paging: true,
paging_length: 3,
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 Types from '../../types';
import Event from '../../event';
import Helpers from '../../helpers';
import Arr from '../../array';
export default class ColsVisibility{
@ -113,8 +112,8 @@ export default class ColsVisibility{
if(tf.gridLayout){
this.headersTbl = tf.feature('gridLayout').headTbl; //headers table
this.headersIndex = 0; //headers index
// this.onAfterColDisplayed = function(){};
// this.onAfterColHidden = function(){};
this.onAfterColDisplayed = function(){};
this.onAfterColHidden = function(){};
}
//Loads extension stylesheet
@ -370,44 +369,33 @@ export default class ColsVisibility{
var gridColElms;
if(this.onAfterColHidden && hide){
//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){
gridLayout = tf.feature('gridLayout');
headTbl = gridLayout.headTbl;
gridColElms = gridLayout.gridColElms;
if(Helpers.isIE()){
tbl.style.width = headTbl.clientWidth + 'px';
} 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);
var hiddenWidth = parseInt(
gridColElms[colIndex].style.width, 10);
headTbl.style.width = headTblW - hiddenWidth + 'px';
tbl.style.width = headTbl.style.width;
gridColElms[colIndex].style.display = 'none';
}
var headTblW = parseInt(headTbl.style.width, 10);
headTbl.style.width = headTblW - hiddenWidth + 'px';
tbl.style.width = headTbl.style.width;
}
this.onAfterColHidden.call(null, this, colIndex);
}
if(this.onAfterColDisplayed && !hide){
//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){
gridLayout = tf.feature('gridLayout');
headTbl = gridLayout.headTbl;
gridColElms = gridLayout.gridColElms;
gridColElms[colIndex].style.display = '';
var width = parseInt(gridColElms[colIndex].style.width, 10);
var header = tf.getHeaderElement(colIndex);
header.style.width = width +'px';
headTbl.style.width =
(parseInt(headTbl.style.width, 10) + width) + 'px';
tf.tbl.style.width = headTbl.style.width;

View file

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

View file

@ -123,14 +123,8 @@ export class Help{
return;
}
var divDisplay = this.cont.style.display;
if(divDisplay==='' || divDisplay==='none'){
if(divDisplay === '' || divDisplay === 'none'){
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 {
this.cont.style.display = 'none';
}

View file

@ -1,7 +1,6 @@
import Types from '../types';
import Dom from '../dom';
import Event from '../event';
import Helpers from '../helpers';
export class PopupFilter{
@ -69,10 +68,6 @@ export class PopupFilter{
var popUpDiv = this.popUpFltElms[colIndex],
header = this.tf.getHeaderElement(colIndex),
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';
}
Event.cancel(evt);

View file

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

View file

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

View file

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

View file

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