Browse Source

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

* commit 'f1bf2f312352a7b27abea6e83c7758d19070007d':
  selectlist的setEnable对全选无效
  add
  add
  add
  wartermark
es6
guy 7 years ago
parent
commit
390e691879
  1. 608
      bi/base.js
  2. 6
      bi/case.js
  3. 25
      bi/core.js
  4. 5
      bi/widget.js
  5. 608
      docs/base.js
  6. 6
      docs/case.js
  7. 25
      docs/core.js
  8. 5
      docs/widget.js
  9. 6
      src/base/formula/formulaeditor.js
  10. 10
      src/base/single/editor/editor.js
  11. 35
      src/base/table/table.grid.js
  12. 39
      src/base/table/table.grid.quick.js
  13. 1
      src/case/editor/editor.sign.initial.js
  14. 5
      src/case/list/list.select.js
  15. 18
      src/core/base.js
  16. 7
      src/core/widget.js
  17. 5
      src/widget/adaptivearrangement/adaptivearrangement.js

608
bi/base.js

@ -308,163 +308,163 @@ BI.Pane = BI.inherit(BI.Widget, {
} }
}); });
BI.Pane.EVENT_LOADED = "EVENT_LOADED";/** BI.Pane.EVENT_LOADED = "EVENT_LOADED";/**
* guy * guy
* 这仅仅只是一个超类, 所有简单控件的基类 * 这仅仅只是一个超类, 所有简单控件的基类
* 1类的控制 * 1类的控制
* 2title的控制 * 2title的控制
* 3文字超过边界显示3个点 * 3文字超过边界显示3个点
* 4cursor默认pointor * 4cursor默认pointor
* @class BI.Single * @class BI.Single
* @extends BI.Widget * @extends BI.Widget
* @abstract * @abstract
*/ */
BI.Single = BI.inherit(BI.Widget, { BI.Single = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
var conf = BI.Single.superclass._defaultConfig.apply(this, arguments); var conf = BI.Single.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-single", baseCls: (conf.baseCls || "") + " bi-single",
readonly: false, readonly: false,
title: null, title: null,
warningTitle: null, warningTitle: null,
tipType: null, // success或warning tipType: null, // success或warning
value: null value: null
}) })
}, },
_showToolTip: function (e, opt) { _showToolTip: function (e, opt) {
opt || (opt = {}); opt || (opt = {});
var self = this; var self = this;
var type = this.getTipType() || (this.isEnabled() ? "success" : "warning"); var type = this.getTipType() || (this.isEnabled() ? "success" : "warning");
var title = type === "success" ? this.getTitle() : (this.getWarningTitle() || this.getTitle()); var title = type === "success" ? this.getTitle() : (this.getWarningTitle() || this.getTitle());
if (BI.isKey(title)) { if (BI.isKey(title)) {
BI.Tooltips.show(e, this.getName(), title, type, this, opt); BI.Tooltips.show(e, this.getName(), title, type, this, opt);
} }
}, },
_hideTooltip: function () { _hideTooltip: function () {
var self = this; var self = this;
var tooltip = BI.Tooltips.get(this.getName()); var tooltip = BI.Tooltips.get(this.getName());
if (BI.isNotNull(tooltip)) { if (BI.isNotNull(tooltip)) {
tooltip.element.fadeOut(200, function () { tooltip.element.fadeOut(200, function () {
BI.Tooltips.remove(self.getName()); BI.Tooltips.remove(self.getName());
}); });
} }
}, },
_init: function () { _init: function () {
BI.Single.superclass._init.apply(this, arguments); BI.Single.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
if (BI.isKey(o.title) || BI.isKey(o.warningTitle) if (BI.isKey(o.title) || BI.isKey(o.warningTitle)
|| BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) { || BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) {
this.enableHover(); this.enableHover();
} }
}, },
enableHover: function (opt) { enableHover: function (opt) {
opt || (opt = {}); opt || (opt = {});
var self = this; var self = this;
if (!this._hoverBinded) { if (!this._hoverBinded) {
this.element.on("mouseenter.title" + this.getName(), function (e) { this.element.on("mouseenter.title" + this.getName(), function (e) {
self._e = e; self._e = e;
if (self.getTipType() === "warning" || (BI.isKey(self.getWarningTitle()) && !self.isEnabled())) { if (self.getTipType() === "warning" || (BI.isKey(self.getWarningTitle()) && !self.isEnabled())) {
self.timeout = BI.delay(function () { self.timeout = BI.delay(function () {
self._showToolTip(self._e || e, opt); self._showToolTip(self._e || e, opt);
}, 200); }, 200);
} else if (self.getTipType() === "success" || self.isEnabled()) { } else if (self.getTipType() === "success" || self.isEnabled()) {
self.timeout = BI.delay(function () { self.timeout = BI.delay(function () {
self._showToolTip(self._e || e, opt); self._showToolTip(self._e || e, opt);
}, 500); }, 500);
} }
}); });
this.element.on("mousemove.title" + this.getName(), function (e) { this.element.on("mousemove.title" + this.getName(), function (e) {
self._e = e; self._e = e;
if (!self.element.__isMouseInBounds__(e)) { if (!self.element.__isMouseInBounds__(e)) {
if (BI.isNotNull(self.timeout)) { if (BI.isNotNull(self.timeout)) {
clearTimeout(self.timeout); clearTimeout(self.timeout);
} }
self._hideTooltip(); self._hideTooltip();
} }
}); });
this.element.on("mouseleave.title" + this.getName(), function () { this.element.on("mouseleave.title" + this.getName(), function () {
self._e = null; self._e = null;
if (BI.isNotNull(self.timeout)) { if (BI.isNotNull(self.timeout)) {
clearTimeout(self.timeout); clearTimeout(self.timeout);
} }
self._hideTooltip(); self._hideTooltip();
}); });
this._hoverBinded = true; this._hoverBinded = true;
} }
}, },
disabledHover: function () { disabledHover: function () {
//取消hover事件 //取消hover事件
if (BI.isNotNull(this.timeout)) { if (BI.isNotNull(this.timeout)) {
clearTimeout(this.timeout); clearTimeout(this.timeout);
} }
this._hideTooltip(); this._hideTooltip();
$(this.element).unbind("mouseenter.title" + this.getName()) $(this.element).unbind("mouseenter.title" + this.getName())
.unbind("mousemove.title" + this.getName()) .unbind("mousemove.title" + this.getName())
.unbind("mouseleave.title" + this.getName()); .unbind("mouseleave.title" + this.getName());
this._hoverBinded = false; this._hoverBinded = false;
}, },
populate: function (items) { populate: function (items) {
this.items = items || []; this.items = items || [];
}, },
//opt: {container: '', belowMouse: false} //opt: {container: '', belowMouse: false}
setTitle: function (title, opt) { setTitle: function (title, opt) {
this.options.title = title; this.options.title = title;
if (BI.isKey(title)) { if (BI.isKey(title)) {
this.enableHover(opt); this.enableHover(opt);
} else { } else {
this.disabledHover(); this.disabledHover();
} }
}, },
setWarningTitle: function (title, opt) { setWarningTitle: function (title, opt) {
this.options.warningTitle = title; this.options.warningTitle = title;
if (BI.isKey(title)) { if (BI.isKey(title)) {
this.enableHover(opt); this.enableHover(opt);
} else { } else {
this.disabledHover(); this.disabledHover();
} }
}, },
getTipType: function () { getTipType: function () {
return this.options.tipType; return this.options.tipType;
}, },
isReadOnly: function () { isReadOnly: function () {
return !!this.options.readonly; return !!this.options.readonly;
}, },
getTitle: function () { getTitle: function () {
var title = this.options.title; var title = this.options.title;
if(BI.isFunction(title)) { if(BI.isFunction(title)) {
return title(); return title();
} }
return title; return title;
}, },
getWarningTitle: function () { getWarningTitle: function () {
var title = this.options.warningTitle; var title = this.options.warningTitle;
if(BI.isFunction(title)) { if(BI.isFunction(title)) {
return title(); return title();
} }
return title; return title;
}, },
setValue: function (val) { setValue: function (val) {
if (!this.options.readonly) { if (!this.options.readonly) {
this.options.value = val; this.options.value = val;
} }
}, },
getValue: function () { getValue: function () {
return this.options.value; return this.options.value;
} }
});/** });/**
* guy 表示一行数据通过position来定位位置的数据 * guy 表示一行数据通过position来定位位置的数据
* @class BI.Text * @class BI.Text
@ -918,82 +918,82 @@ BI.BasicButton = BI.inherit(BI.Single, {
BI.BasicButton.superclass.destroy.apply(this, arguments); BI.BasicButton.superclass.destroy.apply(this, arguments);
} }
}); });
BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE";/** BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE";/**
* 表示一个可以展开的节点, 不仅有选中状态而且有展开状态 * 表示一个可以展开的节点, 不仅有选中状态而且有展开状态
* *
* Created by GUY on 2015/9/9. * Created by GUY on 2015/9/9.
* @class BI.NodeButton * @class BI.NodeButton
* @extends BI.BasicButton * @extends BI.BasicButton
* @abstract * @abstract
*/ */
BI.NodeButton = BI.inherit(BI.BasicButton, { BI.NodeButton = BI.inherit(BI.BasicButton, {
_defaultConfig: function() { _defaultConfig: function() {
var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments); var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend( conf, { return BI.extend( conf, {
baseCls: (conf.baseCls || "") + " bi-node", baseCls: (conf.baseCls || "") + " bi-node",
open: false open: false
}) })
}, },
_init:function() { _init:function() {
BI.NodeButton.superclass._init.apply(this, arguments); BI.NodeButton.superclass._init.apply(this, arguments);
var self = this; var self = this;
BI.nextTick(function(){ BI.nextTick(function(){
self.setOpened(self.isOpened()); self.setOpened(self.isOpened());
}) })
}, },
doClick: function(){ doClick: function(){
BI.NodeButton.superclass.doClick.apply(this, arguments); BI.NodeButton.superclass.doClick.apply(this, arguments);
this.setOpened(!this.isOpened()); this.setOpened(!this.isOpened());
}, },
isOnce: function(){ isOnce: function(){
return false; return false;
}, },
isOpened: function(){ isOpened: function(){
return !!this.options.open; return !!this.options.open;
}, },
setOpened: function(b){ setOpened: function(b){
this.options.open = !!b; this.options.open = !!b;
}, },
triggerCollapse: function(){ triggerCollapse: function(){
if(this.isOpened()) { if(this.isOpened()) {
this.setOpened(false); this.setOpened(false);
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this);
} }
}, },
triggerExpand: function(){ triggerExpand: function(){
if(!this.isOpened()) { if(!this.isOpened()) {
this.setOpened(true); this.setOpened(true);
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this);
} }
} }
});/** });/**
* guy * guy
* tip提示 * tip提示
* zIndex在10亿级别 * zIndex在10亿级别
* @class BI.Tip * @class BI.Tip
* @extends BI.Single * @extends BI.Single
* @abstract * @abstract
*/ */
BI.Tip = BI.inherit(BI.Single, { BI.Tip = BI.inherit(BI.Single, {
_defaultConfig: function() { _defaultConfig: function() {
var conf = BI.Link.superclass._defaultConfig.apply(this, arguments); var conf = BI.Link.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-tip", baseCls: (conf.baseCls || "") + " bi-tip",
zIndex: BI.zIndex_tip zIndex: BI.zIndex_tip
}) })
}, },
_init : function() { _init : function() {
BI.Tip.superclass._init.apply(this, arguments); BI.Tip.superclass._init.apply(this, arguments);
this.element.css({"zIndex": this.options.zIndex}); this.element.css({"zIndex": this.options.zIndex});
} }
});/** });/**
* Created by GUY on 2015/6/26. * Created by GUY on 2015/6/26.
* @class BI.ButtonGroup * @class BI.ButtonGroup
@ -14351,15 +14351,15 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
_checkWaterMark: function () { _checkWaterMark: function () {
var o = this.options; var o = this.options;
if (!this.disabledWarterMark && BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) { if (!this.disabledWaterMark && BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) {
this.watermark && this.watermark.visible(); this.watermark && this.watermark.visible();
} else { } else {
this.watermark && this.watermark.invisible(); this.watermark && this.watermark.invisible();
} }
}, },
disableWarterMark: function () { disableWaterMark: function () {
this.disabledWarterMark = true; this.disabledWaterMark = true;
this._checkWaterMark(); this._checkWaterMark();
}, },
@ -18111,7 +18111,7 @@ BI.Editor = BI.inherit(BI.Single, {
_checkWaterMark: function () { _checkWaterMark: function () {
var o = this.options; var o = this.options;
if (!this.disabledWarterMark && this.editor.getValue() === "" && BI.isKey(o.watermark)) { if (!this.disabledWaterMark && this.editor.getValue() === "" && BI.isKey(o.watermark)) {
this.watermark && this.watermark.visible(); this.watermark && this.watermark.visible();
} else { } else {
this.watermark && this.watermark.invisible(); this.watermark && this.watermark.invisible();
@ -18149,13 +18149,13 @@ BI.Editor = BI.inherit(BI.Single, {
this._checkError(); this._checkError();
}, },
disableWarterMark: function () { disableWaterMark: function () {
this.disabledWarterMark = true; this.disabledWaterMark = true;
this._checkWaterMark(); this._checkWaterMark();
}, },
enableWarterMark: function () { enableWaterMark: function () {
this.disabledWarterMark = false; this.disabledWaterMark = false;
this._checkWaterMark(); this._checkWaterMark();
}, },
@ -20293,32 +20293,32 @@ BI.Tooltip = BI.inherit(BI.Tip, {
} }
}); });
BI.shortcut("bi.tooltip", BI.Tooltip);/** BI.shortcut("bi.tooltip", BI.Tooltip);/**
* 下拉 * 下拉
* @class BI.Trigger * @class BI.Trigger
* @extends BI.Single * @extends BI.Single
* @abstract * @abstract
*/ */
BI.Trigger = BI.inherit(BI.Single, { BI.Trigger = BI.inherit(BI.Single, {
_defaultConfig: function() { _defaultConfig: function() {
var conf = BI.Trigger.superclass._defaultConfig.apply(this, arguments); var conf = BI.Trigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-trigger cursor-pointer", baseCls: (conf.baseCls || "") + " bi-trigger cursor-pointer",
height: 30 height: 30
}) })
}, },
_init : function() { _init : function() {
BI.Trigger.superclass._init.apply(this, arguments); BI.Trigger.superclass._init.apply(this, arguments);
}, },
setKey: function(){ setKey: function(){
}, },
getKey: function(){ getKey: function(){
} }
});// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. });// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
@ -30103,6 +30103,41 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.contextLayout.attr("items", items); this.contextLayout.attr("items", items);
this.contextLayout.resize(); this.contextLayout.resize();
this.topLeftGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
this.topRightGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
this.bottomLeftGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
this.bottomRightGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
function overscan(grid, w, h, rSize, cSize) {
var rCount = h / rSize;
var cCount = w / cSize;
if (cCount * (120 / rSize) >= 60 || rCount * (120 / cSize) >= 60) {
grid.attr("overscanRowCount", 100);
grid.attr("overscanColumnCount", 100);
}
}
if (freezeColLength > 0) {
overscan(this.topLeftGrid, tlw, tlh, o.headerRowSize, totalLeftColumnSize / freezeColLength);
overscan(this.bottomLeftGrid, blw, blh, o.rowSize, totalLeftColumnSize / freezeColLength);
}
if (o.columnSize.length - freezeColLength > 0) {
overscan(this.topRight, trw, trh, o.headerRowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength));
overscan(this.bottomRightGrid, brw, brh, o.rowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength));
}
this.topLeftGrid._populate(this.header[0]); this.topLeftGrid._populate(this.header[0]);
this.topRightGrid._populate(this.header[1]); this.topRightGrid._populate(this.header[1]);
this.bottomLeftGrid._populate(this.items[0]); this.bottomLeftGrid._populate(this.items[0]);
@ -30329,7 +30364,8 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
_populateTable: function () { _populateTable: function () {
var self = this, o = this.options; var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = []; var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [];
var freezeColLength = this._getFreezeColLength(); var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
@ -30420,6 +30456,42 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
} }
}); });
}); });
this.topLeftGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
this.topRightGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
this.bottomLeftGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
this.bottomRightGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
function overscan(grid, w, h, rSize, cSize) {
var rCount = h / rSize;
var cCount = w / cSize;
if (cCount * (120 / rSize) >= 60 || rCount * (120 / cSize) >= 60) {
grid.attr("overscanRowCount", 100);
grid.attr("overscanColumnCount", 100);
}
}
if (freezeColLength > 0) {
overscan(this.topLeftGrid, otlw, otlh, o.headerRowSize, totalLeftColumnSize / freezeColLength);
overscan(this.bottomLeftGrid, oblw, oblh, o.rowSize, totalLeftColumnSize / freezeColLength);
}
if (o.columnSize.length - freezeColLength > 0) {
overscan(this.topRight, otrw, otrh, o.headerRowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength));
overscan(this.bottomRightGrid, obrw, obrh, o.rowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength));
}
this.topLeftGrid.populate(leftHeader); this.topLeftGrid.populate(leftHeader);
this.topRightGrid.populate(rightHeader); this.topRightGrid.populate(rightHeader);
this.bottomLeftGrid.populate(leftItems); this.bottomLeftGrid.populate(leftItems);

