Browse Source

Merge pull request #21 in FUI/fineui from ~GUY/fineui:master to master

* commit '0e993cddeb20a81baa77e62e27f93b76e65c11cf':
  checkwatermark
  add
  add
  IE8兼容
  删除
  add
  add
  version
  update
  add
  tab和navigation加入single属性
es6
guy 8 years ago
parent
commit
dec55d3606
  1. 143
      bi/base.js
  2. 7
      bi/case.js
  3. 90
      bi/core.js
  4. 20
      bi/widget.js
  5. 143
      dist/base.js
  6. 7
      dist/case.js
  7. 92
      dist/core.js
  8. 20
      dist/widget.js
  9. 39
      src/base/combination/navigation.js
  10. 15
      src/base/combination/tab.js
  11. 1
      src/base/single/editor/editor.textarea.js
  12. 7
      src/base/table/table.collection.js
  13. 9
      src/base/table/table.collection.quick.js
  14. 7
      src/base/table/table.grid.js
  15. 9
      src/base/table/table.grid.quick.js
  16. 13
      src/base/table/table.grid.scrollbar.js
  17. 9
      src/base/table/table.js
  18. 12
      src/base/tree/treeview.js
  19. 6
      src/case/pager/pager.all.count.js
  20. 1
      src/case/pager/pager.direction.js
  21. 3
      src/core/base.js
  22. 81
      src/core/func/function.js
  23. 1
      src/core/version.js
  24. 4
      src/core/widget.js
  25. 2
      src/core/wrapper/layout/layout.card.js
  26. 23
      src/third/jquery.mousewheel.js
  27. 20
      src/widget/pagetable/pagetable.js

