guy 8 years ago
parent
commit
c774adafec
  1. 27
      bi/core.js
  2. 29
      bi/widget.js
  3. 27
      dist/core.js
  4. 29
      dist/widget.js
  5. 22
      src/core/alias.js
  6. 29
      src/widget/adaptivearrangement/adaptivearrangement.js

27
bi/core.js

@ -3181,7 +3181,14 @@ if (!window.BI) {
}
}
});
})(jQuery);BI.cjkEncode = function (text) {
})(jQuery);;(function () {
function isEmpty(value) {
// 判断是否为空值
var result = value === "" || value === null || value === undefined;
return result;
}
BI.cjkEncode = function (text) {
// alex:如果非字符串,返回其本身(cjkEncode(234) 返回 ""是不对的)
if (typeof text !== 'string') {
return text;
@ -3315,12 +3322,12 @@ BI.jsonEncode = function (o) {
};
BI.contentFormat = function (cv, fmt) {
if (BI.isEmpty(cv)) {
if (isEmpty(cv)) {
//原值为空,返回空字符
return '';
}
var text = cv.toString();
if (BI.isEmpty(fmt)) {
if (isEmpty(fmt)) {
//格式为空,返回原字符
return text;
}
@ -3529,7 +3536,7 @@ BI._dealWithRight = function (tright, fright) {
var c = tright.charAt(j);
switch (ch) {
case '0':
if (BI.isEmpty(c)) {
if (isEmpty(c)) {
c = '0';
}
right += c;
@ -3546,7 +3553,7 @@ BI._dealWithRight = function (tright, fright) {
}
var rll = tright.substr(j);
var result = {};
if (!BI.isEmpty(rll) && rll.charAt(0) > 4) {
if (!isEmpty(rll) && rll.charAt(0) > 4) {
//有多余字符,需要四舍五入
result.leftPlus = true;
var numReg = right.match(/^[0-9]+/);
@ -3600,7 +3607,7 @@ BI._dealWithLeft = function (tleft, fleft) {
var c = tleft.charAt(j);
switch (ch) {
case '0':
if (BI.isEmpty(c)) {
if (isEmpty(c)) {
c = '0';
}
last = -1;
@ -3613,7 +3620,7 @@ BI._dealWithLeft = function (tleft, fleft) {
j--;
break;
case ',':
if (!BI.isEmpty(c)) {
if (!isEmpty(c)) {
//计算一个,分隔区间的长度
var com = fleft.match(/,[#0]+/);
if (com) {
@ -3642,7 +3649,7 @@ BI._dealWithLeft = function (tleft, fleft) {
newstr = res.substr(n, combo) + ',' + newstr;
}
var lres = res.substr(0, n + combo);
if (!BI.isEmpty(lres)) {
if (!isEmpty(lres)) {
newstr = lres + ',' + newstr;
}
}
@ -3771,7 +3778,9 @@ BI._eFormat = function (text, fmt) {
}
}
return text;
};/**
};
})();
/**
* 事件集合
* @class BI.Events
*/

29
bi/widget.js

@ -419,8 +419,10 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
if (o.isNeedResizeContainer) {
var isResizing = false;
var needEnd = false;
var height;
var interval;
var startSize;
var resize = function (e, ui) {
if (isResizing) {
return;
@ -442,20 +444,26 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
minHeight: 20,
helper: "bi-resizer",
autoHide: true,
start: function (e, ui) {
startSize = BI.clone(ui.size);
},
resize: function (e, ui) {
if (ui.size.height >= self.arrangement.container.element.height()) {
if (ui.size.height >= startSize.height - 10) {
resize(e, ui);
} else {
interval && clearInterval(interval);
needEnd = true;
}
},
stop: function (e, ui) {
var size = ui.size;
if (isResizing) {
if (isResizing && !needEnd) {
size.height = height;
}
self.arrangement.setContainerSize(ui.size);
needEnd = false;
isResizing = false;
startSize = null;
interval && clearInterval(interval);
self.fireEvent(BI.AdaptiveArrangement.EVENT_RESIZE);
}
@ -484,17 +492,21 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
return this.arrangement._isEqual.apply(this.arrangement, arguments);
},
_initResizable: function (item) {
var self = this, o = this.options;
item.element.css("zIndex", ++this.zIndex);
item.element.mousedown(function () {
_setSelect: function (item) {
if (!item.element.hasClass("selected")) {
item.element.css("zIndex", ++self.zIndex);
BI.each(self.getAllRegions(), function (i, region) {
item.element.css("zIndex", ++this.zIndex);
BI.each(this.getAllRegions(), function (i, region) {
region.el.element.removeClass("selected");
});
item.element.addClass("selected");
}
},
_initResizable: function (item) {
var self = this, o = this.options;
item.element.css("zIndex", ++this.zIndex);
item.element.mousedown(function () {
self._setSelect(item)
});
o.resizable && item.element.resizable({
handles: "e, s, se",
@ -663,6 +675,7 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
addRegion: function (region, position) {
this._initResizable(region.el);
this._setSelect(region.el);
var self = this, flag;
var old = this.arrangement.getAllRegions();
if (BI.isNotNull(this.position)) {

27
dist/core.js vendored

@ -19846,7 +19846,14 @@ BI.PopoverSection = BI.inherit(BI.Widget, {
}
});
BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";BI.cjkEncode = function (text) {
BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () {
function isEmpty(value) {
// 判断是否为空值
var result = value === "" || value === null || value === undefined;
return result;
}
BI.cjkEncode = function (text) {
// alex:如果非字符串,返回其本身(cjkEncode(234) 返回 ""是不对的)
if (typeof text !== 'string') {
return text;
@ -19980,12 +19987,12 @@ BI.jsonEncode = function (o) {
};
BI.contentFormat = function (cv, fmt) {
if (BI.isEmpty(cv)) {
if (isEmpty(cv)) {
//原值为空,返回空字符
return '';
}
var text = cv.toString();
if (BI.isEmpty(fmt)) {
if (isEmpty(fmt)) {
//格式为空,返回原字符
return text;
}
@ -20194,7 +20201,7 @@ BI._dealWithRight = function (tright, fright) {
var c = tright.charAt(j);
switch (ch) {
case '0':
if (BI.isEmpty(c)) {
if (isEmpty(c)) {
c = '0';
}
right += c;
@ -20211,7 +20218,7 @@ BI._dealWithRight = function (tright, fright) {
}
var rll = tright.substr(j);
var result = {};
if (!BI.isEmpty(rll) && rll.charAt(0) > 4) {
if (!isEmpty(rll) && rll.charAt(0) > 4) {
//有多余字符,需要四舍五入
result.leftPlus = true;
var numReg = right.match(/^[0-9]+/);
@ -20265,7 +20272,7 @@ BI._dealWithLeft = function (tleft, fleft) {
var c = tleft.charAt(j);
switch (ch) {
case '0':
if (BI.isEmpty(c)) {
if (isEmpty(c)) {
c = '0';
}
last = -1;
@ -20278,7 +20285,7 @@ BI._dealWithLeft = function (tleft, fleft) {
j--;
break;
case ',':
if (!BI.isEmpty(c)) {
if (!isEmpty(c)) {
//计算一个,分隔区间的长度
var com = fleft.match(/,[#0]+/);
if (com) {
@ -20307,7 +20314,7 @@ BI._dealWithLeft = function (tleft, fleft) {
newstr = res.substr(n, combo) + ',' + newstr;
}
var lres = res.substr(0, n + combo);
if (!BI.isEmpty(lres)) {
if (!isEmpty(lres)) {
newstr = lres + ',' + newstr;
}
}
@ -20436,7 +20443,9 @@ BI._eFormat = function (text, fmt) {
}
}
return text;
};/**
};
})();
/**
* guy
*
* @class BI.HighlightBehavior

29
dist/widget.js vendored

@ -419,8 +419,10 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
if (o.isNeedResizeContainer) {
var isResizing = false;
var needEnd = false;
var height;
var interval;
var startSize;
var resize = function (e, ui) {
if (isResizing) {
return;
@ -442,20 +444,26 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
minHeight: 20,
helper: "bi-resizer",
autoHide: true,
start: function (e, ui) {
startSize = BI.clone(ui.size);
},
resize: function (e, ui) {
if (ui.size.height >= self.arrangement.container.element.height()) {
if (ui.size.height >= startSize.height - 10) {
resize(e, ui);
} else {
interval && clearInterval(interval);
needEnd = true;
}
},
stop: function (e, ui) {
var size = ui.size;
if (isResizing) {
if (isResizing && !needEnd) {
size.height = height;
}
self.arrangement.setContainerSize(ui.size);
needEnd = false;
isResizing = false;
startSize = null;
interval && clearInterval(interval);
self.fireEvent(BI.AdaptiveArrangement.EVENT_RESIZE);
}
@ -484,17 +492,21 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
return this.arrangement._isEqual.apply(this.arrangement, arguments);
},
_initResizable: function (item) {
var self = this, o = this.options;
item.element.css("zIndex", ++this.zIndex);
item.element.mousedown(function () {
_setSelect: function (item) {
if (!item.element.hasClass("selected")) {
item.element.css("zIndex", ++self.zIndex);
BI.each(self.getAllRegions(), function (i, region) {
item.element.css("zIndex", ++this.zIndex);
BI.each(this.getAllRegions(), function (i, region) {
region.el.element.removeClass("selected");
});
item.element.addClass("selected");
}
},
_initResizable: function (item) {
var self = this, o = this.options;
item.element.css("zIndex", ++this.zIndex);
item.element.mousedown(function () {
self._setSelect(item)
});
o.resizable && item.element.resizable({
handles: "e, s, se",
@ -663,6 +675,7 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
addRegion: function (region, position) {
this._initResizable(region.el);
this._setSelect(region.el);
var self = this, flag;
var old = this.arrangement.getAllRegions();
if (BI.isNotNull(this.position)) {

22
src/core/alias.js

@ -1,3 +1,10 @@
;(function () {
function isEmpty(value) {
// 判断是否为空值
var result = value === "" || value === null || value === undefined;
return result;
}
BI.cjkEncode = function (text) {
// alex:如果非字符串,返回其本身(cjkEncode(234) 返回 ""是不对的)
if (typeof text !== 'string') {
@ -132,12 +139,12 @@ BI.jsonEncode = function (o) {
};
BI.contentFormat = function (cv, fmt) {
if (BI.isEmpty(cv)) {
if (isEmpty(cv)) {
//原值为空,返回空字符
return '';
}
var text = cv.toString();
if (BI.isEmpty(fmt)) {
if (isEmpty(fmt)) {
//格式为空,返回原字符
return text;
}
@ -346,7 +353,7 @@ BI._dealWithRight = function (tright, fright) {
var c = tright.charAt(j);
switch (ch) {
case '0':
if (BI.isEmpty(c)) {
if (isEmpty(c)) {
c = '0';
}
right += c;
@ -363,7 +370,7 @@ BI._dealWithRight = function (tright, fright) {
}
var rll = tright.substr(j);
var result = {};
if (!BI.isEmpty(rll) && rll.charAt(0) > 4) {
if (!isEmpty(rll) && rll.charAt(0) > 4) {
//有多余字符,需要四舍五入
result.leftPlus = true;
var numReg = right.match(/^[0-9]+/);
@ -417,7 +424,7 @@ BI._dealWithLeft = function (tleft, fleft) {
var c = tleft.charAt(j);
switch (ch) {
case '0':
if (BI.isEmpty(c)) {
if (isEmpty(c)) {
c = '0';
}
last = -1;
@ -430,7 +437,7 @@ BI._dealWithLeft = function (tleft, fleft) {
j--;
break;
case ',':
if (!BI.isEmpty(c)) {
if (!isEmpty(c)) {
//计算一个,分隔区间的长度
var com = fleft.match(/,[#0]+/);
if (com) {
@ -459,7 +466,7 @@ BI._dealWithLeft = function (tleft, fleft) {
newstr = res.substr(n, combo) + ',' + newstr;
}
var lres = res.substr(0, n + combo);
if (!BI.isEmpty(lres)) {
if (!isEmpty(lres)) {
newstr = lres + ',' + newstr;
}
}
@ -589,3 +596,4 @@ BI._eFormat = function (text, fmt) {
}
return text;
};
})();

29
src/widget/adaptivearrangement/adaptivearrangement.js

@ -37,8 +37,10 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
if (o.isNeedResizeContainer) {
var isResizing = false;
var needEnd = false;
var height;
var interval;
var startSize;
var resize = function (e, ui) {
if (isResizing) {
return;
@ -60,20 +62,26 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
minHeight: 20,
helper: "bi-resizer",
autoHide: true,
start: function (e, ui) {
startSize = BI.clone(ui.size);
},
resize: function (e, ui) {
if (ui.size.height >= self.arrangement.container.element.height()) {
if (ui.size.height >= startSize.height - 10) {
resize(e, ui);
} else {
interval && clearInterval(interval);
needEnd = true;
}
},
stop: function (e, ui) {
var size = ui.size;
if (isResizing) {
if (isResizing && !needEnd) {
size.height = height;
}
self.arrangement.setContainerSize(ui.size);
needEnd = false;
isResizing = false;
startSize = null;
interval && clearInterval(interval);
self.fireEvent(BI.AdaptiveArrangement.EVENT_RESIZE);
}
@ -102,17 +110,21 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
return this.arrangement._isEqual.apply(this.arrangement, arguments);
},
_initResizable: function (item) {
var self = this, o = this.options;
item.element.css("zIndex", ++this.zIndex);
item.element.mousedown(function () {
_setSelect: function (item) {
if (!item.element.hasClass("selected")) {
item.element.css("zIndex", ++self.zIndex);
BI.each(self.getAllRegions(), function (i, region) {
item.element.css("zIndex", ++this.zIndex);
BI.each(this.getAllRegions(), function (i, region) {
region.el.element.removeClass("selected");
});
item.element.addClass("selected");
}
},
_initResizable: function (item) {
var self = this, o = this.options;
item.element.css("zIndex", ++this.zIndex);
item.element.mousedown(function () {
self._setSelect(item)
});
o.resizable && item.element.resizable({
handles: "e, s, se",
@ -281,6 +293,7 @@ BI.AdaptiveArrangement = BI.inherit(BI.Widget, {
addRegion: function (region, position) {
this._initResizable(region.el);
this._setSelect(region.el);
var self = this, flag;
var old = this.arrangement.getAllRegions();
if (BI.isNotNull(this.position)) {

Loading…
Cancel
Save