|
|
|
@ -17448,6 +17448,53 @@ BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () {
|
|
|
|
|
return newText |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 将cjkEncode处理过的字符串转化为原始字符串 |
|
|
|
|
* |
|
|
|
|
* @static |
|
|
|
|
* @param text 需要做解码的字符串 |
|
|
|
|
* @return {String} 解码后的字符串 |
|
|
|
|
*/ |
|
|
|
|
BI.cjkDecode = function (text) { |
|
|
|
|
if (text == null) { |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
//查找没有 "[", 直接返回. kunsnat:数字的时候, 不支持indexOf方法, 也是直接返回.
|
|
|
|
|
if (!isNaN(text) || text.indexOf('[') == -1) { |
|
|
|
|
return text; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var newText = ""; |
|
|
|
|
for (var i = 0; i < text.length; i++) { |
|
|
|
|
var ch = text.charAt(i); |
|
|
|
|
if (ch == '[') { |
|
|
|
|
var rightIdx = text.indexOf(']', i + 1); |
|
|
|
|
if (rightIdx > i + 1) { |
|
|
|
|
var subText = text.substring(i + 1, rightIdx); |
|
|
|
|
//james:主要是考虑[CDATA[]]这样的值的出现
|
|
|
|
|
if (subText.length > 0) { |
|
|
|
|
ch = String.fromCharCode(eval("0x" + subText)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
i = rightIdx; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
newText += ch; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return newText; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//replace the html special tags
|
|
|
|
|
BI.htmlEncode = function (text) { |
|
|
|
|
return (text == null) ? '' : String(text).replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>'); |
|
|
|
|
}; |
|
|
|
|
//html decode
|
|
|
|
|
BI.htmlDecode = function (text) { |
|
|
|
|
return (text == null) ? '' : String(text).replace(/&/g, '&').replace(/"/g, '\"').replace(/</g, '<').replace(/>/g, '>').replace(/ /g, ' '); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
BI.cjkEncodeDO = function (o) { |
|
|
|
|
if (BI.isPlainObject(o)) { |
|
|
|
|
var result = {}; |
|
|
|
@ -19174,7 +19221,7 @@ BI.extend(jQuery.fn, {
|
|
|
|
|
*/ |
|
|
|
|
__textKeywordMarked__: function (text, keyword, py) { |
|
|
|
|
if (!BI.isKey(keyword) || (text + "").length > 100) { |
|
|
|
|
return this.html(BI.Func.formatSpecialCharInHtml(text)); |
|
|
|
|
return this.html(BI.htmlEncode(text)); |
|
|
|
|
} |
|
|
|
|
keyword = keyword + ""; |
|
|
|
|
keyword = BI.toUpperCase(keyword); |
|
|
|
@ -19197,7 +19244,7 @@ BI.extend(jQuery.fn, {
|
|
|
|
|
if (tidx >= 0) { |
|
|
|
|
this.append(textLeft.substr(0, tidx)); |
|
|
|
|
this.append($("<span>").addClass("bi-keyword-red-mark") |
|
|
|
|
.html(BI.Func.formatSpecialCharInHtml(textLeft.substr(tidx, keyword.length)))); |
|
|
|
|
.html(BI.htmlEncode(textLeft.substr(tidx, keyword.length)))); |
|
|
|
|
|
|
|
|
|
textLeft = textLeft.substr(tidx + keyword.length); |
|
|
|
|
if (py != null) { |
|
|
|
@ -19206,7 +19253,7 @@ BI.extend(jQuery.fn, {
|
|
|
|
|
} else if (pidx != null && pidx >= 0 && Math.floor(pidx / text.length) === Math.floor((pidx + keyword.length - 1) / text.length)) { |
|
|
|
|
this.append(textLeft.substr(0, pidx)); |
|
|
|
|
this.append($("<span>").addClass("bi-keyword-red-mark") |
|
|
|
|
.html(BI.Func.formatSpecialCharInHtml(textLeft.substr(pidx, keyword.length)))); |
|
|
|
|
.html(BI.htmlEncode(textLeft.substr(pidx, keyword.length)))); |
|
|
|
|
if (py != null) { |
|
|
|
|
py = py.substr(pidx + keyword.length); |
|
|
|
|
} |
|
|
|
@ -19811,27 +19858,6 @@ BI.extend(BI.Func, {
|
|
|
|
|
matched: matched, |
|
|
|
|
finded: finded |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 将字符串中的尖括号等字符encode成html能解析的形式 |
|
|
|
|
* @param str |
|
|
|
|
*/ |
|
|
|
|
formatSpecialCharInHtml: function (str) { |
|
|
|
|
return (str + "").replaceAll("\\s|<=?|>=?", function (str) { |
|
|
|
|
switch (str) { |
|
|
|
|
case "<": |
|
|
|
|
return "<"; |
|
|
|
|
case "<=": |
|
|
|
|
return "≤"; |
|
|
|
|
case ">": |
|
|
|
|
return ">"; |
|
|
|
|
case ">=": |
|
|
|
|
return "≥"; |
|
|
|
|
default: |
|
|
|
|
return " "; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
@ -20786,16 +20812,17 @@ Date.prototype.getDayOfYear = function () {
|
|
|
|
|
Date.prototype.getWeekNumber = function () { |
|
|
|
|
var d = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); |
|
|
|
|
//周一是一周第一天
|
|
|
|
|
var week = d.getDay(); |
|
|
|
|
var week = d.getDay() === 0 ? 7 : d.getDay(); |
|
|
|
|
//var week = d.getDay();
|
|
|
|
|
if (this.getMonth() === 0 && this.getDate() <= week) { |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
d.setDate(this.getDate() - week); |
|
|
|
|
d.setDate(this.getDate() - (week - 1)); |
|
|
|
|
var ms = d.valueOf(); // GMT
|
|
|
|
|
d.setMonth(0); |
|
|
|
|
d.setDate(1); |
|
|
|
|
var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1; |
|
|
|
|
if (d.getDay() > 0) { |
|
|
|
|
if (d.getDay() !== 1) { |
|
|
|
|
offset++; |
|
|
|
|
} |
|
|
|
|
return offset; |
|
|
|
@ -20807,17 +20834,17 @@ Date.prototype.getQuarter = function () {
|
|
|
|
|
|
|
|
|
|
//离当前时间多少天的时间
|
|
|
|
|
Date.prototype.getOffsetDate = function (offset) { |
|
|
|
|
return Date.getDate(this.getTime() + offset * 864e5); |
|
|
|
|
return Date.getDate(Date.getTime(this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds()) + offset * 864e5); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
Date.prototype.getAfterMulQuarter = function (n) { |
|
|
|
|
var dt = Date.getDate(this.getTime()); |
|
|
|
|
var dt = Date.getDate(Date.getTime(this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds())); |
|
|
|
|
dt.setMonth(dt.getMonth() + n * 3); |
|
|
|
|
return dt; |
|
|
|
|
}; |
|
|
|
|
//获得n个季度前的日期
|
|
|
|
|
Date.prototype.getBeforeMulQuarter = function (n) { |
|
|
|
|
var dt = Date.getDate(this.getTime()); |
|
|
|
|
var dt = Date.getDate(Date.getTime(this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds())); |
|
|
|
|
dt.setMonth(dt.getMonth() - n * 3); |
|
|
|
|
return dt; |
|
|
|
|
}; |
|
|
|
@ -20849,49 +20876,19 @@ Date.prototype.getQuarterEndDate = function () {
|
|
|
|
|
return Date.getDate(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth)); |
|
|
|
|
}; |
|
|
|
|
Date.prototype.getAfterMultiMonth = function (n) { |
|
|
|
|
var dt = Date.getDate(this.getTime()); |
|
|
|
|
var dt = Date.getDate(Date.getTime(this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds())); |
|
|
|
|
dt.setMonth(dt.getMonth() + n | 0); |
|
|
|
|
return dt; |
|
|
|
|
}; |
|
|
|
|
Date.prototype.getBeforeMultiMonth = function (n) { |
|
|
|
|
var dt = Date.getDate(this.getTime()); |
|
|
|
|
var dt = Date.getDate(Date.getTime(this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds())); |
|
|
|
|
dt.setMonth(dt.getMonth() - n | 0); |
|
|
|
|
return dt; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
Date.prototype.getAfterMulQuarter = function (n) { |
|
|
|
|
var dt = Date.getDate(this.getTime()); |
|
|
|
|
dt.setMonth(dt.getMonth() + n * 3); |
|
|
|
|
return dt; |
|
|
|
|
}; |
|
|
|
|
//获得n个季度前的日期
|
|
|
|
|
Date.prototype.getBeforeMulQuarter = function (n) { |
|
|
|
|
var dt = Date.getDate(this.getTime()); |
|
|
|
|
dt.setMonth(dt.getMonth() - n * 3); |
|
|
|
|
return dt; |
|
|
|
|
}; |
|
|
|
|
//得到本季度的起始月份
|
|
|
|
|
Date.prototype.getQuarterStartMonth = function () { |
|
|
|
|
var quarterStartMonth = 0; |
|
|
|
|
var nowMonth = this.getMonth(); |
|
|
|
|
if (nowMonth < 3) { |
|
|
|
|
quarterStartMonth = 0; |
|
|
|
|
} |
|
|
|
|
if (2 < nowMonth && nowMonth < 6) { |
|
|
|
|
quarterStartMonth = 3; |
|
|
|
|
} |
|
|
|
|
if (5 < nowMonth && nowMonth < 9) { |
|
|
|
|
quarterStartMonth = 6; |
|
|
|
|
} |
|
|
|
|
if (nowMonth > 8) { |
|
|
|
|
quarterStartMonth = 9; |
|
|
|
|
} |
|
|
|
|
return quarterStartMonth; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//指定日期n个月之前或之后的日期
|
|
|
|
|
Date.prototype.getOffsetMonth = function (n) { |
|
|
|
|
var dt = Date.getDate(this.getTime()); |
|
|
|
|
var dt = Date.getDate(Date.getTime(this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds())); |
|
|
|
|
var day = dt.getDate(); |
|
|
|
|
var monthDay = Date.getDate(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays(); |
|
|
|
|
if (day > monthDay) { |
|
|
|
@ -20905,42 +20902,12 @@ Date.prototype.getOffsetMonth = function (n) {
|
|
|
|
|
//获得本周的起始日期
|
|
|
|
|
Date.prototype.getWeekStartDate = function () { |
|
|
|
|
var w = this.getDay(); |
|
|
|
|
return this.getOffsetDate(-w); |
|
|
|
|
return this.getOffsetDate(w === 0 ? -6 : 1 - w); |
|
|
|
|
}; |
|
|
|
|
//得到本周的结束日期
|
|
|
|
|
Date.prototype.getWeekEndDate = function () { |
|
|
|
|
var w = this.getDay(); |
|
|
|
|
var offset = (w === 0 ? 6 : 6 - w); |
|
|
|
|
return this.getOffsetDate(offset); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//获得本季度的起始日期
|
|
|
|
|
Date.prototype.getQuarterStartDate = function () { |
|
|
|
|
return Date.getDate(this.getFullYear(), this.getQuarterStartMonth(), 1); |
|
|
|
|
}; |
|
|
|
|
//得到本季度的结束日期
|
|
|
|
|
Date.prototype.getQuarterEndDate = function () { |
|
|
|
|
var quarterEndMonth = this.getQuarterStartMonth() + 2; |
|
|
|
|
return Date.getDate(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth)); |
|
|
|
|
}; |
|
|
|
|
Date.prototype.getAfterMultiMonth = function (n) { |
|
|
|
|
var dt = Date.getDate(this.getTime()); |
|
|
|
|
dt.setMonth(dt.getMonth() + n | 0); |
|
|
|
|
return dt; |
|
|
|
|
}; |
|
|
|
|
Date.prototype.getBeforeMultiMonth = function (n) { |
|
|
|
|
var dt = Date.getDate(this.getTime()); |
|
|
|
|
dt.setMonth(dt.getMonth() - n | 0); |
|
|
|
|
return dt; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//获得当前时区对应指定时区的时间
|
|
|
|
|
Date.prototype.getTimeZoneTimeByTimezoneOffset = function (offset) { |
|
|
|
|
var dt = Date.getDate(this.getTime()); |
|
|
|
|
var localTime = dt.getTime(); |
|
|
|
|
var localOffset = dt.getTimezoneOffset() * 60000; //获得当地时间偏移的毫秒数
|
|
|
|
|
var utc = localTime + localOffset; //utc即GMT时间标准时区
|
|
|
|
|
return Date.getDate(utc + offset); |
|
|
|
|
return this.getOffsetDate(w === 0 ? 0 : 7 - w); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** Checks date and time equality */ |
|
|
|
@ -21245,6 +21212,15 @@ Date.getDate = function () {
|
|
|
|
|
return dt; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
Date.getTime = function () { |
|
|
|
|
var dt = Function.prototype.bind.apply(Date.getDate, BI.concat([null], [].slice.apply(arguments)))(); |
|
|
|
|
if(BI.isNotNull(Date.timeZone)){ |
|
|
|
|
return dt.getTime() - Date.timeZone - dt.getTimezoneOffset() * 60000; |
|
|
|
|
}else{ |
|
|
|
|
return dt.getTime(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
/* |
|
|
|
|
* 给jQuery.Event对象添加的工具方法 |
|
|
|
|
*/ |
|
|
|
@ -26399,7 +26375,7 @@ BI.Text = BI.inherit(BI.Single, {
|
|
|
|
|
setText: function (text) { |
|
|
|
|
BI.Text.superclass.setText.apply(this, arguments); |
|
|
|
|
this.options.text = text; |
|
|
|
|
this.text.element.html(BI.Func.formatSpecialCharInHtml(text)); |
|
|
|
|
this.text.element.html(BI.htmlEncode(text)); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|