|
|
|
@ -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; |
|
|
|
@ -19863,9 +19870,9 @@ BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";BI.cjkEncode = function (text) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return newText |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
BI.cjkEncodeDO = function (o) { |
|
|
|
|
BI.cjkEncodeDO = function (o) { |
|
|
|
|
if (BI.isPlainObject(o)) { |
|
|
|
|
var result = {}; |
|
|
|
|
$.each(o, function (k, v) { |
|
|
|
@ -19879,9 +19886,9 @@ BI.cjkEncodeDO = function (o) {
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
return o; |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
BI.jsonEncode = function (o) { |
|
|
|
|
BI.jsonEncode = function (o) { |
|
|
|
|
//james:这个Encode是抄的EXT的
|
|
|
|
|
var useHasOwn = {}.hasOwnProperty ? true : false; |
|
|
|
|
|
|
|
|
@ -19977,15 +19984,15 @@ BI.jsonEncode = function (o) {
|
|
|
|
|
a.push("}"); |
|
|
|
|
return a.join(""); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
BI.contentFormat = function (cv, fmt) { |
|
|
|
|
if (BI.isEmpty(cv)) { |
|
|
|
|
BI.contentFormat = function (cv, fmt) { |
|
|
|
|
if (isEmpty(cv)) { |
|
|
|
|
//原值为空,返回空字符
|
|
|
|
|
return ''; |
|
|
|
|
} |
|
|
|
|
var text = cv.toString(); |
|
|
|
|
if (BI.isEmpty(fmt)) { |
|
|
|
|
if (isEmpty(fmt)) { |
|
|
|
|
//格式为空,返回原字符
|
|
|
|
|
return text; |
|
|
|
|
} |
|
|
|
@ -20017,9 +20024,9 @@ BI.contentFormat = function (cv, fmt) {
|
|
|
|
|
//¤ - 货币格式
|
|
|
|
|
text = text.replace(/¤/g, '¥'); |
|
|
|
|
return text; |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
/** |
|
|
|
|
* 把日期对象按照指定格式转化成字符串 |
|
|
|
|
* |
|
|
|
|
* @example |
|
|
|
@ -20031,7 +20038,7 @@ BI.contentFormat = function (cv, fmt) {
|
|
|
|
|
* @param format 日期格式 |
|
|
|
|
* @returns {String} |
|
|
|
|
*/ |
|
|
|
|
date2Str = function (date, format) { |
|
|
|
|
date2Str = function (date, format) { |
|
|
|
|
if (!date) { |
|
|
|
|
return ''; |
|
|
|
|
} |
|
|
|
@ -20135,12 +20142,12 @@ date2Str = function (date, format) {
|
|
|
|
|
} |
|
|
|
|
return str; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
/** |
|
|
|
|
* 数字格式 |
|
|
|
|
*/ |
|
|
|
|
BI._numberFormat = function (text, format) { |
|
|
|
|
BI._numberFormat = function (text, format) { |
|
|
|
|
var text = text + ''; |
|
|
|
|
//数字格式,区分正负数
|
|
|
|
|
var numMod = format.indexOf(';'); |
|
|
|
@ -20179,22 +20186,22 @@ BI._numberFormat = function (text, format) {
|
|
|
|
|
} else { |
|
|
|
|
return left + '.' + right; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
/** |
|
|
|
|
}; |
|
|
|
|
/** |
|
|
|
|
* 处理小数点右边小数部分 |
|
|
|
|
* @param tright 右边内容 |
|
|
|
|
* @param fright 右边格式 |
|
|
|
|
* @returns {JSON} 返回处理结果和整数部分是否需要进位 |
|
|
|
|
* @private |
|
|
|
|
*/ |
|
|
|
|
BI._dealWithRight = function (tright, fright) { |
|
|
|
|
BI._dealWithRight = function (tright, fright) { |
|
|
|
|
var right = '', j = 0, i = 0; |
|
|
|
|
for (var len = fright.length; i < len; i++) { |
|
|
|
|
var ch = fright.charAt(i); |
|
|
|
|
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]+/); |
|
|
|
@ -20231,13 +20238,13 @@ BI._dealWithRight = function (tright, fright) {
|
|
|
|
|
} |
|
|
|
|
result.num = right; |
|
|
|
|
return result; |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
BI.parseINT = function (str) { |
|
|
|
|
BI.parseINT = function (str) { |
|
|
|
|
return parseInt(str, 10); |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
BI.leftPad = function (val, size, ch) { |
|
|
|
|
BI.leftPad = function (val, size, ch) { |
|
|
|
|
var result = String(val); |
|
|
|
|
if (!ch) { |
|
|
|
|
ch = " "; |
|
|
|
@ -20246,16 +20253,16 @@ BI.leftPad = function (val, size, ch) {
|
|
|
|
|
result = ch + result; |
|
|
|
|
} |
|
|
|
|
return result.toString(); |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
/** |
|
|
|
|
* 处理小数点左边整数部分 |
|
|
|
|
* @param tleft 左边内容 |
|
|
|
|
* @param fleft 左边格式 |
|
|
|
|
* @returns {string} 返回处理结果 |
|
|
|
|
* @private |
|
|
|
|
*/ |
|
|
|
|
BI._dealWithLeft = function (tleft, fleft) { |
|
|
|
|
BI._dealWithLeft = function (tleft, fleft) { |
|
|
|
|
var left = ''; |
|
|
|
|
var j = tleft.length - 1; |
|
|
|
|
var combo = -1, last = -1; |
|
|
|
@ -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,16 +20314,16 @@ 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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
left = left.replace(/[0-9]+,/, newstr); |
|
|
|
|
} |
|
|
|
|
return left; |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
BI.object2Number = function (value) { |
|
|
|
|
BI.object2Number = function (value) { |
|
|
|
|
if (value == null) { |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
@ -20330,9 +20337,9 @@ BI.object2Number = function (value) {
|
|
|
|
|
return parseFloat(str); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
BI.object2Date = function (obj) { |
|
|
|
|
BI.object2Date = function (obj) { |
|
|
|
|
if (obj == null) { |
|
|
|
|
return new Date(); |
|
|
|
|
} |
|
|
|
@ -20350,13 +20357,13 @@ BI.object2Date = function (obj) {
|
|
|
|
|
|
|
|
|
|
return new Date(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
BI.isArray = function (a) { |
|
|
|
|
BI.isArray = function (a) { |
|
|
|
|
return Object.prototype.toString.call(a) == '[object Array]'; |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
BI.object2Time = function (obj) { |
|
|
|
|
BI.object2Time = function (obj) { |
|
|
|
|
if (obj == null) { |
|
|
|
|
return new Date(); |
|
|
|
|
} |
|
|
|
@ -20381,18 +20388,18 @@ BI.object2Time = function (obj) {
|
|
|
|
|
} |
|
|
|
|
return new Date(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// 判断是否是无效的日期
|
|
|
|
|
BI.isInvalidDate = function (date) { |
|
|
|
|
BI.isInvalidDate = function (date) { |
|
|
|
|
return date == "Invalid Date" || date == "NaN"; |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
/** |
|
|
|
|
* 科学计数格式 |
|
|
|
|
*/ |
|
|
|
|
BI._eFormat = function (text, fmt) { |
|
|
|
|
BI._eFormat = function (text, fmt) { |
|
|
|
|
var e = fmt.indexOf("E"); |
|
|
|
|
var eleft = fmt.substr(0, e), eright = fmt.substr(e + 1); |
|
|
|
|
if (/^[0\.-]+$/.test(text)) { |
|
|
|
@ -20436,7 +20443,9 @@ BI._eFormat = function (text, fmt) {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return text; |
|
|
|
|
};/** |
|
|
|
|
}; |
|
|
|
|
})(); |
|
|
|
|
/** |
|
|
|
|
* guy |
|
|
|
|
* |
|
|
|
|
* @class BI.HighlightBehavior |
|
|
|
|