Browse Source

IE8兼容

master
guy 8 years ago
parent
commit
d36a84efeb
  1. 62
      bi/base.js
  2. 4
      bi/core.js
  3. 62
      dist/base.js
  4. 4
      dist/core.js
  5. 7
      src/base/table/table.collection.js
  6. 9
      src/base/table/table.collection.quick.js
  7. 7
      src/base/table/table.grid.js
  8. 9
      src/base/table/table.grid.quick.js
  9. 7
      src/base/table/table.grid.scrollbar.js
  10. 4
      src/core/widget.js
  11. 23
      src/third/jquery.mousewheel.js

62
bi/base.js

@ -42,9 +42,6 @@
} else {
this.onmousewheel = handler;
}
// Store the line height and page height for this particular element
$.data(this, 'mousewheel-line-height', special.getLineHeight(this));
$.data(this, 'mousewheel-page-height', special.getPageHeight(this));
},
teardown: function() {
@ -55,22 +52,6 @@
} else {
this.onmousewheel = null;
}
// Clean up the data we added to the element
$.removeData(this, 'mousewheel-line-height');
$.removeData(this, 'mousewheel-page-height');
},
getLineHeight: function(elem) {
var $elem = $(elem),
$parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
if (!$parent.length) {
$parent = $('body');
}
return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
},
getPageHeight: function(elem) {
return $(elem).height();
},
settings: {
@ -136,12 +117,12 @@
// * deltaMode 1 is by lines
// * deltaMode 2 is by pages
if ( orgEvent.deltaMode === 1 ) {
var lineHeight = $.data(this, 'mousewheel-line-height');
var lineHeight = 40;
delta *= lineHeight;
deltaY *= lineHeight;
deltaX *= lineHeight;
} else if ( orgEvent.deltaMode === 2 ) {
var pageHeight = $.data(this, 'mousewheel-page-height');
var pageHeight = 800;
delta *= pageHeight;
deltaY *= pageHeight;
deltaX *= pageHeight;
@ -28329,8 +28310,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
});
},
_init: function () {
BI.CollectionTable.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this._width = 0;
this._height = 0;
@ -28466,6 +28446,10 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
});
this._width = o.width - BI.GridTableScrollbar.SIZE;
this._height = o.height - BI.GridTableScrollbar.SIZE;
},
mounted: function () {
var o = this.options;
if (o.items.length > 0 || o.header.length < 0) {
this._digest();
this._populate();
@ -28864,8 +28848,8 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, {
});
},
_init: function () {
BI.QuickCollectionTable.superclass._init.apply(this, arguments);
render: function () {
BI.QuickCollectionTable.superclass.render.apply(this, arguments);
var self = this, o = this.options;
this.topLeftCollection.setOverflowX(false);
this.topLeftCollection.setOverflowY(false);
@ -28875,6 +28859,11 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, {
this.bottomLeftCollection.setOverflowY(false);
this.bottomRightCollection.setOverflowX(false);
this.bottomRightCollection.setOverflowY(false);
},
mounted: function () {
BI.QuickCollectionTable.superclass.mounted.apply(this, arguments);
var self = this;
this._leftWheelHandler = new BI.WheelHandler(
BI.bind(this._onWheelY, this),
BI.bind(this._shouldHandleX, this),
@ -29069,8 +29058,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
});
},
_init: function () {
BI.GridTable.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this._width = 0;
this._height = 0;
@ -29213,6 +29201,10 @@ BI.GridTable = BI.inherit(BI.Widget, {
this._height = o.height - BI.GridTableScrollbar.SIZE;
this.header = this._getHeader();
this.items = this._getItems();
},
mounted: function () {
var o = this.options;
if (o.items.length > 0) {
this._populate();
}
@ -29531,8 +29523,8 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
});
},
_init: function () {
BI.QuickGridTable.superclass._init.apply(this, arguments);
render: function () {
BI.QuickGridTable.superclass.render.apply(this, arguments);
var self = this, o = this.options;
this.topLeftGrid.setOverflowX(false);
this.topLeftGrid.setOverflowY(false);
@ -29542,6 +29534,11 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
this.bottomLeftGrid.setOverflowY(false);
this.bottomRightGrid.setOverflowX(false);
this.bottomRightGrid.setOverflowY(false);
},
mounted: function () {
BI.QuickGridTable.superclass.mounted.apply(this, arguments);
var self = this;
this._leftWheelHandler = new BI.WheelHandler(
BI.bind(this._onWheelY, this),
BI.bind(this._shouldHandleX, this),
@ -29711,8 +29708,7 @@ BI.GridTableScrollbar = BI.inherit(BI.Widget, {
})
},
_init: function () {
BI.GridTableScrollbar.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.focused = false;
this.isDragging = false;
@ -29730,6 +29726,10 @@ BI.GridTableScrollbar = BI.inherit(BI.Widget, {
top: 0
}]
});
},
mounted: function () {
var self = this, o = this.options;
var onWheel = o.orientation === 'horizontal' ? this._onWheelX : this._onWheelY;
this._wheelHandler = new BI.WheelHandler(
BI.bind(onWheel, this),

4
bi/core.js

@ -4484,6 +4484,10 @@ BI.Widget = BI.inherit(BI.OB, {
this.destroyed && this.destroyed();
},
isMounted: function () {
return this._isMounted;
},
setWidth: function (w) {
this.options.width = w;
this._initElementWidth();

62
dist/base.js vendored

@ -42,9 +42,6 @@
} else {
this.onmousewheel = handler;
}
// Store the line height and page height for this particular element
$.data(this, 'mousewheel-line-height', special.getLineHeight(this));
$.data(this, 'mousewheel-page-height', special.getPageHeight(this));
},
teardown: function() {
@ -55,22 +52,6 @@
} else {
this.onmousewheel = null;
}
// Clean up the data we added to the element
$.removeData(this, 'mousewheel-line-height');
$.removeData(this, 'mousewheel-page-height');
},
getLineHeight: function(elem) {
var $elem = $(elem),
$parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
if (!$parent.length) {
$parent = $('body');
}
return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
},
getPageHeight: function(elem) {
return $(elem).height();
},
settings: {
@ -136,12 +117,12 @@
// * deltaMode 1 is by lines
// * deltaMode 2 is by pages
if ( orgEvent.deltaMode === 1 ) {
var lineHeight = $.data(this, 'mousewheel-line-height');
var lineHeight = 40;
delta *= lineHeight;
deltaY *= lineHeight;
deltaX *= lineHeight;
} else if ( orgEvent.deltaMode === 2 ) {
var pageHeight = $.data(this, 'mousewheel-page-height');
var pageHeight = 800;
delta *= pageHeight;
deltaY *= pageHeight;
deltaX *= pageHeight;
@ -28329,8 +28310,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
});
},
_init: function () {
BI.CollectionTable.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this._width = 0;
this._height = 0;
@ -28466,6 +28446,10 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
});
this._width = o.width - BI.GridTableScrollbar.SIZE;
this._height = o.height - BI.GridTableScrollbar.SIZE;
},
mounted: function () {
var o = this.options;
if (o.items.length > 0 || o.header.length < 0) {
this._digest();
this._populate();
@ -28864,8 +28848,8 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, {
});
},
_init: function () {
BI.QuickCollectionTable.superclass._init.apply(this, arguments);
render: function () {
BI.QuickCollectionTable.superclass.render.apply(this, arguments);
var self = this, o = this.options;
this.topLeftCollection.setOverflowX(false);
this.topLeftCollection.setOverflowY(false);
@ -28875,6 +28859,11 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, {
this.bottomLeftCollection.setOverflowY(false);
this.bottomRightCollection.setOverflowX(false);
this.bottomRightCollection.setOverflowY(false);
},
mounted: function () {
BI.QuickCollectionTable.superclass.mounted.apply(this, arguments);
var self = this;
this._leftWheelHandler = new BI.WheelHandler(
BI.bind(this._onWheelY, this),
BI.bind(this._shouldHandleX, this),
@ -29069,8 +29058,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
});
},
_init: function () {
BI.GridTable.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this._width = 0;
this._height = 0;
@ -29213,6 +29201,10 @@ BI.GridTable = BI.inherit(BI.Widget, {
this._height = o.height - BI.GridTableScrollbar.SIZE;
this.header = this._getHeader();
this.items = this._getItems();
},
mounted: function () {
var o = this.options;
if (o.items.length > 0) {
this._populate();
}
@ -29531,8 +29523,8 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
});
},
_init: function () {
BI.QuickGridTable.superclass._init.apply(this, arguments);
render: function () {
BI.QuickGridTable.superclass.render.apply(this, arguments);
var self = this, o = this.options;
this.topLeftGrid.setOverflowX(false);
this.topLeftGrid.setOverflowY(false);
@ -29542,6 +29534,11 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
this.bottomLeftGrid.setOverflowY(false);
this.bottomRightGrid.setOverflowX(false);
this.bottomRightGrid.setOverflowY(false);
},
mounted: function () {
BI.QuickGridTable.superclass.mounted.apply(this, arguments);
var self = this;
this._leftWheelHandler = new BI.WheelHandler(
BI.bind(this._onWheelY, this),
BI.bind(this._shouldHandleX, this),
@ -29711,8 +29708,7 @@ BI.GridTableScrollbar = BI.inherit(BI.Widget, {
})
},
_init: function () {
BI.GridTableScrollbar.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.focused = false;
this.isDragging = false;
@ -29730,6 +29726,10 @@ BI.GridTableScrollbar = BI.inherit(BI.Widget, {
top: 0
}]
});
},
mounted: function () {
var self = this, o = this.options;
var onWheel = o.orientation === 'horizontal' ? this._onWheelX : this._onWheelY;
this._wheelHandler = new BI.WheelHandler(
BI.bind(onWheel, this),

4
dist/core.js vendored

@ -14479,6 +14479,10 @@ BI.Widget = BI.inherit(BI.OB, {
this.destroyed && this.destroyed();
},
isMounted: function () {
return this._isMounted;
},
setWidth: function (w) {
this.options.width = w;
this._initElementWidth();

7
src/base/table/table.collection.js

@ -23,8 +23,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
});
},
_init: function () {
BI.CollectionTable.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this._width = 0;
this._height = 0;
@ -160,6 +159,10 @@ BI.CollectionTable = BI.inherit(BI.Widget, {
});
this._width = o.width - BI.GridTableScrollbar.SIZE;
this._height = o.height - BI.GridTableScrollbar.SIZE;
},
mounted: function () {
var o = this.options;
if (o.items.length > 0 || o.header.length < 0) {
this._digest();
this._populate();

9
src/base/table/table.collection.quick.js

@ -12,8 +12,8 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, {
});
},
_init: function () {
BI.QuickCollectionTable.superclass._init.apply(this, arguments);
render: function () {
BI.QuickCollectionTable.superclass.render.apply(this, arguments);
var self = this, o = this.options;
this.topLeftCollection.setOverflowX(false);
this.topLeftCollection.setOverflowY(false);
@ -23,6 +23,11 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, {
this.bottomLeftCollection.setOverflowY(false);
this.bottomRightCollection.setOverflowX(false);
this.bottomRightCollection.setOverflowY(false);
},
mounted: function () {
BI.QuickCollectionTable.superclass.mounted.apply(this, arguments);
var self = this;
this._leftWheelHandler = new BI.WheelHandler(
BI.bind(this._onWheelY, this),
BI.bind(this._shouldHandleX, this),

7
src/base/table/table.grid.js

@ -20,8 +20,7 @@ BI.GridTable = BI.inherit(BI.Widget, {
});
},
_init: function () {
BI.GridTable.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this._width = 0;
this._height = 0;
@ -164,6 +163,10 @@ BI.GridTable = BI.inherit(BI.Widget, {
this._height = o.height - BI.GridTableScrollbar.SIZE;
this.header = this._getHeader();
this.items = this._getItems();
},
mounted: function () {
var o = this.options;
if (o.items.length > 0) {
this._populate();
}

9
src/base/table/table.grid.quick.js

@ -12,8 +12,8 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
});
},
_init: function () {
BI.QuickGridTable.superclass._init.apply(this, arguments);
render: function () {
BI.QuickGridTable.superclass.render.apply(this, arguments);
var self = this, o = this.options;
this.topLeftGrid.setOverflowX(false);
this.topLeftGrid.setOverflowY(false);
@ -23,6 +23,11 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
this.bottomLeftGrid.setOverflowY(false);
this.bottomRightGrid.setOverflowX(false);
this.bottomRightGrid.setOverflowY(false);
},
mounted: function () {
BI.QuickGridTable.superclass.mounted.apply(this, arguments);
var self = this;
this._leftWheelHandler = new BI.WheelHandler(
BI.bind(this._onWheelY, this),
BI.bind(this._shouldHandleX, this),

7
src/base/table/table.grid.scrollbar.js

@ -28,8 +28,7 @@ BI.GridTableScrollbar = BI.inherit(BI.Widget, {
})
},
_init: function () {
BI.GridTableScrollbar.superclass._init.apply(this, arguments);
render: function () {
var self = this, o = this.options;
this.focused = false;
this.isDragging = false;
@ -47,6 +46,10 @@ BI.GridTableScrollbar = BI.inherit(BI.Widget, {
top: 0
}]
});
},
mounted: function () {
var self = this, o = this.options;
var onWheel = o.orientation === 'horizontal' ? this._onWheelX : this._onWheelY;
this._wheelHandler = new BI.WheelHandler(
BI.bind(onWheel, this),

4
src/core/widget.js

@ -191,6 +191,10 @@ BI.Widget = BI.inherit(BI.OB, {
this.destroyed && this.destroyed();
},
isMounted: function () {
return this._isMounted;
},
setWidth: function (w) {
this.options.width = w;
this._initElementWidth();

23
src/third/jquery.mousewheel.js

@ -42,9 +42,6 @@
} else {
this.onmousewheel = handler;
}
// Store the line height and page height for this particular element
$.data(this, 'mousewheel-line-height', special.getLineHeight(this));
$.data(this, 'mousewheel-page-height', special.getPageHeight(this));
},
teardown: function() {
@ -55,22 +52,6 @@
} else {
this.onmousewheel = null;
}
// Clean up the data we added to the element
$.removeData(this, 'mousewheel-line-height');
$.removeData(this, 'mousewheel-page-height');
},
getLineHeight: function(elem) {
var $elem = $(elem),
$parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
if (!$parent.length) {
$parent = $('body');
}
return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
},
getPageHeight: function(elem) {
return $(elem).height();
},
settings: {
@ -136,12 +117,12 @@
// * deltaMode 1 is by lines
// * deltaMode 2 is by pages
if ( orgEvent.deltaMode === 1 ) {
var lineHeight = $.data(this, 'mousewheel-line-height');
var lineHeight = 40;
delta *= lineHeight;
deltaY *= lineHeight;
deltaX *= lineHeight;
} else if ( orgEvent.deltaMode === 2 ) {
var pageHeight = $.data(this, 'mousewheel-page-height');
var pageHeight = 800;
delta *= pageHeight;
deltaY *= pageHeight;
deltaX *= pageHeight;

Loading…
Cancel
Save