6
bi/case.js

@ -7146,6 +7146,7 @@ BI.SignInitialEditor = BI.inherit(BI.Widget, {
}, },
setState: function (v) { setState: function (v) {
var o = this.options;
this._showHint(); this._showHint();
v = (BI.isEmpty(v) || v == o.text) ? o.text : v + "(" + o.text + ")"; v = (BI.isEmpty(v) || v == o.text) ? o.text : v + "(" + o.text + ")";
this.text.setValue(v); this.text.setValue(v);
@ -8790,6 +8791,11 @@ BI.SelectList = BI.inherit(BI.Widget, {
this._checkAllSelected(); this._checkAllSelected();
}, },
_setEnable: function () {
BI.SelectList.superclass._setEnable.apply(this, arguments);
this.toolbar.setEnable(arguments);
},
resetHeight: function (h) { resetHeight: function (h) {
var toolHeight = ( this.toolbar.element.outerHeight() || 25) * ( this.toolbar.isVisible() ? 1 : 0); var toolHeight = ( this.toolbar.element.outerHeight() || 25) * ( this.toolbar.isVisible() ? 1 : 0);
this.list.resetHeight ? this.list.resetHeight(h - toolHeight) : this.list.resetHeight ? this.list.resetHeight(h - toolHeight) :

25
bi/core.js

@ -2940,10 +2940,7 @@ if (!window.BI) {
return /(msie|trident)/i.test(navigator.userAgent.toLowerCase()); return /(msie|trident)/i.test(navigator.userAgent.toLowerCase());
}, },
isIE9Below: function () { getIEVersion: function () {
if (!BI.isIE()) {
return false;
}
var version = 0; var version = 0;
var agent = navigator.userAgent.toLowerCase(); var agent = navigator.userAgent.toLowerCase();
var v1 = agent.match(/(?:msie\s([\w.]+))/); var v1 = agent.match(/(?:msie\s([\w.]+))/);
@ -2957,7 +2954,18 @@ if (!window.BI) {
} else { } else {
version = 0; version = 0;
} }
return version < 9; return version;
},
isIE9Below: function () {
if (!BI.isIE()) {
return false;
}
return this.getIEVersion() < 9;
},
isIE9: function () {
return this.getIEVersion() === 9;
}, },
isEdge: function () { isEdge: function () {
@ -4672,6 +4680,13 @@ BI.Widget = BI.inherit(BI.OB, {
}, },
attr: function (key, value) { attr: function (key, value) {
var self = this;
if (BI.isPlainObject(key)) {
BI.each(key, function (k, v) {
self.attr(k, v);
})
return;
}
if (BI.isNotNull(value)) { if (BI.isNotNull(value)) {
return this.options[key] = value; return this.options[key] = value;
} }

5
bi/widget.js

@ -629,7 +629,12 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
clearInterval(self._scrollInterval); clearInterval(self._scrollInterval);
self._scrollInterval = null; self._scrollInterval = null;
} }
var count = 0;
self._scrollInterval = setInterval(function () { self._scrollInterval = setInterval(function () {
count++;
if (count <= 3) {
return;
}
var offset = self._getScrollOffset(); var offset = self._getScrollOffset();
var t = offset.top + map[direction][0] * 40; var t = offset.top + map[direction][0] * 40;
var l = offset.left + map[direction][1] * 40; var l = offset.left + map[direction][1] * 40;

608
docs/base.js

@ -308,163 +308,163 @@ BI.Pane = BI.inherit(BI.Widget, {
} }
}); });
BI.Pane.EVENT_LOADED = "EVENT_LOADED";/** BI.Pane.EVENT_LOADED = "EVENT_LOADED";/**
* guy * guy
* 这仅仅只是一个超类, 所有简单控件的基类 * 这仅仅只是一个超类, 所有简单控件的基类
* 1类的控制 * 1类的控制
* 2title的控制 * 2title的控制
* 3文字超过边界显示3个点 * 3文字超过边界显示3个点
* 4cursor默认pointor * 4cursor默认pointor
* @class BI.Single * @class BI.Single
* @extends BI.Widget * @extends BI.Widget
* @abstract * @abstract
*/ */
BI.Single = BI.inherit(BI.Widget, { BI.Single = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
var conf = BI.Single.superclass._defaultConfig.apply(this, arguments); var conf = BI.Single.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-single", baseCls: (conf.baseCls || "") + " bi-single",
readonly: false, readonly: false,
title: null, title: null,
warningTitle: null, warningTitle: null,
tipType: null, // success或warning tipType: null, // success或warning
value: null value: null
}) })
}, },
_showToolTip: function (e, opt) { _showToolTip: function (e, opt) {
opt || (opt = {}); opt || (opt = {});
var self = this; var self = this;
var type = this.getTipType() || (this.isEnabled() ? "success" : "warning"); var type = this.getTipType() || (this.isEnabled() ? "success" : "warning");
var title = type === "success" ? this.getTitle() : (this.getWarningTitle() || this.getTitle()); var title = type === "success" ? this.getTitle() : (this.getWarningTitle() || this.getTitle());
if (BI.isKey(title)) { if (BI.isKey(title)) {
BI.Tooltips.show(e, this.getName(), title, type, this, opt); BI.Tooltips.show(e, this.getName(), title, type, this, opt);
} }
}, },
_hideTooltip: function () { _hideTooltip: function () {
var self = this; var self = this;
var tooltip = BI.Tooltips.get(this.getName()); var tooltip = BI.Tooltips.get(this.getName());
if (BI.isNotNull(tooltip)) { if (BI.isNotNull(tooltip)) {
tooltip.element.fadeOut(200, function () { tooltip.element.fadeOut(200, function () {
BI.Tooltips.remove(self.getName()); BI.Tooltips.remove(self.getName());
}); });
} }
}, },
_init: function () { _init: function () {
BI.Single.superclass._init.apply(this, arguments); BI.Single.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
if (BI.isKey(o.title) || BI.isKey(o.warningTitle) if (BI.isKey(o.title) || BI.isKey(o.warningTitle)
|| BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) { || BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) {
this.enableHover(); this.enableHover();
} }
}, },
enableHover: function (opt) { enableHover: function (opt) {
opt || (opt = {}); opt || (opt = {});
var self = this; var self = this;
if (!this._hoverBinded) { if (!this._hoverBinded) {
this.element.on("mouseenter.title" + this.getName(), function (e) { this.element.on("mouseenter.title" + this.getName(), function (e) {
self._e = e; self._e = e;
if (self.getTipType() === "warning" || (BI.isKey(self.getWarningTitle()) && !self.isEnabled())) { if (self.getTipType() === "warning" || (BI.isKey(self.getWarningTitle()) && !self.isEnabled())) {
self.timeout = BI.delay(function () { self.timeout = BI.delay(function () {
self._showToolTip(self._e || e, opt); self._showToolTip(self._e || e, opt);
}, 200); }, 200);
} else if (self.getTipType() === "success" || self.isEnabled()) { } else if (self.getTipType() === "success" || self.isEnabled()) {
self.timeout = BI.delay(function () { self.timeout = BI.delay(function () {
self._showToolTip(self._e || e, opt); self._showToolTip(self._e || e, opt);
}, 500); }, 500);
} }
}); });
this.element.on("mousemove.title" + this.getName(), function (e) { this.element.on("mousemove.title" + this.getName(), function (e) {
self._e = e; self._e = e;
if (!self.element.__isMouseInBounds__(e)) { if (!self.element.__isMouseInBounds__(e)) {
if (BI.isNotNull(self.timeout)) { if (BI.isNotNull(self.timeout)) {
clearTimeout(self.timeout); clearTimeout(self.timeout);
} }
self._hideTooltip(); self._hideTooltip();
} }
}); });
this.element.on("mouseleave.title" + this.getName(), function () { this.element.on("mouseleave.title" + this.getName(), function () {
self._e = null; self._e = null;
if (BI.isNotNull(self.timeout)) { if (BI.isNotNull(self.timeout)) {
clearTimeout(self.timeout); clearTimeout(self.timeout);
} }
self._hideTooltip(); self._hideTooltip();
}); });
this._hoverBinded = true; this._hoverBinded = true;
} }
}, },
disabledHover: function () { disabledHover: function () {
//取消hover事件 //取消hover事件
if (BI.isNotNull(this.timeout)) { if (BI.isNotNull(this.timeout)) {
clearTimeout(this.timeout); clearTimeout(this.timeout);
} }
this._hideTooltip(); this._hideTooltip();
$(this.element).unbind("mouseenter.title" + this.getName()) $(this.element).unbind("mouseenter.title" + this.getName())
.unbind("mousemove.title" + this.getName()) .unbind("mousemove.title" + this.getName())
.unbind("mouseleave.title" + this.getName()); .unbind("mouseleave.title" + this.getName());
this._hoverBinded = false; this._hoverBinded = false;
}, },
populate: function (items) { populate: function (items) {
this.items = items || []; this.items = items || [];
}, },
//opt: {container: '', belowMouse: false} //opt: {container: '', belowMouse: false}
setTitle: function (title, opt) { setTitle: function (title, opt) {
this.options.title = title; this.options.title = title;
if (BI.isKey(title)) { if (BI.isKey(title)) {
this.enableHover(opt); this.enableHover(opt);
} else { } else {
this.disabledHover(); this.disabledHover();
} }
}, },
setWarningTitle: function (title, opt) { setWarningTitle: function (title, opt) {
this.options.warningTitle = title; this.options.warningTitle = title;
if (BI.isKey(title)) { if (BI.isKey(title)) {
this.enableHover(opt); this.enableHover(opt);
} else { } else {
this.disabledHover(); this.disabledHover();
} }
}, },
getTipType: function () { getTipType: function () {
return this.options.tipType; return this.options.tipType;
}, },
isReadOnly: function () { isReadOnly: function () {
return !!this.options.readonly; return !!this.options.readonly;
}, },
getTitle: function () { getTitle: function () {
var title = this.options.title; var title = this.options.title;
if(BI.isFunction(title)) { if(BI.isFunction(title)) {
return title(); return title();
} }
return title; return title;
}, },
getWarningTitle: function () { getWarningTitle: function () {
var title = this.options.warningTitle; var title = this.options.warningTitle;
if(BI.isFunction(title)) { if(BI.isFunction(title)) {
return title(); return title();
} }
return title; return title;
}, },
setValue: function (val) { setValue: function (val) {
if (!this.options.readonly) { if (!this.options.readonly) {
this.options.value = val; this.options.value = val;
} }
}, },
getValue: function () { getValue: function () {
return this.options.value; return this.options.value;
} }
});/** });/**
* guy 表示一行数据通过position来定位位置的数据 * guy 表示一行数据通过position来定位位置的数据
* @class BI.Text * @class BI.Text
@ -918,82 +918,82 @@ BI.BasicButton = BI.inherit(BI.Single, {
BI.BasicButton.superclass.destroy.apply(this, arguments); BI.BasicButton.superclass.destroy.apply(this, arguments);
} }
}); });
BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE";/** BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE";/**
* 表示一个可以展开的节点, 不仅有选中状态而且有展开状态 * 表示一个可以展开的节点, 不仅有选中状态而且有展开状态
* *
* Created by GUY on 2015/9/9. * Created by GUY on 2015/9/9.
* @class BI.NodeButton * @class BI.NodeButton
* @extends BI.BasicButton * @extends BI.BasicButton
* @abstract * @abstract
*/ */
BI.NodeButton = BI.inherit(BI.BasicButton, { BI.NodeButton = BI.inherit(BI.BasicButton, {
_defaultConfig: function() { _defaultConfig: function() {
var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments); var conf = BI.NodeButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend( conf, { return BI.extend( conf, {
baseCls: (conf.baseCls || "") + " bi-node", baseCls: (conf.baseCls || "") + " bi-node",
open: false open: false
}) })
}, },
_init:function() { _init:function() {
BI.NodeButton.superclass._init.apply(this, arguments); BI.NodeButton.superclass._init.apply(this, arguments);
var self = this; var self = this;
BI.nextTick(function(){ BI.nextTick(function(){
self.setOpened(self.isOpened()); self.setOpened(self.isOpened());
}) })
}, },
doClick: function(){ doClick: function(){
BI.NodeButton.superclass.doClick.apply(this, arguments); BI.NodeButton.superclass.doClick.apply(this, arguments);
this.setOpened(!this.isOpened()); this.setOpened(!this.isOpened());
}, },
isOnce: function(){ isOnce: function(){
return false; return false;
}, },
isOpened: function(){ isOpened: function(){
return !!this.options.open; return !!this.options.open;
}, },
setOpened: function(b){ setOpened: function(b){
this.options.open = !!b; this.options.open = !!b;
}, },
triggerCollapse: function(){ triggerCollapse: function(){
if(this.isOpened()) { if(this.isOpened()) {
this.setOpened(false); this.setOpened(false);
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.COLLAPSE, this.getValue(), this);
} }
}, },
triggerExpand: function(){ triggerExpand: function(){
if(!this.isOpened()) { if(!this.isOpened()) {
this.setOpened(true); this.setOpened(true);
this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this); this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, this.getValue(), this);
} }
} }
});/** });/**
* guy * guy
* tip提示 * tip提示
* zIndex在10亿级别 * zIndex在10亿级别
* @class BI.Tip * @class BI.Tip
* @extends BI.Single * @extends BI.Single
* @abstract * @abstract
*/ */
BI.Tip = BI.inherit(BI.Single, { BI.Tip = BI.inherit(BI.Single, {
_defaultConfig: function() { _defaultConfig: function() {
var conf = BI.Link.superclass._defaultConfig.apply(this, arguments); var conf = BI.Link.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-tip", baseCls: (conf.baseCls || "") + " bi-tip",
zIndex: BI.zIndex_tip zIndex: BI.zIndex_tip
}) })
}, },
_init : function() { _init : function() {
BI.Tip.superclass._init.apply(this, arguments); BI.Tip.superclass._init.apply(this, arguments);
this.element.css({"zIndex": this.options.zIndex}); this.element.css({"zIndex": this.options.zIndex});
} }
});/** });/**
* Created by GUY on 2015/6/26. * Created by GUY on 2015/6/26.
* @class BI.ButtonGroup * @class BI.ButtonGroup
@ -14351,15 +14351,15 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
_checkWaterMark: function () { _checkWaterMark: function () {
var o = this.options; var o = this.options;
if (!this.disabledWarterMark && BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) { if (!this.disabledWaterMark && BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) {
this.watermark && this.watermark.visible(); this.watermark && this.watermark.visible();
} else { } else {
this.watermark && this.watermark.invisible(); this.watermark && this.watermark.invisible();
} }
}, },
disableWarterMark: function () { disableWaterMark: function () {
this.disabledWarterMark = true; this.disabledWaterMark = true;
this._checkWaterMark(); this._checkWaterMark();
}, },
@ -18111,7 +18111,7 @@ BI.Editor = BI.inherit(BI.Single, {
_checkWaterMark: function () { _checkWaterMark: function () {
var o = this.options; var o = this.options;
if (!this.disabledWarterMark && this.editor.getValue() === "" && BI.isKey(o.watermark)) { if (!this.disabledWaterMark && this.editor.getValue() === "" && BI.isKey(o.watermark)) {
this.watermark && this.watermark.visible(); this.watermark && this.watermark.visible();
} else { } else {
this.watermark && this.watermark.invisible(); this.watermark && this.watermark.invisible();
@ -18149,13 +18149,13 @@ BI.Editor = BI.inherit(BI.Single, {
this._checkError(); this._checkError();
}, },
disableWarterMark: function () { disableWaterMark: function () {
this.disabledWarterMark = true; this.disabledWaterMark = true;
this._checkWaterMark(); this._checkWaterMark();
}, },
enableWarterMark: function () { enableWaterMark: function () {
this.disabledWarterMark = false; this.disabledWaterMark = false;
this._checkWaterMark(); this._checkWaterMark();
}, },
@ -20293,32 +20293,32 @@ BI.Tooltip = BI.inherit(BI.Tip, {
} }
}); });
BI.shortcut("bi.tooltip", BI.Tooltip);/** BI.shortcut("bi.tooltip", BI.Tooltip);/**
* 下拉 * 下拉
* @class BI.Trigger * @class BI.Trigger
* @extends BI.Single * @extends BI.Single
* @abstract * @abstract
*/ */
BI.Trigger = BI.inherit(BI.Single, { BI.Trigger = BI.inherit(BI.Single, {
_defaultConfig: function() { _defaultConfig: function() {
var conf = BI.Trigger.superclass._defaultConfig.apply(this, arguments); var conf = BI.Trigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-trigger cursor-pointer", baseCls: (conf.baseCls || "") + " bi-trigger cursor-pointer",
height: 30 height: 30
}) })
}, },
_init : function() { _init : function() {
BI.Trigger.superclass._init.apply(this, arguments); BI.Trigger.superclass._init.apply(this, arguments);
}, },
setKey: function(){ setKey: function(){
}, },
getKey: function(){ getKey: function(){
} }
});// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. });// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
@ -30103,6 +30103,41 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.contextLayout.attr("items", items); this.contextLayout.attr("items", items);
this.contextLayout.resize(); this.contextLayout.resize();
this.topLeftGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
this.topRightGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
this.bottomLeftGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
this.bottomRightGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
function overscan(grid, w, h, rSize, cSize) {
var rCount = h / rSize;
var cCount = w / cSize;
if (cCount * (120 / rSize) >= 60 || rCount * (120 / cSize) >= 60) {
grid.attr("overscanRowCount", 100);
grid.attr("overscanColumnCount", 100);
}
}
if (freezeColLength > 0) {
overscan(this.topLeftGrid, tlw, tlh, o.headerRowSize, totalLeftColumnSize / freezeColLength);
overscan(this.bottomLeftGrid, blw, blh, o.rowSize, totalLeftColumnSize / freezeColLength);
}
if (o.columnSize.length - freezeColLength > 0) {
overscan(this.topRight, trw, trh, o.headerRowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength));
overscan(this.bottomRightGrid, brw, brh, o.rowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength));
}
this.topLeftGrid._populate(this.header[0]); this.topLeftGrid._populate(this.header[0]);
this.topRightGrid._populate(this.header[1]); this.topRightGrid._populate(this.header[1]);
this.bottomLeftGrid._populate(this.items[0]); this.bottomLeftGrid._populate(this.items[0]);
@ -30329,7 +30364,8 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
_populateTable: function () { _populateTable: function () {
var self = this, o = this.options; var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = []; var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [];
var freezeColLength = this._getFreezeColLength(); var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
@ -30420,6 +30456,42 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
} }
}); });
}); });
this.topLeftGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
this.topRightGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
this.bottomLeftGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
this.bottomRightGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
function overscan(grid, w, h, rSize, cSize) {
var rCount = h / rSize;
var cCount = w / cSize;
if (cCount * (120 / rSize) >= 60 || rCount * (120 / cSize) >= 60) {
grid.attr("overscanRowCount", 100);
grid.attr("overscanColumnCount", 100);
}
}
if (freezeColLength > 0) {
overscan(this.topLeftGrid, otlw, otlh, o.headerRowSize, totalLeftColumnSize / freezeColLength);
overscan(this.bottomLeftGrid, oblw, oblh, o.rowSize, totalLeftColumnSize / freezeColLength);
}
if (o.columnSize.length - freezeColLength > 0) {
overscan(this.topRight, otrw, otrh, o.headerRowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength));
overscan(this.bottomRightGrid, obrw, obrh, o.rowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength));
}
this.topLeftGrid.populate(leftHeader); this.topLeftGrid.populate(leftHeader);
this.topRightGrid.populate(rightHeader); this.topRightGrid.populate(rightHeader);
this.bottomLeftGrid.populate(leftItems); this.bottomLeftGrid.populate(leftItems);

