|
|
|
@ -19906,6 +19906,9 @@ BI.PopoverSection = BI.inherit(BI.Widget, {
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () { |
|
|
|
|
if (!window.BI) { |
|
|
|
|
window.BI = {}; |
|
|
|
|
} |
|
|
|
|
function isEmpty(value) { |
|
|
|
|
// 判断是否为空值
|
|
|
|
|
var result = value === "" || value === null || value === undefined; |
|
|
|
@ -19966,124 +19969,6 @@ BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () {
|
|
|
|
|
return text; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 把日期对象按照指定格式转化成字符串 |
|
|
|
|
* |
|
|
|
|
* @example |
|
|
|
|
* var date = new Date('Thu Dec 12 2013 00:00:00 GMT+0800'); |
|
|
|
|
* var result = BI.date2Str(date, 'yyyy-MM-dd');//2013-12-12
|
|
|
|
|
* |
|
|
|
|
* @class BI.date2Str |
|
|
|
|
* @param date 日期 |
|
|
|
|
* @param format 日期格式 |
|
|
|
|
* @returns {String} |
|
|
|
|
*/ |
|
|
|
|
function date2Str(date, format) { |
|
|
|
|
if (!date) { |
|
|
|
|
return ''; |
|
|
|
|
} |
|
|
|
|
// O(len(format))
|
|
|
|
|
var len = format.length, result = ''; |
|
|
|
|
if (len > 0) { |
|
|
|
|
var flagch = format.charAt(0), start = 0, str = flagch; |
|
|
|
|
for (var i = 1; i < len; i++) { |
|
|
|
|
var ch = format.charAt(i); |
|
|
|
|
if (flagch !== ch) { |
|
|
|
|
result += compileJFmt({ |
|
|
|
|
'char': flagch, |
|
|
|
|
'str': str, |
|
|
|
|
'len': i - start |
|
|
|
|
}, date); |
|
|
|
|
flagch = ch; |
|
|
|
|
start = i; |
|
|
|
|
str = flagch; |
|
|
|
|
} else { |
|
|
|
|
str += ch; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
result += compileJFmt({ |
|
|
|
|
'char': flagch, |
|
|
|
|
'str': str, |
|
|
|
|
'len': len - start |
|
|
|
|
}, date); |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
|
|
|
|
|
function compileJFmt(jfmt, date) { |
|
|
|
|
var str = jfmt.str, len = jfmt.len, ch = jfmt['char']; |
|
|
|
|
switch (ch) { |
|
|
|
|
case 'E': //星期
|
|
|
|
|
str = Date._DN[date.getDay()]; |
|
|
|
|
break; |
|
|
|
|
case 'y': //年
|
|
|
|
|
if (len <= 3) { |
|
|
|
|
str = (date.getFullYear() + '').slice(2, 4); |
|
|
|
|
} else { |
|
|
|
|
str = date.getFullYear(); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'M': //月
|
|
|
|
|
if (len > 2) { |
|
|
|
|
str = Date._MN[date.getMonth()]; |
|
|
|
|
} else if (len < 2) { |
|
|
|
|
str = date.getMonth() + 1; |
|
|
|
|
} else { |
|
|
|
|
str = String.leftPad(date.getMonth() + 1 + '', 2, '0'); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'd': //日
|
|
|
|
|
if (len > 1) { |
|
|
|
|
str = String.leftPad(date.getDate() + '', 2, '0'); |
|
|
|
|
} else { |
|
|
|
|
str = date.getDate(); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'h': //时(12)
|
|
|
|
|
var hour = date.getHours() % 12; |
|
|
|
|
if (hour === 0) { |
|
|
|
|
hour = 12; |
|
|
|
|
} |
|
|
|
|
if (len > 1) { |
|
|
|
|
str = String.leftPad(hour + '', 2, '0'); |
|
|
|
|
} else { |
|
|
|
|
str = hour; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'H': //时(24)
|
|
|
|
|
if (len > 1) { |
|
|
|
|
str = String.leftPad(date.getHours() + '', 2, '0'); |
|
|
|
|
} else { |
|
|
|
|
str = date.getHours(); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'm': |
|
|
|
|
if (len > 1) { |
|
|
|
|
str = String.leftPad(date.getMinutes() + '', 2, '0'); |
|
|
|
|
} else { |
|
|
|
|
str = date.getMinutes(); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 's': |
|
|
|
|
if (len > 1) { |
|
|
|
|
str = String.leftPad(date.getSeconds() + '', 2, '0'); |
|
|
|
|
} else { |
|
|
|
|
str = date.getSeconds(); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'a': |
|
|
|
|
str = date.getHours() < 12 ? 'am' : 'pm'; |
|
|
|
|
break; |
|
|
|
|
case 'z': |
|
|
|
|
str = date.getTimezone(); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
str = jfmt.str; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
return str; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 数字格式 |
|
|
|
|
*/ |
|
|
|
@ -20126,7 +20011,8 @@ BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () {
|
|
|
|
|
} else { |
|
|
|
|
return left + '.' + right; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 处理小数点右边小数部分 |
|
|
|
|
* @param tright 右边内容 |
|
|
|
@ -20170,7 +20056,7 @@ BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () {
|
|
|
|
|
if (newnum.length > orilen) { |
|
|
|
|
newnum = newnum.substr(1); |
|
|
|
|
} else { |
|
|
|
|
newnum = BI.leftPad(newnum, orilen, '0'); |
|
|
|
|
newnum = String.leftPad(newnum, orilen, '0'); |
|
|
|
|
result.leftPlus = false; |
|
|
|
|
} |
|
|
|
|
right = right.replace(/^[0-9]+/, newnum); |
|
|
|
@ -20431,7 +20317,7 @@ BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () {
|
|
|
|
|
|
|
|
|
|
return o; |
|
|
|
|
})(jo); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
BI.contentFormat = function (cv, fmt) { |
|
|
|
|
if (isEmpty(cv)) { |
|
|
|
@ -20473,15 +20359,122 @@ BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () {
|
|
|
|
|
return text; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
BI.leftPad = function (val, size, ch) { |
|
|
|
|
var result = String(val); |
|
|
|
|
if (!ch) { |
|
|
|
|
ch = " "; |
|
|
|
|
/** |
|
|
|
|
* 把日期对象按照指定格式转化成字符串 |
|
|
|
|
* |
|
|
|
|
* @example |
|
|
|
|
* var date = new Date('Thu Dec 12 2013 00:00:00 GMT+0800'); |
|
|
|
|
* var result = BI.date2Str(date, 'yyyy-MM-dd');//2013-12-12
|
|
|
|
|
* |
|
|
|
|
* @class BI.date2Str |
|
|
|
|
* @param date 日期 |
|
|
|
|
* @param format 日期格式 |
|
|
|
|
* @returns {String} |
|
|
|
|
*/ |
|
|
|
|
BI.date2Str = function (date, format) { |
|
|
|
|
if (!date) { |
|
|
|
|
return ''; |
|
|
|
|
} |
|
|
|
|
while (result.length < size) { |
|
|
|
|
result = ch + result; |
|
|
|
|
// O(len(format))
|
|
|
|
|
var len = format.length, result = ''; |
|
|
|
|
if (len > 0) { |
|
|
|
|
var flagch = format.charAt(0), start = 0, str = flagch; |
|
|
|
|
for (var i = 1; i < len; i++) { |
|
|
|
|
var ch = format.charAt(i); |
|
|
|
|
if (flagch !== ch) { |
|
|
|
|
result += compileJFmt({ |
|
|
|
|
'char': flagch, |
|
|
|
|
'str': str, |
|
|
|
|
'len': i - start |
|
|
|
|
}, date); |
|
|
|
|
flagch = ch; |
|
|
|
|
start = i; |
|
|
|
|
str = flagch; |
|
|
|
|
} else { |
|
|
|
|
str += ch; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
result += compileJFmt({ |
|
|
|
|
'char': flagch, |
|
|
|
|
'str': str, |
|
|
|
|
'len': len - start |
|
|
|
|
}, date); |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
|
|
|
|
|
function compileJFmt(jfmt, date) { |
|
|
|
|
var str = jfmt.str, len = jfmt.len, ch = jfmt['char']; |
|
|
|
|
switch (ch) { |
|
|
|
|
case 'E': //星期
|
|
|
|
|
str = Date._DN[date.getDay()]; |
|
|
|
|
break; |
|
|
|
|
case 'y': //年
|
|
|
|
|
if (len <= 3) { |
|
|
|
|
str = (date.getFullYear() + '').slice(2, 4); |
|
|
|
|
} else { |
|
|
|
|
str = date.getFullYear(); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'M': //月
|
|
|
|
|
if (len > 2) { |
|
|
|
|
str = Date._MN[date.getMonth()]; |
|
|
|
|
} else if (len < 2) { |
|
|
|
|
str = date.getMonth() + 1; |
|
|
|
|
} else { |
|
|
|
|
str = String.leftPad(date.getMonth() + 1 + '', 2, '0'); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'd': //日
|
|
|
|
|
if (len > 1) { |
|
|
|
|
str = String.leftPad(date.getDate() + '', 2, '0'); |
|
|
|
|
} else { |
|
|
|
|
str = date.getDate(); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'h': //时(12)
|
|
|
|
|
var hour = date.getHours() % 12; |
|
|
|
|
if (hour === 0) { |
|
|
|
|
hour = 12; |
|
|
|
|
} |
|
|
|
|
if (len > 1) { |
|
|
|
|
str = String.leftPad(hour + '', 2, '0'); |
|
|
|
|
} else { |
|
|
|
|
str = hour; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'H': //时(24)
|
|
|
|
|
if (len > 1) { |
|
|
|
|
str = String.leftPad(date.getHours() + '', 2, '0'); |
|
|
|
|
} else { |
|
|
|
|
str = date.getHours(); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'm': |
|
|
|
|
if (len > 1) { |
|
|
|
|
str = String.leftPad(date.getMinutes() + '', 2, '0'); |
|
|
|
|
} else { |
|
|
|
|
str = date.getMinutes(); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 's': |
|
|
|
|
if (len > 1) { |
|
|
|
|
str = String.leftPad(date.getSeconds() + '', 2, '0'); |
|
|
|
|
} else { |
|
|
|
|
str = date.getSeconds(); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'a': |
|
|
|
|
str = date.getHours() < 12 ? 'am' : 'pm'; |
|
|
|
|
break; |
|
|
|
|
case 'z': |
|
|
|
|
str = date.getTimezone(); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
str = jfmt.str; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
return str; |
|
|
|
|
} |
|
|
|
|
return result.toString(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
BI.object2Number = function (value) { |
|
|
|
@ -23528,7 +23521,6 @@ Date._QN = ["", BI.i18nText("BI-Quarter_1"),
|
|
|
|
|
BI.i18nText("BI-Quarter_3"), |
|
|
|
|
BI.i18nText("BI-Quarter_4")]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Adds the number of days array to the Date object. */ |
|
|
|
|
Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; |
|
|
|
|
|
|
|
|
@ -24002,7 +23994,8 @@ Date.parseDateTime = function (str, fmt) {
|
|
|
|
|
return new Date(y, m, d, hr, min, sec); |
|
|
|
|
} |
|
|
|
|
return today; |
|
|
|
|
};/* |
|
|
|
|
}; |
|
|
|
|
/* |
|
|
|
|
* 给jQuery.Event对象添加的工具方法 |
|
|
|
|
*/ |
|
|
|
|
$.extend($.Event.prototype, { |
|
|
|
|