143
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;
@ -1489,10 +1470,6 @@ BI.TreeView = BI.inherit(BI.Pane, {
},
_init: function () {
BI.TreeView.superclass._init.apply(this, arguments);
this._stop = false;
this.container = BI.createWidget();
@ -1969,10 +1946,10 @@ BI.TreeView = BI.inherit(BI.Pane, {
}
});
BI.extend(BI.TreeView, {
REQ_TYPE_INIT_DATA: 1,
REQ_TYPE_ADJUST_DATA: 2,
REQ_TYPE_CALCULATE_SELECT_DATA: 3,
REQ_TYPE_SELECTED_DATA: 4
REQ_TYPE_INIT_DATA: 0,
REQ_TYPE_ADJUST_DATA: 1,
REQ_TYPE_CALCULATE_SELECT_DATA: 2,
REQ_TYPE_SELECTED_DATA: 3
});
BI.TreeView.EVENT_CHANGE = "EVENT_CHANGE";
@ -3920,12 +3897,9 @@ BI.Navigation = BI.inherit(BI.Widget, {
logic: {
dynamic: false
},
defaultShowIndex: 0,
tab: {
type: "bi.button_group",
items: [],
layouts: []
},
single: false,
defaultShowIndex: false,
tab: false,
cardCreator: function (v) {
return BI.createWidget();
},
@ -3963,7 +3937,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
},
afterCardCreated: BI.bind(this.afterCardCreated, this),
afterCardShow: BI.bind(this.afterCardShow, this)
})
});
},
mounted: function () {
@ -3973,6 +3947,18 @@ BI.Navigation = BI.inherit(BI.Widget, {
}
},
_deleteOtherCards: function (currCardName) {
var self = this, o = this.options;
if (o.single === true) {
BI.each(this.cardMap, function (name, card) {
if (name !== (currCardName + "")) {
self.layout.deleteCardByName(name);
delete self.cardMap[name];
}
});
}
},
afterCardCreated: function (v) {
var self = this;
this.cardMap[v].on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
@ -3980,12 +3966,13 @@ BI.Navigation = BI.inherit(BI.Widget, {
if (type === BI.Events.CLICK) {
self.fireEvent(BI.Navigation.EVENT_CHANGE, obj);
}
})
});
this.options.afterCardCreated.apply(this, arguments);
},
afterCardShow: function (v) {
this.showIndex = v;
this._deleteOtherCards(v);
this.options.afterCardShow.apply(this, arguments);
},
@ -3996,16 +3983,23 @@ BI.Navigation = BI.inherit(BI.Widget, {
}
},
setSelect: function (v) {
this.showIndex = v;
_assertCard: function (v) {
if (!this.layout.isCardExisted(v)) {
var card = this.options.cardCreator(v);
this.cardMap[v] = card;
this.layout.addCardByName(v, card);
this.afterCardCreated(v);
}
},
setSelect: function (v) {
this._assertCard();
this.layout.showCardByName(v);
BI.nextTick(BI.bind(this.afterCardShow, this, v));
this._deleteOtherCards(v);
if (this.showIndex !== v) {
this.showIndex = v;
BI.nextTick(BI.bind(this.afterCardShow, this, v));
}
},
getSelect: function () {
@ -4636,6 +4630,7 @@ BI.Tab = BI.inherit(BI.Widget, {
return BI.extend(BI.Tab.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-tab",
direction: "top",//top, bottom, left, right, custom
single: false, //是不是单页面
logic: {
dynamic: false
},
@ -4675,6 +4670,7 @@ BI.Tab = BI.inherit(BI.Widget, {
return card;
},
afterCardShow: function (v) {
self._deleteOtherCards(v);
self.curr = v;
}
});
@ -4683,6 +4679,18 @@ BI.Tab = BI.inherit(BI.Widget, {
});
},
_deleteOtherCards: function (currCardName) {
var self = this, o = this.options;
if (o.single === true) {
BI.each(this.cardMap, function (name, card) {
if (name !== (currCardName + "")) {
self.layout.deleteCardByName(name);
delete self.cardMap[name];
}
});
}
},
_assertCard: function (v) {
if (!this.layout.isCardExisted(v)) {
var card = this.options.cardCreator(v);
@ -4702,6 +4710,7 @@ BI.Tab = BI.inherit(BI.Widget, {
this.tab && this.tab.setValue(v);
this._assertCard(v);
this.layout.showCardByName(v);
this._deleteOtherCards(v);
if (this.curr !== v) {
this.curr = v;
}
@ -28297,8 +28306,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;
@ -28434,6 +28442,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();
@ -28832,8 +28844,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);
@ -28843,6 +28855,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),
@ -29037,8 +29054,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;
@ -29181,6 +29197,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();
}
@ -29499,8 +29519,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);
@ -29510,6 +29530,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),
@ -29679,8 +29704,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;
@ -29698,6 +29722,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),
@ -30052,6 +30080,12 @@ BI.GridTableHorizontalScrollbar = BI.inherit(BI.Widget, {
populate: function () {
this.scrollbar.populate();
var o = this.options;
if (o.size < 1 || o.contentSize <= o.size) {
this.setVisible(false);
return;
}
this.setVisible(true);
}
});
BI.GridTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL";
@ -30973,11 +31007,9 @@ BI.Table = BI.inherit(BI.Widget, {
};
this._initNormalScroll();
BI.Resizers.add(this.getName(), function (e) {
if (self.element.is(":visible") && BI.isWindow(e.target)) {
self._resize();
self.fireEvent(BI.Table.EVENT_TABLE_RESIZE);
}
BI.ResizeDetector.addResizeListener(this, function () {
self._resize();
self.fireEvent(BI.Table.EVENT_TABLE_RESIZE);
});
BI.nextTick(function () {
if (self.element.is(":visible")) {
@ -32003,7 +32035,6 @@ BI.Table = BI.inherit(BI.Widget, {
},
empty: function () {
BI.Resizers.remove(this.getName());
BI.Table.superclass.empty.apply(this, arguments);
},

7
bi/case.js

@ -8614,6 +8614,8 @@ BI.AllCountPager = BI.inherit(BI.Widget, {
})
},
alwaysShowPager: true,
setAllPages: function (v) {
this.allPages.setText("/" + v);
this.allPages.setTitle(v);
@ -8648,10 +8650,6 @@ BI.AllCountPager = BI.inherit(BI.Widget, {
this.pager.setVisible(b);
},
getAliasWidth: function () {
return this.options.width - 100;
},
populate: function () {
this.pager.populate();
}
@ -8908,6 +8906,7 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
this.setVPagerVisible(true);
vShow = true;
}
this.setVisible(hShow || vShow);
var num = [74, 111, -9, 28];
var items = this.layout.attr("items");

90
bi/core.js

@ -1904,9 +1904,6 @@ if (!window.BI) {
}
;
!(function ($, undefined) {
_.extend(BI, {
version: "2.0"
});
var traverse = function (func, context) {
return function (value, key, obj) {
return func.call(context, key, value, obj);
@ -4487,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();
@ -13289,7 +13290,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
isCardExisted: function (cardName) {
return BI.some(this.options.items, function (i, item) {
return item.cardName === cardName && item.el;
return item.cardName == cardName && item.el;
});
},
@ -16934,23 +16935,6 @@ $(function () {
BI.Func = {};
var formulas = {};
BI.extend(BI.Func, {
/**
* 创建唯一的名字
* @param array
* @param name
* @returns {*}
*/
createDistinctName: function (array, name) {
var src = name, idx = 1;
name = name || "";
while (true) {
if (!ArrayUtils.getItemByName(array, name)) {
break;
}
name = src + (idx++);
}
return name;
},
/**
* 获取搜索结果
@ -16998,60 +16982,6 @@ $(function () {
finded: finded
}
},
/**
* 公式合法性验证
*/
checkFormulaValidation: function (str) {
if (!BI.isEmptyString(str)) {
if (BI.has(formulas, str)) {
return formulas[str];
}
formulas[str] = false;
var response = BI.requestSync("fr_bi_base", "check_validation_of_expression", {expression: str});
if (response.validation === "invalid") {
formulas[str] = false;
} else if (response.validation === "valid") {
formulas[str] = true;
}
return formulas[str];
} else {
return true;
}
},
getFormulaStringFromFormulaValue: function (formulaValue) {
var formulaString = "";
var regx = /\$[\{][^\}]*[\}]|\w*\w|\$\{[^\$\(\)\+\-\*\/)\$,]*\w\}|\$\{[^\$\(\)\+\-\*\/]*\w\}|\$\{[^\$\(\)\+\-\*\/]*[\u4e00-\u9fa5]\}|\w|(.)/g;
var result = formulaValue.match(regx);
BI.each(result, function (i, item) {
var fieldRegx = /\$[\{][^\}]*[\}]/;
var str = item.match(fieldRegx);
if (BI.isNotEmptyArray(str)) {
formulaString = formulaString + str[0].substring(2, item.length - 1);
} else {
formulaString = formulaString + item;
}
});
return formulaString;
},
formatAddress: function (address) {
var temp = '';
var url1 = /[a-zA-z]+:\/\/[^\s]*/;
var url2 = /\/[^\s]*/;
if (address.match(url1) || address.match(url2)) {
temp = address;
} else if (BI.isNotEmptyString(address)) {
temp = "http://" + address;
}
return temp;
},
getCompleteImageUrl: function (url) {
return BI.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + url;
}
});
/**
@ -17104,19 +17034,13 @@ $(function () {
});
},
getImageWidthAndHeight: function (src) {
return BI.requestSync("fr_bi_base", "get_image_size", {
src: src
});
},
isDarkColor: function (hex) {
if (!hex) {
return false;
}
var rgb = this.rgb2json(this.hex2rgb(hex));
var grayLevel = (rgb.r * 0.299 + rgb.g * 0.587 + rgb.b * 0.114);
if (grayLevel < 192) {
var grayLevel = Math.round(rgb.r * 0.299 + rgb.g * 0.587 + rgb.b * 0.114);
if (grayLevel < 140) {
return true;
}
return false;

20
bi/widget.js

@ -12846,7 +12846,7 @@ BI.PageTable = BI.inherit(BI.Widget, {
this.table = BI.createWidget(o.el, {
type: "bi.sequence_table",
width: o.width,
height: o.height - 30,
height: o.height && o.height - 30,
isNeedResize: true,
isResizeAdapt: false,
@ -12970,7 +12970,23 @@ BI.PageTable = BI.inherit(BI.Widget, {
setHeight: function (height) {
BI.PageTable.superclass.setHeight.apply(this, arguments);
this.table.setHeight(height - 30);
var showPager = false;
if (this.pager.alwaysShowPager) {
showPager = true;
} else if (this.pager.hasHNext && this.pager.hasHNext()) {
showPager = true;
} else if (this.pager.hasHPrev && this.pager.hasHPrev()) {
showPager = true;
} else if (this.pager.hasVNext && this.pager.hasVNext()) {
showPager = true;
} else if (this.pager.hasVPrev && this.pager.hasVPrev()) {
showPager = true;
} else if (this.pager.hasNext && this.pager.hasNext()) {
showPager = true;
} else if (this.pager.hasPrev && this.pager.hasPrev()) {
showPager = true;
}
this.table.setHeight(height - (showPager ? 30 : 0));
},
setColumnSize: function (columnSize) {

143
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;
@ -1489,10 +1470,6 @@ BI.TreeView = BI.inherit(BI.Pane, {
},
_init: function () {
BI.TreeView.superclass._init.apply(this, arguments);
this._stop = false;
this.container = BI.createWidget();
@ -1969,10 +1946,10 @@ BI.TreeView = BI.inherit(BI.Pane, {
}
});
BI.extend(BI.TreeView, {
REQ_TYPE_INIT_DATA: 1,
REQ_TYPE_ADJUST_DATA: 2,
REQ_TYPE_CALCULATE_SELECT_DATA: 3,
REQ_TYPE_SELECTED_DATA: 4
REQ_TYPE_INIT_DATA: 0,
REQ_TYPE_ADJUST_DATA: 1,
REQ_TYPE_CALCULATE_SELECT_DATA: 2,
REQ_TYPE_SELECTED_DATA: 3
});
BI.TreeView.EVENT_CHANGE = "EVENT_CHANGE";
@ -3920,12 +3897,9 @@ BI.Navigation = BI.inherit(BI.Widget, {
logic: {
dynamic: false
},
defaultShowIndex: 0,
tab: {
type: "bi.button_group",
items: [],
layouts: []
},
single: false,
defaultShowIndex: false,
tab: false,
cardCreator: function (v) {
return BI.createWidget();
},
@ -3963,7 +3937,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
},
afterCardCreated: BI.bind(this.afterCardCreated, this),
afterCardShow: BI.bind(this.afterCardShow, this)
})
});
},
mounted: function () {
@ -3973,6 +3947,18 @@ BI.Navigation = BI.inherit(BI.Widget, {
}
},
_deleteOtherCards: function (currCardName) {
var self = this, o = this.options;
if (o.single === true) {
BI.each(this.cardMap, function (name, card) {
if (name !== (currCardName + "")) {
self.layout.deleteCardByName(name);
delete self.cardMap[name];
}
});
}
},
afterCardCreated: function (v) {
var self = this;
this.cardMap[v].on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
@ -3980,12 +3966,13 @@ BI.Navigation = BI.inherit(BI.Widget, {
if (type === BI.Events.CLICK) {
self.fireEvent(BI.Navigation.EVENT_CHANGE, obj);
}
})
});
this.options.afterCardCreated.apply(this, arguments);
},
afterCardShow: function (v) {
this.showIndex = v;
this._deleteOtherCards(v);
this.options.afterCardShow.apply(this, arguments);
},
@ -3996,16 +3983,23 @@ BI.Navigation = BI.inherit(BI.Widget, {
}
},
setSelect: function (v) {
this.showIndex = v;
_assertCard: function (v) {
if (!this.layout.isCardExisted(v)) {
var card = this.options.cardCreator(v);
this.cardMap[v] = card;
this.layout.addCardByName(v, card);
this.afterCardCreated(v);
}
},
setSelect: function (v) {
this._assertCard();
this.layout.showCardByName(v);
BI.nextTick(BI.bind(this.afterCardShow, this, v));
this._deleteOtherCards(v);
if (this.showIndex !== v) {
this.showIndex = v;
BI.nextTick(BI.bind(this.afterCardShow, this, v));
}
},
getSelect: function () {
@ -4636,6 +4630,7 @@ BI.Tab = BI.inherit(BI.Widget, {
return BI.extend(BI.Tab.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-tab",
direction: "top",//top, bottom, left, right, custom
single: false, //是不是单页面
logic: {
dynamic: false
},
@ -4675,6 +4670,7 @@ BI.Tab = BI.inherit(BI.Widget, {
return card;
},
afterCardShow: function (v) {
self._deleteOtherCards(v);
self.curr = v;
}
});
@ -4683,6 +4679,18 @@ BI.Tab = BI.inherit(BI.Widget, {
});
},
_deleteOtherCards: function (currCardName) {
var self = this, o = this.options;
if (o.single === true) {
BI.each(this.cardMap, function (name, card) {
if (name !== (currCardName + "")) {
self.layout.deleteCardByName(name);
delete self.cardMap[name];
}
});
}
},
_assertCard: function (v) {
if (!this.layout.isCardExisted(v)) {
var card = this.options.cardCreator(v);
@ -4702,6 +4710,7 @@ BI.Tab = BI.inherit(BI.Widget, {
this.tab && this.tab.setValue(v);
this._assertCard(v);
this.layout.showCardByName(v);
this._deleteOtherCards(v);
if (this.curr !== v) {
this.curr = v;
}
@ -28297,8 +28306,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;
@ -28434,6 +28442,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();
@ -28832,8 +28844,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);
@ -28843,6 +28855,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),
@ -29037,8 +29054,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;
@ -29181,6 +29197,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();
}
@ -29499,8 +29519,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);
@ -29510,6 +29530,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),
@ -29679,8 +29704,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;
@ -29698,6 +29722,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),
@ -30052,6 +30080,12 @@ BI.GridTableHorizontalScrollbar = BI.inherit(BI.Widget, {
populate: function () {
this.scrollbar.populate();
var o = this.options;
if (o.size < 1 || o.contentSize <= o.size) {
this.setVisible(false);
return;
}
this.setVisible(true);
}
});
BI.GridTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL";
@ -30973,11 +31007,9 @@ BI.Table = BI.inherit(BI.Widget, {
};
this._initNormalScroll();
BI.Resizers.add(this.getName(), function (e) {
if (self.element.is(":visible") && BI.isWindow(e.target)) {
self._resize();
self.fireEvent(BI.Table.EVENT_TABLE_RESIZE);
}
BI.ResizeDetector.addResizeListener(this, function () {
self._resize();
self.fireEvent(BI.Table.EVENT_TABLE_RESIZE);
});
BI.nextTick(function () {
if (self.element.is(":visible")) {
@ -32003,7 +32035,6 @@ BI.Table = BI.inherit(BI.Widget, {
},
empty: function () {
BI.Resizers.remove(this.getName());
BI.Table.superclass.empty.apply(this, arguments);
},

7
dist/case.js vendored

@ -8614,6 +8614,8 @@ BI.AllCountPager = BI.inherit(BI.Widget, {
})
},
alwaysShowPager: true,
setAllPages: function (v) {
this.allPages.setText("/" + v);
this.allPages.setTitle(v);
@ -8648,10 +8650,6 @@ BI.AllCountPager = BI.inherit(BI.Widget, {
this.pager.setVisible(b);
},
getAliasWidth: function () {
return this.options.width - 100;
},
populate: function () {
this.pager.populate();
}
@ -8908,6 +8906,7 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
this.setVPagerVisible(true);
vShow = true;
}
this.setVisible(hShow || vShow);
var num = [74, 111, -9, 28];
var items = this.layout.attr("items");

92
dist/core.js vendored

@ -13046,9 +13046,6 @@ if (!window.BI) {
}
;
!(function ($, undefined) {
_.extend(BI, {
version: "2.0"
});
var traverse = function (func, context) {
return function (value, key, obj) {
return func.call(context, key, value, obj);
@ -14482,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();
@ -22558,23 +22559,6 @@ $(function () {
BI.Func = {};
var formulas = {};
BI.extend(BI.Func, {
/**
* 创建唯一的名字
* @param array
* @param name
* @returns {*}
*/
createDistinctName: function (array, name) {
var src = name, idx = 1;
name = name || "";
while (true) {
if (!ArrayUtils.getItemByName(array, name)) {
break;
}
name = src + (idx++);
}
return name;
},
/**
* 获取搜索结果
@ -22622,60 +22606,6 @@ $(function () {
finded: finded
}
},
/**
* 公式合法性验证
*/
checkFormulaValidation: function (str) {
if (!BI.isEmptyString(str)) {
if (BI.has(formulas, str)) {
return formulas[str];
}
formulas[str] = false;
var response = BI.requestSync("fr_bi_base", "check_validation_of_expression", {expression: str});
if (response.validation === "invalid") {
formulas[str] = false;
} else if (response.validation === "valid") {
formulas[str] = true;
}
return formulas[str];
} else {
return true;
}
},
getFormulaStringFromFormulaValue: function (formulaValue) {
var formulaString = "";
var regx = /\$[\{][^\}]*[\}]|\w*\w|\$\{[^\$\(\)\+\-\*\/)\$,]*\w\}|\$\{[^\$\(\)\+\-\*\/]*\w\}|\$\{[^\$\(\)\+\-\*\/]*[\u4e00-\u9fa5]\}|\w|(.)/g;
var result = formulaValue.match(regx);
BI.each(result, function (i, item) {
var fieldRegx = /\$[\{][^\}]*[\}]/;
var str = item.match(fieldRegx);
if (BI.isNotEmptyArray(str)) {
formulaString = formulaString + str[0].substring(2, item.length - 1);
} else {
formulaString = formulaString + item;
}
});
return formulaString;
},
formatAddress: function (address) {
var temp = '';
var url1 = /[a-zA-z]+:\/\/[^\s]*/;
var url2 = /\/[^\s]*/;
if (address.match(url1) || address.match(url2)) {
temp = address;
} else if (BI.isNotEmptyString(address)) {
temp = "http://" + address;
}
return temp;
},
getCompleteImageUrl: function (url) {
return BI.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + url;
}
});
/**
@ -22728,19 +22658,13 @@ $(function () {
});
},
getImageWidthAndHeight: function (src) {
return BI.requestSync("fr_bi_base", "get_image_size", {
src: src
});
},
isDarkColor: function (hex) {
if (!hex) {
return false;
}
var rgb = this.rgb2json(this.hex2rgb(hex));
var grayLevel = (rgb.r * 0.299 + rgb.g * 0.587 + rgb.b * 0.114);
if (grayLevel < 192) {
var grayLevel = Math.round(rgb.r * 0.299 + rgb.g * 0.587 + rgb.b * 0.114);
if (grayLevel < 140) {
return true;
}
return false;
@ -25033,7 +24957,7 @@ _.extend(BI, {
Top: "top",
Bottom: "bottom"
}
});/**
});BI.version = "2.0";/**
* absolute实现的居中布局
* @class BI.AbsoluteCenterLayout
* @extends BI.Layout
@ -26842,7 +26766,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
isCardExisted: function (cardName) {
return BI.some(this.options.items, function (i, item) {
return item.cardName === cardName && item.el;
return item.cardName == cardName && item.el;
});
},

20
dist/widget.js vendored

@ -12846,7 +12846,7 @@ BI.PageTable = BI.inherit(BI.Widget, {
this.table = BI.createWidget(o.el, {
type: "bi.sequence_table",
width: o.width,
height: o.height - 30,
height: o.height && o.height - 30,
isNeedResize: true,
isResizeAdapt: false,
@ -12970,7 +12970,23 @@ BI.PageTable = BI.inherit(BI.Widget, {
setHeight: function (height) {
BI.PageTable.superclass.setHeight.apply(this, arguments);
this.table.setHeight(height - 30);
var showPager = false;
if (this.pager.alwaysShowPager) {
showPager = true;
} else if (this.pager.hasHNext && this.pager.hasHNext()) {
showPager = true;
} else if (this.pager.hasHPrev && this.pager.hasHPrev()) {
showPager = true;
} else if (this.pager.hasVNext && this.pager.hasVNext()) {
showPager = true;
} else if (this.pager.hasVPrev && this.pager.hasVPrev()) {
showPager = true;
} else if (this.pager.hasNext && this.pager.hasNext()) {
showPager = true;
} else if (this.pager.hasPrev && this.pager.hasPrev()) {
showPager = true;
}
this.table.setHeight(height - (showPager ? 30 : 0));
},
setColumnSize: function (columnSize) {

39
src/base/combination/navigation.js

@ -9,12 +9,9 @@ BI.Navigation = BI.inherit(BI.Widget, {
logic: {
dynamic: false
},
defaultShowIndex: 0,
tab: {
type: "bi.button_group",
items: [],
layouts: []
},
single: false,
defaultShowIndex: false,
tab: false,
cardCreator: function (v) {
return BI.createWidget();
},
@ -52,7 +49,7 @@ BI.Navigation = BI.inherit(BI.Widget, {
},
afterCardCreated: BI.bind(this.afterCardCreated, this),
afterCardShow: BI.bind(this.afterCardShow, this)
})
});
},
mounted: function () {
@ -62,6 +59,18 @@ BI.Navigation = BI.inherit(BI.Widget, {
}
},
_deleteOtherCards: function (currCardName) {
var self = this, o = this.options;
if (o.single === true) {
BI.each(this.cardMap, function (name, card) {
if (name !== (currCardName + "")) {
self.layout.deleteCardByName(name);
delete self.cardMap[name];
}
});
}
},
afterCardCreated: function (v) {
var self = this;
this.cardMap[v].on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
@ -69,12 +78,13 @@ BI.Navigation = BI.inherit(BI.Widget, {
if (type === BI.Events.CLICK) {
self.fireEvent(BI.Navigation.EVENT_CHANGE, obj);
}
})
});
this.options.afterCardCreated.apply(this, arguments);
},
afterCardShow: function (v) {
this.showIndex = v;
this._deleteOtherCards(v);
this.options.afterCardShow.apply(this, arguments);
},
@ -85,16 +95,23 @@ BI.Navigation = BI.inherit(BI.Widget, {
}
},
setSelect: function (v) {
this.showIndex = v;
_assertCard: function (v) {
if (!this.layout.isCardExisted(v)) {
var card = this.options.cardCreator(v);
this.cardMap[v] = card;
this.layout.addCardByName(v, card);
this.afterCardCreated(v);
}
},
setSelect: function (v) {
this._assertCard();
this.layout.showCardByName(v);
BI.nextTick(BI.bind(this.afterCardShow, this, v));
this._deleteOtherCards(v);
if (this.showIndex !== v) {
this.showIndex = v;
BI.nextTick(BI.bind(this.afterCardShow, this, v));
}
},
getSelect: function () {

15
src/base/combination/tab.js

@ -7,6 +7,7 @@ BI.Tab = BI.inherit(BI.Widget, {
return BI.extend(BI.Tab.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-tab",
direction: "top",//top, bottom, left, right, custom
single: false, //是不是单页面
logic: {
dynamic: false
},
@ -46,6 +47,7 @@ BI.Tab = BI.inherit(BI.Widget, {
return card;
},
afterCardShow: function (v) {
self._deleteOtherCards(v);
self.curr = v;
}
});
@ -54,6 +56,18 @@ BI.Tab = BI.inherit(BI.Widget, {
});
},
_deleteOtherCards: function (currCardName) {
var self = this, o = this.options;
if (o.single === true) {
BI.each(this.cardMap, function (name, card) {
if (name !== (currCardName + "")) {
self.layout.deleteCardByName(name);
delete self.cardMap[name];
}
});
}
},
_assertCard: function (v) {
if (!this.layout.isCardExisted(v)) {
var card = this.options.cardCreator(v);
@ -73,6 +87,7 @@ BI.Tab = BI.inherit(BI.Widget, {
this.tab && this.tab.setValue(v);
this._assertCard(v);
this.layout.showCardByName(v);
this._deleteOtherCards(v);
if (this.curr !== v) {
this.curr = v;
}

1
src/base/single/editor/editor.textarea.js

@ -136,6 +136,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
setValue: function (value) {
this.content.element.val(value);
this._checkWaterMark();
},
setStyle: function (style) {

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),

13
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),
@ -401,6 +404,12 @@ BI.GridTableHorizontalScrollbar = BI.inherit(BI.Widget, {
populate: function () {
this.scrollbar.populate();
var o = this.options;
if (o.size < 1 || o.contentSize <= o.size) {
this.setVisible(false);
return;
}
this.setVisible(true);
}
});
BI.GridTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL";

9
src/base/table/table.js

@ -887,11 +887,9 @@ BI.Table = BI.inherit(BI.Widget, {
};
this._initNormalScroll();
BI.Resizers.add(this.getName(), function (e) {
if (self.element.is(":visible") && BI.isWindow(e.target)) {
self._resize();
self.fireEvent(BI.Table.EVENT_TABLE_RESIZE);
}
BI.ResizeDetector.addResizeListener(this, function () {
self._resize();
self.fireEvent(BI.Table.EVENT_TABLE_RESIZE);
});
BI.nextTick(function () {
if (self.element.is(":visible")) {
@ -1917,7 +1915,6 @@ BI.Table = BI.inherit(BI.Widget, {
},
empty: function () {
BI.Resizers.remove(this.getName());
BI.Table.superclass.empty.apply(this, arguments);
},

12
src/base/tree/treeview.js

@ -14,10 +14,6 @@ BI.TreeView = BI.inherit(BI.Pane, {
},
_init: function () {
BI.TreeView.superclass._init.apply(this, arguments);
this._stop = false;
this.container = BI.createWidget();
@ -494,10 +490,10 @@ BI.TreeView = BI.inherit(BI.Pane, {
}
});
BI.extend(BI.TreeView, {
REQ_TYPE_INIT_DATA: 1,
REQ_TYPE_ADJUST_DATA: 2,
REQ_TYPE_CALCULATE_SELECT_DATA: 3,
REQ_TYPE_SELECTED_DATA: 4
REQ_TYPE_INIT_DATA: 0,
REQ_TYPE_ADJUST_DATA: 1,
REQ_TYPE_CALCULATE_SELECT_DATA: 2,
REQ_TYPE_SELECTED_DATA: 3
});
BI.TreeView.EVENT_CHANGE = "EVENT_CHANGE";

6
src/case/pager/pager.all.count.js

@ -119,6 +119,8 @@ BI.AllCountPager = BI.inherit(BI.Widget, {
})
},
alwaysShowPager: true,
setAllPages: function (v) {
this.allPages.setText("/" + v);
this.allPages.setTitle(v);
@ -153,10 +155,6 @@ BI.AllCountPager = BI.inherit(BI.Widget, {
this.pager.setVisible(b);
},
getAliasWidth: function () {
return this.options.width - 100;
},
populate: function () {
this.pager.populate();
}

1
src/case/pager/pager.direction.js

@ -249,6 +249,7 @@ BI.DirectionPager = BI.inherit(BI.Widget, {
this.setVPagerVisible(true);
vShow = true;
}
this.setVisible(hShow || vShow);
var num = [74, 111, -9, 28];
var items = this.layout.attr("items");

3
src/core/base.js

@ -9,9 +9,6 @@ if (!window.BI) {
}
;
!(function ($, undefined) {
_.extend(BI, {
version: "2.0"
});
var traverse = function (func, context) {
return function (value, key, obj) {
return func.call(context, key, value, obj);

81
src/core/func/function.js

@ -6,23 +6,6 @@ $(function () {
BI.Func = {};
var formulas = {};
BI.extend(BI.Func, {
/**
* 创建唯一的名字
* @param array
* @param name
* @returns {*}
*/
createDistinctName: function (array, name) {
var src = name, idx = 1;
name = name || "";
while (true) {
if (!ArrayUtils.getItemByName(array, name)) {
break;
}
name = src + (idx++);
}
return name;
},
/**
* 获取搜索结果
@ -70,60 +53,6 @@ $(function () {
finded: finded
}
},
/**
* 公式合法性验证
*/
checkFormulaValidation: function (str) {
if (!BI.isEmptyString(str)) {
if (BI.has(formulas, str)) {
return formulas[str];
}
formulas[str] = false;
var response = BI.requestSync("fr_bi_base", "check_validation_of_expression", {expression: str});
if (response.validation === "invalid") {
formulas[str] = false;
} else if (response.validation === "valid") {
formulas[str] = true;
}
return formulas[str];
} else {
return true;
}
},
getFormulaStringFromFormulaValue: function (formulaValue) {
var formulaString = "";
var regx = /\$[\{][^\}]*[\}]|\w*\w|\$\{[^\$\(\)\+\-\*\/)\$,]*\w\}|\$\{[^\$\(\)\+\-\*\/]*\w\}|\$\{[^\$\(\)\+\-\*\/]*[\u4e00-\u9fa5]\}|\w|(.)/g;
var result = formulaValue.match(regx);
BI.each(result, function (i, item) {
var fieldRegx = /\$[\{][^\}]*[\}]/;
var str = item.match(fieldRegx);
if (BI.isNotEmptyArray(str)) {
formulaString = formulaString + str[0].substring(2, item.length - 1);
} else {
formulaString = formulaString + item;
}
});
return formulaString;
},
formatAddress: function (address) {
var temp = '';
var url1 = /[a-zA-z]+:\/\/[^\s]*/;
var url2 = /\/[^\s]*/;
if (address.match(url1) || address.match(url2)) {
temp = address;
} else if (BI.isNotEmptyString(address)) {
temp = "http://" + address;
}
return temp;
},
getCompleteImageUrl: function (url) {
return BI.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + url;
}
});
/**
@ -176,19 +105,13 @@ $(function () {
});
},
getImageWidthAndHeight: function (src) {
return BI.requestSync("fr_bi_base", "get_image_size", {
src: src
});
},
isDarkColor: function (hex) {
if (!hex) {
return false;
}
var rgb = this.rgb2json(this.hex2rgb(hex));
var grayLevel = (rgb.r * 0.299 + rgb.g * 0.587 + rgb.b * 0.114);
if (grayLevel < 192) {
var grayLevel = Math.round(rgb.r * 0.299 + rgb.g * 0.587 + rgb.b * 0.114);
if (grayLevel < 140) {
return true;
}
return false;

1
src/core/version.js

@ -0,0 +1 @@
BI.version = "2.0";

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();

2
src/core/wrapper/layout/layout.card.js

@ -63,7 +63,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
isCardExisted: function (cardName) {
return BI.some(this.options.items, function (i, item) {
return item.cardName === cardName && item.el;
return item.cardName == cardName && item.el;
});
},

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;

20
src/widget/pagetable/pagetable.js

@ -78,7 +78,7 @@ BI.PageTable = BI.inherit(BI.Widget, {
this.table = BI.createWidget(o.el, {
type: "bi.sequence_table",
width: o.width,
height: o.height - 30,
height: o.height && o.height - 30,
isNeedResize: true,
isResizeAdapt: false,
@ -202,7 +202,23 @@ BI.PageTable = BI.inherit(BI.Widget, {
setHeight: function (height) {
BI.PageTable.superclass.setHeight.apply(this, arguments);
this.table.setHeight(height - 30);
var showPager = false;
if (this.pager.alwaysShowPager) {
showPager = true;
} else if (this.pager.hasHNext && this.pager.hasHNext()) {
showPager = true;
} else if (this.pager.hasHPrev && this.pager.hasHPrev()) {
showPager = true;
} else if (this.pager.hasVNext && this.pager.hasVNext()) {
showPager = true;
} else if (this.pager.hasVPrev && this.pager.hasVPrev()) {
showPager = true;
} else if (this.pager.hasNext && this.pager.hasNext()) {
showPager = true;
} else if (this.pager.hasPrev && this.pager.hasPrev()) {
showPager = true;
}
this.table.setHeight(height - (showPager ? 30 : 0));
},
setColumnSize: function (columnSize) {

Loading…
Cancel
Save