6
docs/case.js

@ -7146,6 +7146,7 @@ BI.SignInitialEditor = BI.inherit(BI.Widget, {
}, },
setState: function (v) { setState: function (v) {
var o = this.options;
this._showHint(); this._showHint();
v = (BI.isEmpty(v) || v == o.text) ? o.text : v + "(" + o.text + ")"; v = (BI.isEmpty(v) || v == o.text) ? o.text : v + "(" + o.text + ")";
this.text.setValue(v); this.text.setValue(v);
@ -8790,6 +8791,11 @@ BI.SelectList = BI.inherit(BI.Widget, {
this._checkAllSelected(); this._checkAllSelected();
}, },
_setEnable: function () {
BI.SelectList.superclass._setEnable.apply(this, arguments);
this.toolbar.setEnable(arguments);
},
resetHeight: function (h) { resetHeight: function (h) {
var toolHeight = ( this.toolbar.element.outerHeight() || 25) * ( this.toolbar.isVisible() ? 1 : 0); var toolHeight = ( this.toolbar.element.outerHeight() || 25) * ( this.toolbar.isVisible() ? 1 : 0);
this.list.resetHeight ? this.list.resetHeight(h - toolHeight) : this.list.resetHeight ? this.list.resetHeight(h - toolHeight) :

25
docs/core.js

@ -14082,10 +14082,7 @@ if (!window.BI) {
return /(msie|trident)/i.test(navigator.userAgent.toLowerCase()); return /(msie|trident)/i.test(navigator.userAgent.toLowerCase());
}, },
isIE9Below: function () { getIEVersion: function () {
if (!BI.isIE()) {
return false;
}
var version = 0; var version = 0;
var agent = navigator.userAgent.toLowerCase(); var agent = navigator.userAgent.toLowerCase();
var v1 = agent.match(/(?:msie\s([\w.]+))/); var v1 = agent.match(/(?:msie\s([\w.]+))/);
@ -14099,7 +14096,18 @@ if (!window.BI) {
} else { } else {
version = 0; version = 0;
} }
return version < 9; return version;
},
isIE9Below: function () {
if (!BI.isIE()) {
return false;
}
return this.getIEVersion() < 9;
},
isIE9: function () {
return this.getIEVersion() === 9;
}, },
isEdge: function () { isEdge: function () {
@ -14668,6 +14676,13 @@ BI.Widget = BI.inherit(BI.OB, {
}, },
attr: function (key, value) { attr: function (key, value) {
var self = this;
if (BI.isPlainObject(key)) {
BI.each(key, function (k, v) {
self.attr(k, v);
})
return;
}
if (BI.isNotNull(value)) { if (BI.isNotNull(value)) {
return this.options[key] = value; return this.options[key] = value;
} }

5
docs/widget.js

@ -629,7 +629,12 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
clearInterval(self._scrollInterval); clearInterval(self._scrollInterval);
self._scrollInterval = null; self._scrollInterval = null;
} }
var count = 0;
self._scrollInterval = setInterval(function () { self._scrollInterval = setInterval(function () {
count++;
if (count <= 3) {
return;
}
var offset = self._getScrollOffset(); var offset = self._getScrollOffset();
var t = offset.top + map[direction][0] * 40; var t = offset.top + map[direction][0] * 40;
var l = offset.left + map[direction][1] * 40; var l = offset.left + map[direction][1] * 40;

6
src/base/formula/formulaeditor.js

@ -90,15 +90,15 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
_checkWaterMark: function () { _checkWaterMark: function () {
var o = this.options; var o = this.options;
if (!this.disabledWarterMark && BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) { if (!this.disabledWaterMark && BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) {
this.watermark && this.watermark.visible(); this.watermark && this.watermark.visible();
} else { } else {
this.watermark && this.watermark.invisible(); this.watermark && this.watermark.invisible();
} }
}, },
disableWarterMark: function () { disableWaterMark: function () {
this.disabledWarterMark = true; this.disabledWaterMark = true;
this._checkWaterMark(); this._checkWaterMark();
}, },

10
src/base/single/editor/editor.js

@ -204,7 +204,7 @@ BI.Editor = BI.inherit(BI.Single, {
_checkWaterMark: function () { _checkWaterMark: function () {
var o = this.options; var o = this.options;
if (!this.disabledWarterMark && this.editor.getValue() === "" && BI.isKey(o.watermark)) { if (!this.disabledWaterMark && this.editor.getValue() === "" && BI.isKey(o.watermark)) {
this.watermark && this.watermark.visible(); this.watermark && this.watermark.visible();
} else { } else {
this.watermark && this.watermark.invisible(); this.watermark && this.watermark.invisible();
@ -242,13 +242,13 @@ BI.Editor = BI.inherit(BI.Single, {
this._checkError(); this._checkError();
}, },
disableWarterMark: function () { disableWaterMark: function () {
this.disabledWarterMark = true; this.disabledWaterMark = true;
this._checkWaterMark(); this._checkWaterMark();
}, },
enableWarterMark: function () { enableWaterMark: function () {
this.disabledWarterMark = false; this.disabledWaterMark = false;
this._checkWaterMark(); this._checkWaterMark();
}, },

35
src/base/table/table.grid.js

@ -362,6 +362,41 @@ BI.GridTable = BI.inherit(BI.Widget, {
this.contextLayout.attr("items", items); this.contextLayout.attr("items", items);
this.contextLayout.resize(); this.contextLayout.resize();
this.topLeftGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
this.topRightGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
this.bottomLeftGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
this.bottomRightGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
function overscan(grid, w, h, rSize, cSize) {
var rCount = h / rSize;
var cCount = w / cSize;
if (cCount * (120 / rSize) >= 60 || rCount * (120 / cSize) >= 60) {
grid.attr("overscanRowCount", 100);
grid.attr("overscanColumnCount", 100);
}
}
if (freezeColLength > 0) {
overscan(this.topLeftGrid, tlw, tlh, o.headerRowSize, totalLeftColumnSize / freezeColLength);
overscan(this.bottomLeftGrid, blw, blh, o.rowSize, totalLeftColumnSize / freezeColLength);
}
if (o.columnSize.length - freezeColLength > 0) {
overscan(this.topRight, trw, trh, o.headerRowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength));
overscan(this.bottomRightGrid, brw, brh, o.rowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength));
}
this.topLeftGrid._populate(this.header[0]); this.topLeftGrid._populate(this.header[0]);
this.topRightGrid._populate(this.header[1]); this.topRightGrid._populate(this.header[1]);
this.bottomLeftGrid._populate(this.items[0]); this.bottomLeftGrid._populate(this.items[0]);

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

@ -116,7 +116,8 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
_populateTable: function () { _populateTable: function () {
var self = this, o = this.options; var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = []; var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [];
var freezeColLength = this._getFreezeColLength(); var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) { BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
@ -207,6 +208,42 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
} }
}); });
}); });
this.topLeftGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
this.topRightGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
this.bottomLeftGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
this.bottomRightGrid.attr({
overscanColumnCount: 0,
overscanRowCount: 0
});
function overscan(grid, w, h, rSize, cSize) {
var rCount = h / rSize;
var cCount = w / cSize;
if (cCount * (120 / rSize) >= 60 || rCount * (120 / cSize) >= 60) {
grid.attr("overscanRowCount", 100);
grid.attr("overscanColumnCount", 100);
}
}
if (freezeColLength > 0) {
overscan(this.topLeftGrid, otlw, otlh, o.headerRowSize, totalLeftColumnSize / freezeColLength);
overscan(this.bottomLeftGrid, oblw, oblh, o.rowSize, totalLeftColumnSize / freezeColLength);
}
if (o.columnSize.length - freezeColLength > 0) {
overscan(this.topRight, otrw, otrh, o.headerRowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength));
overscan(this.bottomRightGrid, obrw, obrh, o.rowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength));
}
this.topLeftGrid.populate(leftHeader); this.topLeftGrid.populate(leftHeader);
this.topRightGrid.populate(rightHeader); this.topRightGrid.populate(rightHeader);
this.bottomLeftGrid.populate(leftItems); this.bottomLeftGrid.populate(leftItems);

1
src/case/editor/editor.sign.initial.js

@ -242,6 +242,7 @@ BI.SignInitialEditor = BI.inherit(BI.Widget, {
}, },
setState: function (v) { setState: function (v) {
var o = this.options;
this._showHint(); this._showHint();
v = (BI.isEmpty(v) || v == o.text) ? o.text : v + "(" + o.text + ")"; v = (BI.isEmpty(v) || v == o.text) ? o.text : v + "(" + o.text + ")";
this.text.setValue(v); this.text.setValue(v);

5
src/case/list/list.select.js

@ -158,6 +158,11 @@ BI.SelectList = BI.inherit(BI.Widget, {
this._checkAllSelected(); this._checkAllSelected();
}, },
_setEnable: function () {
BI.SelectList.superclass._setEnable.apply(this, arguments);
this.toolbar.setEnable(arguments);
},
resetHeight: function (h) { resetHeight: function (h) {
var toolHeight = ( this.toolbar.element.outerHeight() || 25) * ( this.toolbar.isVisible() ? 1 : 0); var toolHeight = ( this.toolbar.element.outerHeight() || 25) * ( this.toolbar.isVisible() ? 1 : 0);
this.list.resetHeight ? this.list.resetHeight(h - toolHeight) : this.list.resetHeight ? this.list.resetHeight(h - toolHeight) :

18
src/core/base.js

@ -1048,10 +1048,7 @@ if (!window.BI) {
return /(msie|trident)/i.test(navigator.userAgent.toLowerCase()); return /(msie|trident)/i.test(navigator.userAgent.toLowerCase());
}, },
isIE9Below: function () { getIEVersion: function () {
if (!BI.isIE()) {
return false;
}
var version = 0; var version = 0;
var agent = navigator.userAgent.toLowerCase(); var agent = navigator.userAgent.toLowerCase();
var v1 = agent.match(/(?:msie\s([\w.]+))/); var v1 = agent.match(/(?:msie\s([\w.]+))/);
@ -1065,7 +1062,18 @@ if (!window.BI) {
} else { } else {
version = 0; version = 0;
} }
return version < 9; return version;
},
isIE9Below: function () {
if (!BI.isIE()) {
return false;
}
return this.getIEVersion() < 9;
},
isIE9: function () {
return this.getIEVersion() === 9;
}, },
isEdge: function () { isEdge: function () {

7
src/core/widget.js

@ -343,6 +343,13 @@ BI.Widget = BI.inherit(BI.OB, {
}, },
attr: function (key, value) { attr: function (key, value) {
var self = this;
if (BI.isPlainObject(key)) {
BI.each(key, function (k, v) {
self.attr(k, v);
})
return;
}
if (BI.isNotNull(value)) { if (BI.isNotNull(value)) {
return this.options[key] = value; return this.options[key] = value;
} }

5
src/widget/adaptivearrangement/adaptivearrangement.js

@ -210,7 +210,12 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
clearInterval(self._scrollInterval); clearInterval(self._scrollInterval);
self._scrollInterval = null; self._scrollInterval = null;
} }
var count = 0;
self._scrollInterval = setInterval(function () { self._scrollInterval = setInterval(function () {
count++;
if (count <= 3) {
return;
}
var offset = self._getScrollOffset(); var offset = self._getScrollOffset();
var t = offset.top + map[direction][0] * 40; var t = offset.top + map[direction][0] * 40;
var l = offset.left + map[direction][1] * 40; var l = offset.left + map[direction][1] * 40;

Loading…
Cancel
Save