guy 7 years ago
parent
commit
306fbea7a4
  1. 2831
      dist/bundle.js
  2. 4
      dist/bundle.min.js
  3. 2831
      dist/core.js
  4. 2
      src/core/action/action.js
  5. 234
      src/core/alias.js
  6. 118
      src/core/base.js
  7. 2
      src/core/behavior/behavior.highlight.js
  8. 2
      src/core/behavior/behavior.js
  9. 2
      src/core/behavior/behavior.redmark.js
  10. 2
      src/core/controller.js
  11. 2
      src/core/controller/controller.broadcast.js
  12. 4
      src/core/controller/controller.floatbox.js
  13. 2
      src/core/controller/controller.layer.js
  14. 2
      src/core/controller/controller.resizer.js
  15. 130
      src/core/events.js
  16. 42
      src/core/func/dom.js
  17. 25
      src/core/func/function.js
  18. 31
      src/core/inject.js
  19. 150
      src/core/jquery.js
  20. 2
      src/core/listener/listener.show.js
  21. 6
      src/core/loader/loader.style.js
  22. 2
      src/core/logic/logic.js
  23. 8
      src/core/logic/logic.layout.js
  24. 8
      src/core/ob.js
  25. 3
      src/core/plugin.js
  26. 38
      src/core/proto/date.js
  27. 4
      src/core/proto/function.js
  28. 21
      src/core/proto/jquery.js
  29. 46
      src/core/proto/number.js
  30. 8
      src/core/proto/string.js
  31. 124
      src/core/underscore.js
  32. 4
      src/core/utils/base64.js
  33. 4
      src/core/utils/cache.js
  34. 40
      src/core/utils/cellSizeAndPositionManager.js
  35. 750
      src/core/utils/chinesePY.js
  36. 81
      src/core/utils/detectElementResize.js
  37. 8
      src/core/utils/events/eventlistener.js
  38. 4
      src/core/utils/events/mousemovetracker.js
  39. 32
      src/core/utils/events/wheelhandler.js
  40. 4
      src/core/utils/heap.js
  41. 4
      src/core/utils/helper.scroll.js
  42. 10
      src/core/utils/linkedHashMap.js
  43. 22
      src/core/utils/load.js
  44. 14
      src/core/utils/lru.js
  45. 13
      src/core/utils/md5.js
  46. 2
      src/core/utils/prefixIntervalTree.js
  47. 8
      src/core/utils/queue.js
  48. 16
      src/core/utils/sectionManager.js
  49. 4
      src/core/utils/tableRowBuffer.js
  50. 16
      src/core/utils/tree.js
  51. 102
      src/core/var.js
  52. 8
      src/core/widget.js
  53. 38
      src/core/wrapper/layout.js
  54. 14
      src/core/wrapper/layout/adapt/absolute.center.js
  55. 10
      src/core/wrapper/layout/adapt/absolute.horizontal.js
  56. 14
      src/core/wrapper/layout/adapt/absolute.vertical.js
  57. 32
      src/core/wrapper/layout/adapt/adapt.center.js
  58. 28
      src/core/wrapper/layout/adapt/adapt.horizontal.js
  59. 12
      src/core/wrapper/layout/adapt/adapt.leftrightvertical.js
  60. 32
      src/core/wrapper/layout/adapt/adapt.vertical.js
  61. 14
      src/core/wrapper/layout/adapt/auto.horizontal.js
  62. 4
      src/core/wrapper/layout/adapt/float.center.js
  63. 2
      src/core/wrapper/layout/adapt/float.horizontal.js
  64. 4
      src/core/wrapper/layout/flex/flex.center.js
  65. 12
      src/core/wrapper/layout/flex/flex.horizontal.js
  66. 12
      src/core/wrapper/layout/flex/flex.vertical.center.js
  67. 4
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.center.js
  68. 12
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
  69. 12
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.center.js
  70. 34
      src/core/wrapper/layout/layout.absolute.js
  71. 32
      src/core/wrapper/layout/layout.adaptive.js
  72. 38
      src/core/wrapper/layout/layout.border.js
  73. 26
      src/core/wrapper/layout/layout.card.js
  74. 10
      src/core/wrapper/layout/layout.default.js
  75. 20
      src/core/wrapper/layout/layout.division.js
  76. 20
      src/core/wrapper/layout/layout.flow.js
  77. 18
      src/core/wrapper/layout/layout.grid.js
  78. 40
      src/core/wrapper/layout/layout.horizontal.js
  79. 6
      src/core/wrapper/layout/layout.lattice.js
  80. 22
      src/core/wrapper/layout/layout.table.js
  81. 48
      src/core/wrapper/layout/layout.tape.js
  82. 36
      src/core/wrapper/layout/layout.td.js
  83. 12
      src/core/wrapper/layout/layout.vertical.js
  84. 26
      src/core/wrapper/layout/layout.window.js
  85. 4
      src/core/wrapper/layout/middle/middle.center.js
  86. 6
      src/core/wrapper/layout/middle/middle.float.center.js
  87. 6
      src/core/wrapper/layout/middle/middle.horizontal.js
  88. 6
      src/core/wrapper/layout/middle/middle.vertical.js

2831
dist/bundle.js vendored

File diff suppressed because one or more lines are too long

4
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

2831
dist/core.js vendored

File diff suppressed because one or more lines are too long

2
src/core/action/action.js

@ -36,4 +36,4 @@ BI.ActionFactory = {
} }
return new action(options); return new action(options);
} }
} };

234
src/core/alias.js

@ -1,4 +1,4 @@
;(function () { (function () {
if (!window.BI) { if (!window.BI) {
window.BI = {}; window.BI = {};
} }
@ -20,22 +20,22 @@
var e = fmt.indexOf("E"); var e = fmt.indexOf("E");
var eleft = fmt.substr(0, e), eright = fmt.substr(e + 1); var eleft = fmt.substr(0, e), eright = fmt.substr(e + 1);
if (/^[0\.-]+$/.test(text)) { if (/^[0\.-]+$/.test(text)) {
text = BI._numberFormat(0.0, eleft) + 'E' + BI._numberFormat(0, eright) text = BI._numberFormat(0.0, eleft) + "E" + BI._numberFormat(0, eright);
} else { } else {
var isNegative = text < 0; var isNegative = text < 0;
if (isNegative) { if (isNegative) {
text = text.substr(1); text = text.substr(1);
} }
var elvl = (eleft.split('.')[0] || '').length; var elvl = (eleft.split(".")[0] || "").length;
var point = text.indexOf("."); var point = text.indexOf(".");
if (point < 0) { if (point < 0) {
point = text.length; point = text.length;
} }
var i = 0; // 第一个不为0的数的位置 var i = 0; // 第一个不为0的数的位置
text = text.replace('.', ''); text = text.replace(".", "");
for (var len = text.length; i < len; i++) { for (var len = text.length; i < len; i++) {
var ech = text.charAt(i); var ech = text.charAt(i);
if (ech <= '9' && ech >= '1') { if (ech <= "9" && ech >= "1") {
break; break;
} }
} }
@ -45,18 +45,18 @@
if (dis > 0) { if (dis > 0) {
// 末位补全0 // 末位补全0
for (var k = 0; k < dis; k++) { for (var k = 0; k < dis; k++) {
left += '0'; left += "0";
} }
} else { } else {
left += '.' + text.substr(i + elvl); left += "." + text.substr(i + elvl);
} }
left = left.replace(/^[0]+/, ''); left = left.replace(/^[0]+/, "");
if (right < 0 && eright.indexOf('-') < 0) { if (right < 0 && eright.indexOf("-") < 0) {
eright += ';-' + eright; eright += ";-" + eright;
} }
text = BI._numberFormat(left, eleft) + 'E' + BI._numberFormat(right, eright); text = BI._numberFormat(left, eleft) + "E" + BI._numberFormat(right, eright);
if (isNegative) { if (isNegative) {
text = '-' + text; text = "-" + text;
} }
} }
return text; return text;
@ -66,49 +66,49 @@
* 数字格式 * 数字格式
*/ */
function _numberFormat (text, format) { function _numberFormat (text, format) {
var text = text + ''; var text = text + "";
// 数字格式,区分正负数 // 数字格式,区分正负数
var numMod = format.indexOf(';'); var numMod = format.indexOf(";");
if (numMod > -1) { if (numMod > -1) {
if (text >= 0) { if (text >= 0) {
return _numberFormat(text + "", format.substring(0, numMod)); return _numberFormat(text + "", format.substring(0, numMod));
} else { }
return _numberFormat((-text) + "", format.substr(numMod + 1)); return _numberFormat((-text) + "", format.substr(numMod + 1));
} }
} else {
// 兼容格式处理负数的情况(copy:fr-jquery.format.js) // 兼容格式处理负数的情况(copy:fr-jquery.format.js)
if (+text < 0 && format.charAt(0) !== '-') { if (+text < 0 && format.charAt(0) !== "-") {
return _numberFormat((-text) + "", '-' + format); return _numberFormat((-text) + "", "-" + format);
} }
}
var tp = text.split('.'), fp = format.split('.'), var tp = text.split("."), fp = format.split("."),
tleft = tp[0] || '', fleft = fp[0] || '', tleft = tp[0] || "", fleft = fp[0] || "",
tright = tp[1] || '', fright = fp[1] || ''; tright = tp[1] || "", fright = fp[1] || "";
// 百分比,千分比的小数点移位处理 // 百分比,千分比的小数点移位处理
if (/[%‰]$/.test(format)) { if (/[%‰]$/.test(format)) {
var paddingZero = /[%]$/.test(format) ? '00' : '000'; var paddingZero = /[%]$/.test(format) ? "00" : "000";
tright += paddingZero; tright += paddingZero;
tleft += tright.substr(0, paddingZero.length); tleft += tright.substr(0, paddingZero.length);
tleft = tleft.replace(/^0+/gi, ''); tleft = tleft.replace(/^0+/gi, "");
tright = tright.substr(paddingZero.length).replace(/0+$/gi, ''); tright = tright.substr(paddingZero.length).replace(/0+$/gi, "");
} }
var right = _dealWithRight(tright, fright); var right = _dealWithRight(tright, fright);
if (right.leftPlus) { if (right.leftPlus) {
// 小数点后有进位 // 小数点后有进位
tleft = parseInt(tleft) + 1 + ''; tleft = parseInt(tleft) + 1 + "";
tleft = isNaN(tleft) ? '1' : tleft; tleft = isNaN(tleft) ? "1" : tleft;
} }
right = right.num; right = right.num;
var left = _dealWithLeft(tleft, fleft); var left = _dealWithLeft(tleft, fleft);
if (!(/[0-9]/.test(left))) { if (!(/[0-9]/.test(left))) {
left = left + '0'; left = left + "0";
} }
if (!(/[0-9]/.test(right))) { if (!(/[0-9]/.test(right))) {
return left + right; return left + right;
} else {
return left + '.' + right;
} }
return left + "." + right;
} }
/** /**
@ -119,19 +119,19 @@
* @private * @private
*/ */
function _dealWithRight (tright, fright) { function _dealWithRight (tright, fright) {
var right = '', j = 0, i = 0; var right = "", j = 0, i = 0;
for (var len = fright.length; i < len; i++) { for (var len = fright.length; i < len; i++) {
var ch = fright.charAt(i); var ch = fright.charAt(i);
var c = tright.charAt(j); var c = tright.charAt(j);
switch (ch) { switch (ch) {
case '0': case "0":
if (isEmpty(c)) { if (isEmpty(c)) {
c = '0'; c = "0";
} }
right += c; right += c;
j++; j++;
break; break;
case '#': case "#":
right += c; right += c;
j++; j++;
break; break;
@ -149,12 +149,12 @@
if (numReg) { if (numReg) {
var num = numReg[0]; var num = numReg[0];
var orilen = num.length; var orilen = num.length;
var newnum = parseInt(num) + 1 + ''; var newnum = parseInt(num) + 1 + "";
// 进位到整数部分 // 进位到整数部分
if (newnum.length > orilen) { if (newnum.length > orilen) {
newnum = newnum.substr(1); newnum = newnum.substr(1);
} else { } else {
newnum = String.leftPad(newnum, orilen, '0'); newnum = String.leftPad(newnum, orilen, "0");
result.leftPlus = false; result.leftPlus = false;
} }
right = right.replace(/^[0-9]+/, newnum); right = right.replace(/^[0-9]+/, newnum);
@ -172,7 +172,7 @@
* @private * @private
*/ */
function _dealWithLeft (tleft, fleft) { function _dealWithLeft (tleft, fleft) {
var left = ''; var left = "";
var j = tleft.length - 1; var j = tleft.length - 1;
var combo = -1, last = -1; var combo = -1, last = -1;
var i = fleft.length - 1; var i = fleft.length - 1;
@ -180,27 +180,27 @@
var ch = fleft.charAt(i); var ch = fleft.charAt(i);
var c = tleft.charAt(j); var c = tleft.charAt(j);
switch (ch) { switch (ch) {
case '0': case "0":
if (isEmpty(c)) { if (isEmpty(c)) {
c = '0'; c = "0";
} }
last = -1; last = -1;
left = c + left; left = c + left;
j--; j--;
break; break;
case '#': case "#":
last = i; last = i;
left = c + left; left = c + left;
j--; j--;
break; break;
case ',': case ",":
if (!isEmpty(c)) { if (!isEmpty(c)) {
// 计算一个,分隔区间的长度 // 计算一个,分隔区间的长度
var com = fleft.match(/,[#0]+/); var com = fleft.match(/,[#0]+/);
if (com) { if (com) {
combo = com[0].length - 1; combo = com[0].length - 1;
} }
left = ',' + left; left = "," + left;
} }
break; break;
default : default :
@ -218,13 +218,13 @@
var res = left.match(/[0-9]+,/); var res = left.match(/[0-9]+,/);
if (res) { if (res) {
res = res[0]; res = res[0];
var newstr = '', n = res.length - 1 - combo; var newstr = "", n = res.length - 1 - combo;
for (; n >= 0; n = n - combo) { for (; n >= 0; n = n - combo) {
newstr = res.substr(n, combo) + ',' + newstr; newstr = res.substr(n, combo) + "," + newstr;
} }
var lres = res.substr(0, n + combo); var lres = res.substr(0, n + combo);
if (!isEmpty(lres)) { if (!isEmpty(lres)) {
newstr = lres + ',' + newstr; newstr = lres + "," + newstr;
} }
} }
left = left.replace(/[0-9]+,/, newstr); left = left.replace(/[0-9]+,/, newstr);
@ -234,7 +234,7 @@
BI.cjkEncode = function (text) { BI.cjkEncode = function (text) {
// alex:如果非字符串,返回其本身(cjkEncode(234) 返回 ""是不对的) // alex:如果非字符串,返回其本身(cjkEncode(234) 返回 ""是不对的)
if (typeof text !== 'string') { if (typeof text !== "string") {
return text; return text;
} }
@ -248,7 +248,7 @@
} }
} }
return newText return newText;
}; };
/** /**
@ -263,15 +263,15 @@
return ""; return "";
} }
// 查找没有 "[", 直接返回. kunsnat:数字的时候, 不支持indexOf方法, 也是直接返回. // 查找没有 "[", 直接返回. kunsnat:数字的时候, 不支持indexOf方法, 也是直接返回.
if (!isNaN(text) || text.indexOf('[') == -1) { if (!isNaN(text) || text.indexOf("[") == -1) {
return text; return text;
} }
var newText = ""; var newText = "";
for (var i = 0; i < text.length; i++) { for (var i = 0; i < text.length; i++) {
var ch = text.charAt(i); var ch = text.charAt(i);
if (ch == '[') { if (ch == "[") {
var rightIdx = text.indexOf(']', i + 1); var rightIdx = text.indexOf("]", i + 1);
if (rightIdx > i + 1) { if (rightIdx > i + 1) {
var subText = text.substring(i + 1, rightIdx); var subText = text.substring(i + 1, rightIdx);
// james:主要是考虑[CDATA[]]这样的值的出现 // james:主要是考虑[CDATA[]]这样的值的出现
@ -291,18 +291,18 @@
// replace the html special tags // replace the html special tags
BI.htmlEncode = function (text) { BI.htmlEncode = function (text) {
return (text == null) ? '' : String(text).replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;'); return (text == null) ? "" : String(text).replace(/&/g, "&amp;").replace(/\"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
}; };
// html decode // html decode
BI.htmlDecode = function (text) { BI.htmlDecode = function (text) {
return (text == null) ? '' : String(text).replace(/&amp;/g, '&').replace(/&quot;/g, '\"').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&nbsp;/g, ' '); return (text == null) ? "" : String(text).replace(/&amp;/g, "&").replace(/&quot;/g, "\"").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&nbsp;/g, " ");
}; };
BI.cjkEncodeDO = function (o) { BI.cjkEncodeDO = function (o) {
if (BI.isPlainObject(o)) { if (BI.isPlainObject(o)) {
var result = {}; var result = {};
$.each(o, function (k, v) { $.each(o, function (k, v) {
if (!(typeof v == "string")) { if (!(typeof v === "string")) {
v = BI.jsonEncode(v); v = BI.jsonEncode(v);
} }
// wei:bug 43338,如果key是中文,cjkencode后o的长度就加了1,ie9以下版本死循环,所以新建对象result。 // wei:bug 43338,如果key是中文,cjkencode后o的长度就加了1,ie9以下版本死循环,所以新建对象result。
@ -316,24 +316,24 @@
BI.jsonEncode = function (o) { BI.jsonEncode = function (o) {
// james:这个Encode是抄的EXT的 // james:这个Encode是抄的EXT的
var useHasOwn = {}.hasOwnProperty ? true : false; var useHasOwn = !!{}.hasOwnProperty;
// crashes Safari in some instances // crashes Safari in some instances
// var validRE = /^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/; // var validRE = /^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/;
var m = { var m = {
"\b": '\\b', "\b": "\\b",
"\t": '\\t', "\t": "\\t",
"\n": '\\n', "\n": "\\n",
"\f": '\\f', "\f": "\\f",
"\r": '\\r', "\r": "\\r",
'"': '\\"', "\"": "\\\"",
"\\": '\\\\' "\\": "\\\\"
}; };
var encodeString = function (s) { var encodeString = function (s) {
if (/["\\\x00-\x1f]/.test(s)) { if (/["\\\x00-\x1f]/.test(s)) {
return '"' + s.replace(/([\x00-\x1f\\"])/g, function (a, b) { return "\"" + s.replace(/([\x00-\x1f\\"])/g, function (a, b) {
var c = m[b]; var c = m[b];
if (c) { if (c) {
return c; return c;
@ -342,9 +342,9 @@
return "\\u00" + return "\\u00" +
Math.floor(c / 16).toString(16) + Math.floor(c / 16).toString(16) +
(c % 16).toString(16); (c % 16).toString(16);
}) + '"'; }) + "\"";
} }
return '"' + s + '"'; return "\"" + s + "\"";
}; };
var encodeArray = function (o) { var encodeArray = function (o) {
@ -358,7 +358,7 @@
break; break;
default: default:
if (b) { if (b) {
a.push(','); a.push(",");
} }
a.push(v === null ? "null" : BI.jsonEncode(v)); a.push(v === null ? "null" : BI.jsonEncode(v));
b = true; b = true;
@ -368,7 +368,7 @@
return a.join(""); return a.join("");
}; };
if (typeof o == "undefined" || o === null) { if (typeof o === "undefined" || o === null) {
return "null"; return "null";
} else if (BI.isArray(o)) { } else if (BI.isArray(o)) {
return encodeArray(o); return encodeArray(o);
@ -379,16 +379,16 @@
*/ */
return BI.jsonEncode({ return BI.jsonEncode({
__time__: o.getTime() __time__: o.getTime()
}) });
} else if (typeof o == "string") { } else if (typeof o === "string") {
return encodeString(o); return encodeString(o);
} else if (typeof o == "number") { } else if (typeof o === "number") {
return isFinite(o) ? String(o) : "null"; return isFinite(o) ? String(o) : "null";
} else if (typeof o == "boolean") { } else if (typeof o === "boolean") {
return String(o); return String(o);
} else if (BI.isFunction(o)) { } else if (BI.isFunction(o)) {
return String(o); return String(o);
} else { }
var a = ["{"], b, i, v; var a = ["{"], b, i, v;
for (i in o) { for (i in o) {
if (!useHasOwn || o.hasOwnProperty(i)) { if (!useHasOwn || o.hasOwnProperty(i)) {
@ -399,7 +399,7 @@
break; break;
default: default:
if (b) { if (b) {
a.push(','); a.push(",");
} }
a.push(BI.jsonEncode(i), ":", a.push(BI.jsonEncode(i), ":",
v === null ? "null" : BI.jsonEncode(v)); v === null ? "null" : BI.jsonEncode(v));
@ -409,7 +409,7 @@
} }
a.push("}"); a.push("}");
return a.join(""); return a.join("");
}
}; };
BI.jsonDecode = function (text) { BI.jsonDecode = function (text) {
@ -454,7 +454,7 @@
return new Date(o.__time__); return new Date(o.__time__);
} }
for (var a in o) { for (var a in o) {
if (o[a] == o || typeof o[a] == 'object' || $.isFunction(o[a])) { if (o[a] == o || typeof o[a] === "object" || $.isFunction(o[a])) {
break; break;
} }
o[a] = arguments.callee(o[a]); o[a] = arguments.callee(o[a]);
@ -467,7 +467,7 @@
BI.contentFormat = function (cv, fmt) { BI.contentFormat = function (cv, fmt) {
if (isEmpty(cv)) { if (isEmpty(cv)) {
// 原值为空,返回空字符 // 原值为空,返回空字符
return ''; return "";
} }
var text = cv.toString(); var text = cv.toString();
if (isEmpty(fmt)) { if (isEmpty(fmt)) {
@ -480,7 +480,7 @@
} else if (fmt.match(/^D/)) { } else if (fmt.match(/^D/)) {
// D - 日期(时间)格式 // D - 日期(时间)格式
if (!(cv instanceof Date)) { if (!(cv instanceof Date)) {
if (typeof cv === 'number') { if (typeof cv === "number") {
// 毫秒数类型 // 毫秒数类型
cv = new Date(cv); cv = new Date(cv);
} else { } else {
@ -500,7 +500,7 @@
text = _numberFormat(text, fmt); text = _numberFormat(text, fmt);
} }
// ¤ - 货币格式 // ¤ - 货币格式
text = text.replace(/¤/g, '¥'); text = text.replace(/¤/g, "¥");
return text; return text;
}; };
@ -518,19 +518,19 @@
*/ */
BI.date2Str = function (date, format) { BI.date2Str = function (date, format) {
if (!date) { if (!date) {
return ''; return "";
} }
// O(len(format)) // O(len(format))
var len = format.length, result = ''; var len = format.length, result = "";
if (len > 0) { if (len > 0) {
var flagch = format.charAt(0), start = 0, str = flagch; var flagch = format.charAt(0), start = 0, str = flagch;
for (var i = 1; i < len; i++) { for (var i = 1; i < len; i++) {
var ch = format.charAt(i); var ch = format.charAt(i);
if (flagch !== ch) { if (flagch !== ch) {
result += compileJFmt({ result += compileJFmt({
'char': flagch, char: flagch,
'str': str, str: str,
'len': i - start len: i - start
}, date); }, date);
flagch = ch; flagch = ch;
start = i; start = i;
@ -540,78 +540,78 @@
} }
} }
result += compileJFmt({ result += compileJFmt({
'char': flagch, char: flagch,
'str': str, str: str,
'len': len - start len: len - start
}, date); }, date);
} }
return result; return result;
function compileJFmt (jfmt, date) { function compileJFmt (jfmt, date) {
var str = jfmt.str, len = jfmt.len, ch = jfmt['char']; var str = jfmt.str, len = jfmt.len, ch = jfmt["char"];
switch (ch) { switch (ch) {
case 'E': //星期 case "E": // 星期
str = Date._DN[date.getDay()]; str = Date._DN[date.getDay()];
break; break;
case 'y': //年 case "y": //
if (len <= 3) { if (len <= 3) {
str = (date.getFullYear() + '').slice(2, 4); str = (date.getFullYear() + "").slice(2, 4);
} else { } else {
str = date.getFullYear(); str = date.getFullYear();
} }
break; break;
case 'M': //月 case "M": //
if (len > 2) { if (len > 2) {
str = Date._MN[date.getMonth()]; str = Date._MN[date.getMonth()];
} else if (len < 2) { } else if (len < 2) {
str = date.getMonth() + 1; str = date.getMonth() + 1;
} else { } else {
str = String.leftPad(date.getMonth() + 1 + '', 2, '0'); str = String.leftPad(date.getMonth() + 1 + "", 2, "0");
} }
break; break;
case 'd': //日 case "d": //
if (len > 1) { if (len > 1) {
str = String.leftPad(date.getDate() + '', 2, '0'); str = String.leftPad(date.getDate() + "", 2, "0");
} else { } else {
str = date.getDate(); str = date.getDate();
} }
break; break;
case 'h': //时(12) case "h": // 时(12)
var hour = date.getHours() % 12; var hour = date.getHours() % 12;
if (hour === 0) { if (hour === 0) {
hour = 12; hour = 12;
} }
if (len > 1) { if (len > 1) {
str = String.leftPad(hour + '', 2, '0'); str = String.leftPad(hour + "", 2, "0");
} else { } else {
str = hour; str = hour;
} }
break; break;
case 'H': //时(24) case "H": // 时(24)
if (len > 1) { if (len > 1) {
str = String.leftPad(date.getHours() + '', 2, '0'); str = String.leftPad(date.getHours() + "", 2, "0");
} else { } else {
str = date.getHours(); str = date.getHours();
} }
break; break;
case 'm': case "m":
if (len > 1) { if (len > 1) {
str = String.leftPad(date.getMinutes() + '', 2, '0'); str = String.leftPad(date.getMinutes() + "", 2, "0");
} else { } else {
str = date.getMinutes(); str = date.getMinutes();
} }
break; break;
case 's': case "s":
if (len > 1) { if (len > 1) {
str = String.leftPad(date.getSeconds() + '', 2, '0'); str = String.leftPad(date.getSeconds() + "", 2, "0");
} else { } else {
str = date.getSeconds(); str = date.getSeconds();
} }
break; break;
case 'a': case "a":
str = date.getHours() < 12 ? 'am' : 'pm'; str = date.getHours() < 12 ? "am" : "pm";
break; break;
case 'z': case "z":
str = date.getTimezone(); str = date.getTimezone();
break; break;
default: default:
@ -626,16 +626,16 @@
if (value == null) { if (value == null) {
return 0; return 0;
} }
if (typeof value == 'number') { if (typeof value === "number") {
return value; return value;
} else { }
var str = value + ""; var str = value + "";
if (str.indexOf(".") === -1) { if (str.indexOf(".") === -1) {
return parseInt(str); return parseInt(str);
} else {
return parseFloat(str);
}
} }
return parseFloat(str);
}; };
BI.object2Date = function (obj) { BI.object2Date = function (obj) {
@ -644,18 +644,18 @@
} }
if (obj instanceof Date) { if (obj instanceof Date) {
return obj; return obj;
} else if (typeof obj == 'number') { } else if (typeof obj === "number") {
return new Date(obj); return new Date(obj);
} else { }
var str = obj + ""; var str = obj + "";
str = str.replace(/-/g, '/'); str = str.replace(/-/g, "/");
var dt = new Date(str); var dt = new Date(str);
if (!isInvalidDate(dt)) { if (!isInvalidDate(dt)) {
return dt; return dt;
} }
return new Date(); return new Date();
}
}; };
BI.object2Time = function (obj) { BI.object2Time = function (obj) {
@ -664,14 +664,14 @@
} }
if (obj instanceof Date) { if (obj instanceof Date) {
return obj; return obj;
} else { }
var str = obj + ""; var str = obj + "";
str = str.replace(/-/g, '/'); str = str.replace(/-/g, "/");
var dt = new Date(str); var dt = new Date(str);
if (!isInvalidDate(dt)) { if (!isInvalidDate(dt)) {
return dt; return dt;
} }
if (str.indexOf('/') === -1 && str.indexOf(':') !== -1) { if (str.indexOf("/") === -1 && str.indexOf(":") !== -1) {
dt = new Date("1970/01/01 " + str); dt = new Date("1970/01/01 " + str);
if (!isInvalidDate(dt)) { if (!isInvalidDate(dt)) {
return dt; return dt;
@ -682,6 +682,6 @@
return dt; return dt;
} }
return new Date(); return new Date();
}
}; };
})(); })();

118
src/core/base.js

@ -7,24 +7,24 @@
if (!window.BI) { if (!window.BI) {
window.BI = {}; window.BI = {};
} }
;
!(function ($, undefined) { !(function ($, undefined) {
var traverse = function (func, context) { var traverse = function (func, context) {
return function (value, key, obj) { return function (value, key, obj) {
return func.call(context, key, value, obj); return func.call(context, key, value, obj);
} };
}; };
var _apply = function (name) { var _apply = function (name) {
return function () { return function () {
return _[name].apply(_, arguments); return _[name].apply(_, arguments);
} };
}; };
var _applyFunc = function (name) { var _applyFunc = function (name) {
return function () { return function () {
var args = Array.prototype.slice.call(arguments, 0); var args = Array.prototype.slice.call(arguments, 0);
args[1] = _.isFunction(args[1]) ? traverse(args[1], args[2]) : args[1]; args[1] = _.isFunction(args[1]) ? traverse(args[1], args[2]) : args[1];
return _[name].apply(_, args); return _[name].apply(_, args);
} };
}; };
// Utility // Utility
@ -61,11 +61,11 @@ if (!window.BI) {
}, },
warn: function (message) { warn: function (message) {
console.warn(message) console.warn(message);
}, },
UUID: function () { UUID: function () {
var f = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; var f = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
var str = ""; var str = "";
for (var i = 0; i < 16; i++) { for (var i = 0; i < 16; i++) {
var r = parseInt(f.length * Math.random(), 10); var r = parseInt(f.length * Math.random(), 10);
@ -80,7 +80,7 @@ if (!window.BI) {
createWidgets: function (items, options) { createWidgets: function (items, options) {
if (!BI.isArray(items)) { if (!BI.isArray(items)) {
throw new Error("cannot create Widgets") throw new Error("cannot create Widgets");
} }
return BI.map(BI.flatten(items), function (i, item) { return BI.map(BI.flatten(items), function (i, item) {
return BI.createWidget(item, BI.deepClone(options)); return BI.createWidget(item, BI.deepClone(options));
@ -104,7 +104,7 @@ if (!window.BI) {
outerAttr.shift(); outerAttr.shift();
return BI.extend({}, item, { return BI.extend({}, item, {
el: innerAttr.shift() el: innerAttr.shift()
}) });
} }
if (item.el instanceof BI.Widget || (BI.View && item.el instanceof BI.View)) { if (item.el instanceof BI.Widget || (BI.View && item.el instanceof BI.View)) {
innerAttr.shift(); innerAttr.shift();
@ -113,12 +113,12 @@ if (!window.BI) {
if (item.el) { if (item.el) {
return BI.extend({}, outerAttr.shift(), item, { return BI.extend({}, outerAttr.shift(), item, {
el: BI.extend({}, innerAttr.shift(), item.el) el: BI.extend({}, innerAttr.shift(), item.el)
}) });
} }
return BI.extend({}, outerAttr.shift(), { return BI.extend({}, outerAttr.shift(), {
el: BI.extend({}, innerAttr.shift(), item) el: BI.extend({}, innerAttr.shift(), item)
}) });
}) });
}, },
// 用容器包装items // 用容器包装items
@ -131,8 +131,8 @@ if (!window.BI) {
el: it el: it
}) })
] ]
}) });
}) });
} }
return items; return items;
}, },
@ -160,11 +160,11 @@ if (!window.BI) {
// 集合相关方法 // 集合相关方法
_.each(["where", "findWhere", "contains", "invoke", "pluck", "shuffle", "sample", "toArray", "size"], function (name) { _.each(["where", "findWhere", "contains", "invoke", "pluck", "shuffle", "sample", "toArray", "size"], function (name) {
BI[name] = _apply(name) BI[name] = _apply(name);
}); });
_.each(["each", "map", "reduce", "reduceRight", "find", "filter", "reject", "every", "all", "some", "any", "max", "min", _.each(["each", "map", "reduce", "reduceRight", "find", "filter", "reject", "every", "all", "some", "any", "max", "min",
"sortBy", "groupBy", "indexBy", "countBy", "partition"], function (name) { "sortBy", "groupBy", "indexBy", "countBy", "partition"], function (name) {
BI[name] = _applyFunc(name) BI[name] = _applyFunc(name);
}); });
_.extend(BI, { _.extend(BI, {
clamp: function (value, minValue, maxValue) { clamp: function (value, minValue, maxValue) {
@ -326,7 +326,7 @@ if (!window.BI) {
}, },
string2Array: function (str) { string2Array: function (str) {
return str.split('&-&'); return str.split("&-&");
}, },
array2String: function (array) { array2String: function (array) {
@ -334,7 +334,7 @@ if (!window.BI) {
}, },
abc2Int: function (str) { abc2Int: function (str) {
var idx = 0, start = 'A', str = str.toUpperCase(); var idx = 0, start = "A", str = str.toUpperCase();
for (var i = 0, len = str.length; i < len; ++i) { for (var i = 0, len = str.length; i < len; ++i) {
idx = str.charAt(i).charCodeAt(0) - start.charCodeAt(0) + 26 * idx + 1; idx = str.charAt(i).charCodeAt(0) - start.charCodeAt(0) + 26 * idx + 1;
if (idx > (2147483646 - str.charAt(i).charCodeAt(0) + start.charCodeAt(0)) / 26) { if (idx > (2147483646 - str.charAt(i).charCodeAt(0) + start.charCodeAt(0)) / 26) {
@ -345,7 +345,7 @@ if (!window.BI) {
}, },
int2Abc: function (num) { int2Abc: function (num) {
var DIGITS = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; var DIGITS = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
var idx = num, str = ""; var idx = num, str = "";
if (num === 0) { if (num === 0) {
return ""; return "";
@ -365,10 +365,10 @@ if (!window.BI) {
// 数组相关的方法 // 数组相关的方法
_.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection", _.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection",
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range"], function (name) { "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range"], function (name) {
BI[name] = _apply(name) BI[name] = _apply(name);
}); });
_.each(["findIndex", "findLastIndex"], function (name) { _.each(["findIndex", "findLastIndex"], function (name) {
BI[name] = _applyFunc(name) BI[name] = _applyFunc(name);
}); });
_.extend(BI, { _.extend(BI, {
// 构建一个长度为length的数组 // 构建一个长度为length的数组
@ -430,15 +430,15 @@ if (!window.BI) {
"defaults", "clone", "property", "propertyOf", "matcher", "isEqual", "isMatch", "isEmpty", "defaults", "clone", "property", "propertyOf", "matcher", "isEqual", "isMatch", "isEmpty",
"isElement", "isNumber", "isString", "isArray", "isObject", "isArguments", "isFunction", "isFinite", "isElement", "isNumber", "isString", "isArray", "isObject", "isArguments", "isFunction", "isFinite",
"isBoolean", "isDate", "isRegExp", "isError", "isNaN", "isUndefined"], function (name) { "isBoolean", "isDate", "isRegExp", "isError", "isNaN", "isUndefined"], function (name) {
BI[name] = _apply(name) BI[name] = _apply(name);
}); });
_.each(["mapObject", "findKey", "pick", "omit", "tap"], function (name) { _.each(["mapObject", "findKey", "pick", "omit", "tap"], function (name) {
BI[name] = _applyFunc(name) BI[name] = _applyFunc(name);
}); });
_.extend(BI, { _.extend(BI, {
inherit: function (sb, sp, overrides) { inherit: function (sb, sp, overrides) {
if (typeof sp == 'object') { if (typeof sp === "object") {
overrides = sp; overrides = sp;
sp = sb; sp = sb;
sb = function () { sb = function () {
@ -481,10 +481,10 @@ if (!window.BI) {
}, },
isWidthOrHeight: function (w) { isWidthOrHeight: function (w) {
if (typeof w == 'number') { if (typeof w === "number") {
return w >= 0; return w >= 0;
} else if (typeof w == 'string') { } else if (typeof w === "string") {
return /^\d{1,3}%$/.exec(w) || w == 'auto' || /^\d+px$/.exec(w); return /^\d{1,3}%$/.exec(w) || w == "auto" || /^\d+px$/.exec(w);
} }
}, },
@ -544,14 +544,14 @@ if (!window.BI) {
var type = Object.prototype.toString.call(obj); var type = Object.prototype.toString.call(obj);
// Date // Date
if (type === '[object Date]') { if (type === "[object Date]") {
return Date.getDate(obj.getTime()); return Date.getDate(obj.getTime());
} }
var i, clone, key; var i, clone, key;
// Array // Array
if (type === '[object Array]') { if (type === "[object Array]") {
i = obj.length; i = obj.length;
clone = []; clone = [];
@ -561,7 +561,7 @@ if (!window.BI) {
} }
} }
// Object // Object
else if (type === '[object Object]' && obj.constructor === Object) { else if (type === "[object Object]" && obj.constructor === Object) {
clone = {}; clone = {};
for (var i in obj) { for (var i in obj) {
@ -595,7 +595,7 @@ if (!window.BI) {
if (BI.isEqual(v, copy)) { if (BI.isEqual(v, copy)) {
return true; return true;
} }
}) });
} }
return BI.contains(obj, copy); return BI.contains(obj, copy);
}, },
@ -639,7 +639,7 @@ if (!window.BI) {
} }
} }
return result; return result;
} else { }
var result = {}; var result = {};
BI.each(obj, function (i, v) { BI.each(obj, function (i, v) {
if (!BI.isEqual(target, obj[i])) { if (!BI.isEqual(target, obj[i])) {
@ -647,7 +647,7 @@ if (!window.BI) {
} }
}); });
return result; return result;
}
}, },
deepUnique: function (array) { deepUnique: function (array) {
@ -687,14 +687,14 @@ if (!window.BI) {
_.each(["uniqueId", "result", "chain", "iteratee", "escape", "unescape"], function (name) { _.each(["uniqueId", "result", "chain", "iteratee", "escape", "unescape"], function (name) {
BI[name] = function () { BI[name] = function () {
return _[name].apply(_, arguments); return _[name].apply(_, arguments);
} };
}); });
// 事件相关方法 // 事件相关方法
_.each(["bind", "once", "partial", "debounce", "throttle", "delay", "defer", "wrap"], function (name) { _.each(["bind", "once", "partial", "debounce", "throttle", "delay", "defer", "wrap"], function (name) {
BI[name] = function () { BI[name] = function () {
return _[name].apply(_, arguments); return _[name].apply(_, arguments);
} };
}); });
_.extend(BI, { _.extend(BI, {
@ -712,15 +712,15 @@ if (!window.BI) {
} }
} }
if (typeof Promise !== 'undefined') { if (typeof Promise !== "undefined") {
var p = Promise.resolve(); var p = Promise.resolve();
timerFunc = function () { timerFunc = function () {
p.then(nextTickHandler); p.then(nextTickHandler);
} };
} else } else
/* istanbul ignore if */ /* istanbul ignore if */
if (typeof MutationObserver !== 'undefined') { if (typeof MutationObserver !== "undefined") {
var counter = 1; var counter = 1;
var observer = new MutationObserver(nextTickHandler); var observer = new MutationObserver(nextTickHandler);
var textNode = document.createTextNode(counter + ""); var textNode = document.createTextNode(counter + "");
@ -730,11 +730,11 @@ if (!window.BI) {
timerFunc = function () { timerFunc = function () {
counter = (counter + 1) % 2; counter = (counter + 1) % 2;
textNode.data = counter + ""; textNode.data = counter + "";
} };
} else { } else {
timerFunc = function () { timerFunc = function () {
setTimeout(nextTickHandler, 0) setTimeout(nextTickHandler, 0);
} };
} }
return function queueNextTick (cb) { return function queueNextTick (cb) {
var _resolve; var _resolve;
@ -751,34 +751,34 @@ if (!window.BI) {
pending = true; pending = true;
timerFunc(); timerFunc();
} }
if (!cb && typeof Promise !== 'undefined') { if (!cb && typeof Promise !== "undefined") {
return new Promise(function (resolve) { return new Promise(function (resolve) {
_resolve = resolve _resolve = resolve;
}) });
}
} }
};
})() })()
}); });
// 数字相关方法 // 数字相关方法
_.each(["random"], function (name) { _.each(["random"], function (name) {
BI[name] = _apply(name) BI[name] = _apply(name);
}); });
_.extend(BI, { _.extend(BI, {
getTime: function () { getTime: function () {
if (window.performance && window.performance.now) { if (window.performance && window.performance.now) {
return window.performance.now(); return window.performance.now();
} else { }
if (window.performance && window.performance.webkitNow) { if (window.performance && window.performance.webkitNow) {
return window.performance.webkitNow(); return window.performance.webkitNow();
} else { }
if (Date.now) { if (Date.now) {
return Date.now(); return Date.now();
} else {
return Date.getDate().getTime();
}
}
} }
return Date.getDate().getTime();
}, },
parseInt: function (number) { parseInt: function (number) {
@ -900,16 +900,16 @@ if (!window.BI) {
}, },
isLiteral: function (exp) { isLiteral: function (exp) {
var literalValueRE = /^\s?(true|false|-?[\d\.]+|'[^']*'|"[^"]*")\s?$/ var literalValueRE = /^\s?(true|false|-?[\d\.]+|'[^']*'|"[^"]*")\s?$/;
return literalValueRE.test(exp) return literalValueRE.test(exp);
}, },
stripQuotes: function (str) { stripQuotes: function (str) {
var a = str.charCodeAt(0) var a = str.charCodeAt(0);
var b = str.charCodeAt(str.length - 1) var b = str.charCodeAt(str.length - 1);
return a === b && (a === 0x22 || a === 0x27) return a === b && (a === 0x22 || a === 0x27)
? str.slice(1, -1) ? str.slice(1, -1)
: str : str;
}, },
// background-color => backgroundColor // background-color => backgroundColor
@ -921,7 +921,7 @@ if (!window.BI) {
// backgroundColor => background-color // backgroundColor => background-color
hyphenate: function (str) { hyphenate: function (str) {
return str.replace(/([A-Z])/g, '-$1').toLowerCase(); return str.replace(/([A-Z])/g, "-$1").toLowerCase();
}, },
isNotEmptyString: function (str) { isNotEmptyString: function (str) {
@ -1111,7 +1111,7 @@ if (!window.BI) {
}, },
isSupportCss3: function (style) { isSupportCss3: function (style) {
var prefix = ['webkit', 'Moz', 'ms', 'o'], var prefix = ["webkit", "Moz", "ms", "o"],
i, len, i, len,
humpString = [], humpString = [],
htmlStyle = document.documentElement.style, htmlStyle = document.documentElement.style,
@ -1122,7 +1122,7 @@ if (!window.BI) {
}; };
for (i in prefix) { for (i in prefix) {
humpString.push(_toHumb(prefix[i] + '-' + style)); humpString.push(_toHumb(prefix[i] + "-" + style));
} }
humpString.push(_toHumb(style)); humpString.push(_toHumb(style));

2
src/core/behavior/behavior.highlight.js

@ -37,6 +37,6 @@ BI.HighlightBehavior = BI.inherit(BI.Behavior, {
} else { } else {
item.doBehavior.apply(item, args); item.doBehavior.apply(item, args);
} }
}) });
} }
}); });

2
src/core/behavior/behavior.js

@ -11,7 +11,7 @@ BI.BehaviorFactory = {
} }
return new behavior(options); return new behavior(options);
} }
} };
/** /**
* guy * guy

2
src/core/behavior/behavior.redmark.js

@ -29,6 +29,6 @@ BI.RedMarkBehavior = BI.inherit(BI.Behavior, {
} else { } else {
item.doBehavior.apply(item, args); item.doBehavior.apply(item, args);
} }
}) });
} }
}); });

2
src/core/controller.js

@ -10,7 +10,7 @@ BI.Controller = BI.inherit(BI.OB, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.Controller.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.Controller.superclass._defaultConfig.apply(this, arguments), {
}) });
}, },
_init: function () { _init: function () {
BI.Controller.superclass._init.apply(this, arguments); BI.Controller.superclass._init.apply(this, arguments);

2
src/core/controller/controller.broadcast.js

@ -22,7 +22,7 @@ BI.BroadcastController = BI.inherit(BI.Controller, {
this._broadcasts[name].push(fn); this._broadcasts[name].push(fn);
return function () { return function () {
self.remove(name, fn); self.remove(name, fn);
} };
}, },
send: function (name) { send: function (name) {

4
src/core/controller/controller.floatbox.js

@ -50,7 +50,7 @@ BI.FloatBoxController = BI.inherit(BI.Controller, {
cls: "bi-popup-view", cls: "bi-popup-view",
items: [{ items: [{
el: (this.floatLayer[name] = BI.createWidget({ el: (this.floatLayer[name] = BI.createWidget({
type: 'bi.absolute', type: "bi.absolute",
items: [floatbox] items: [floatbox]
})), })),
left: 0, left: 0,
@ -63,7 +63,7 @@ BI.FloatBoxController = BI.inherit(BI.Controller, {
(function (key) { (function (key) {
floatbox.on(BI.FloatBox.EVENT_FLOAT_BOX_CLOSED, function () { floatbox.on(BI.FloatBox.EVENT_FLOAT_BOX_CLOSED, function () {
self.close(key); self.close(key);
}) });
})(name); })(name);
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",

2
src/core/controller/controller.layer.js

@ -24,7 +24,7 @@ BI.LayerController = BI.inherit(BI.Controller, {
if (layer.element.is(":visible")) { if (layer.element.is(":visible")) {
layer.element.trigger("__resize__"); layer.element.trigger("__resize__");
} }
}) });
}, },
make: function (name, container, op) { make: function (name, container, op) {

2
src/core/controller/controller.resizer.js

@ -37,7 +37,7 @@ BI.ResizeController = BI.inherit(BI.Controller, {
resizer(ev); resizer(ev);
return; return;
} }
}) });
}, },
add: function (name, resizer) { add: function (name, resizer) {

130
src/core/events.js

@ -33,61 +33,61 @@ _.extend(BI, {
* @static * @static
* @property 确定事件 * @property 确定事件
*/ */
CONFIRM: '_CONFIRM', CONFIRM: "_CONFIRM",
/** /**
* @static * @static
* @property 错误事件 * @property 错误事件
*/ */
ERROR: '_ERROR', ERROR: "_ERROR",
/** /**
* @static * @static
* @property 暂停事件 * @property 暂停事件
*/ */
PAUSE: '_PAUSE', PAUSE: "_PAUSE",
/** /**
* @static * @static
* @property destroy事件 * @property destroy事件
*/ */
DESTROY: '_DESTROY', DESTROY: "_DESTROY",
/** /**
* @static * @static
* @property 取消挂载事件 * @property 取消挂载事件
*/ */
UNMOUNT: '_UNMOUNT', UNMOUNT: "_UNMOUNT",
/** /**
* @static * @static
* @property 清除选择 * @property 清除选择
*/ */
CLEAR: '_CLEAR', CLEAR: "_CLEAR",
/** /**
* @static * @static
* @property 添加数据 * @property 添加数据
*/ */
ADD: '_ADD', ADD: "_ADD",
/** /**
* @static * @static
* @property 正在编辑状态事件 * @property 正在编辑状态事件
*/ */
EDITING: '_EDITING', EDITING: "_EDITING",
/** /**
* @static * @static
* @property 空状态事件 * @property 空状态事件
*/ */
EMPTY: '_EMPTY', EMPTY: "_EMPTY",
/** /**
* @static * @static
* @property 显示隐藏事件 * @property 显示隐藏事件
*/ */
VIEW: '_VIEW', VIEW: "_VIEW",
/** /**
* @static * @static
@ -99,334 +99,334 @@ _.extend(BI, {
* @static * @static
* @property 编辑前事件 * @property 编辑前事件
*/ */
BEFOREEDIT: '_BEFOREEDIT', BEFOREEDIT: "_BEFOREEDIT",
/** /**
* @static * @static
* @property 编辑后事件 * @property 编辑后事件
*/ */
AFTEREDIT: '_AFTEREDIT', AFTEREDIT: "_AFTEREDIT",
/** /**
* @static * @static
* @property 开始编辑事件 * @property 开始编辑事件
*/ */
STARTEDIT: '_STARTEDIT', STARTEDIT: "_STARTEDIT",
/** /**
* @static * @static
* @property 停止编辑事件 * @property 停止编辑事件
*/ */
STOPEDIT: '_STOPEDIT', STOPEDIT: "_STOPEDIT",
/** /**
* @static * @static
* @property 值改变事件 * @property 值改变事件
*/ */
CHANGE: '_CHANGE', CHANGE: "_CHANGE",
/** /**
* @static * @static
* @property 下拉弹出菜单事件 * @property 下拉弹出菜单事件
*/ */
EXPAND: '_EXPAND', EXPAND: "_EXPAND",
/** /**
* @static * @static
* @property 关闭下拉菜单事件 * @property 关闭下拉菜单事件
*/ */
COLLAPSE: '_COLLAPSE', COLLAPSE: "_COLLAPSE",
/** /**
* @static * @static
* @property 回调事件 * @property 回调事件
*/ */
CALLBACK: '_CALLBACK', CALLBACK: "_CALLBACK",
/** /**
* @static * @static
* @property 点击事件 * @property 点击事件
*/ */
CLICK: '_CLICK', CLICK: "_CLICK",
/** /**
* @static * @static
* @property 状态改变事件一般是用在复选按钮和单选按钮 * @property 状态改变事件一般是用在复选按钮和单选按钮
*/ */
STATECHANGE: '_STATECHANGE', STATECHANGE: "_STATECHANGE",
/** /**
* @static * @static
* @property 状态改变前事件 * @property 状态改变前事件
*/ */
BEFORESTATECHANGE: '_BEFORESTATECHANGE', BEFORESTATECHANGE: "_BEFORESTATECHANGE",
/** /**
* @static * @static
* @property 初始化事件 * @property 初始化事件
*/ */
INIT: '_INIT', INIT: "_INIT",
/** /**
* @static * @static
* @property 初始化后事件 * @property 初始化后事件
*/ */
AFTERINIT: '_AFTERINIT', AFTERINIT: "_AFTERINIT",
/** /**
* @static * @static
* @property 滚动条滚动事件 * @property 滚动条滚动事件
*/ */
SCROLL: '_SCROLL', SCROLL: "_SCROLL",
/** /**
* @static * @static
* @property 开始加载事件 * @property 开始加载事件
*/ */
STARTLOAD: '_STARTLOAD', STARTLOAD: "_STARTLOAD",
/** /**
* @static * @static
* @property 加载后事件 * @property 加载后事件
*/ */
AFTERLOAD: '_AFTERLOAD', AFTERLOAD: "_AFTERLOAD",
/** /**
* @static * @static
* @property 提交前事件 * @property 提交前事件
*/ */
BS: 'beforesubmit', BS: "beforesubmit",
/** /**
* @static * @static
* @property 提交后事件 * @property 提交后事件
*/ */
AS: 'aftersubmit', AS: "aftersubmit",
/** /**
* @static * @static
* @property 提交完成事件 * @property 提交完成事件
*/ */
SC: 'submitcomplete', SC: "submitcomplete",
/** /**
* @static * @static
* @property 提交失败事件 * @property 提交失败事件
*/ */
SF: 'submitfailure', SF: "submitfailure",
/** /**
* @static * @static
* @property 提交成功事件 * @property 提交成功事件
*/ */
SS: 'submitsuccess', SS: "submitsuccess",
/** /**
* @static * @static
* @property 校验提交前事件 * @property 校验提交前事件
*/ */
BVW: 'beforeverifywrite', BVW: "beforeverifywrite",
/** /**
* @static * @static
* @property 校验提交后事件 * @property 校验提交后事件
*/ */
AVW: 'afterverifywrite', AVW: "afterverifywrite",
/** /**
* @static * @static
* @property 校验后事件 * @property 校验后事件
*/ */
AV: 'afterverify', AV: "afterverify",
/** /**
* @static * @static
* @property 填报前事件 * @property 填报前事件
*/ */
BW: 'beforewrite', BW: "beforewrite",
/** /**
* @static * @static
* @property 填报后事件 * @property 填报后事件
*/ */
AW: 'afterwrite', AW: "afterwrite",
/** /**
* @static * @static
* @property 填报成功事件 * @property 填报成功事件
*/ */
WS: 'writesuccess', WS: "writesuccess",
/** /**
* @static * @static
* @property 填报失败事件 * @property 填报失败事件
*/ */
WF: 'writefailure', WF: "writefailure",
/** /**
* @static * @static
* @property 添加行前事件 * @property 添加行前事件
*/ */
BA: 'beforeappend', BA: "beforeappend",
/** /**
* @static * @static
* @property 添加行后事件 * @property 添加行后事件
*/ */
AA: 'afterappend', AA: "afterappend",
/** /**
* @static * @static
* @property 删除行前事件 * @property 删除行前事件
*/ */
BD: 'beforedelete', BD: "beforedelete",
/** /**
* @static * @static
* @property 删除行后事件 * @property 删除行后事件
*/ */
AD: 'beforedelete', AD: "beforedelete",
/** /**
* @static * @static
* @property 未提交离开事件 * @property 未提交离开事件
*/ */
UC: 'unloadcheck', UC: "unloadcheck",
/** /**
* @static * @static
* @property PDF导出前事件 * @property PDF导出前事件
*/ */
BTOPDF: 'beforetopdf', BTOPDF: "beforetopdf",
/** /**
* @static * @static
* @property PDF导出后事件 * @property PDF导出后事件
*/ */
ATOPDF: 'aftertopdf', ATOPDF: "aftertopdf",
/** /**
* @static * @static
* @property Excel导出前事件 * @property Excel导出前事件
*/ */
BTOEXCEL: 'beforetoexcel', BTOEXCEL: "beforetoexcel",
/** /**
* @static * @static
* @property Excel导出后事件 * @property Excel导出后事件
*/ */
ATOEXCEL: 'aftertoexcel', ATOEXCEL: "aftertoexcel",
/** /**
* @static * @static
* @property Word导出前事件 * @property Word导出前事件
*/ */
BTOWORD: 'beforetoword', BTOWORD: "beforetoword",
/** /**
* @static * @static
* @property Word导出后事件 * @property Word导出后事件
*/ */
ATOWORD: 'aftertoword', ATOWORD: "aftertoword",
/** /**
* @static * @static
* @property 图片导出前事件 * @property 图片导出前事件
*/ */
BTOIMAGE: 'beforetoimage', BTOIMAGE: "beforetoimage",
/** /**
* @static * @static
* @property 图片导出后事件 * @property 图片导出后事件
*/ */
ATOIMAGE: 'aftertoimage', ATOIMAGE: "aftertoimage",
/** /**
* @static * @static
* @property HTML导出前事件 * @property HTML导出前事件
*/ */
BTOHTML: 'beforetohtml', BTOHTML: "beforetohtml",
/** /**
* @static * @static
* @property HTML导出后事件 * @property HTML导出后事件
*/ */
ATOHTML: 'aftertohtml', ATOHTML: "aftertohtml",
/** /**
* @static * @static
* @property Excel导入前事件 * @property Excel导入前事件
*/ */
BIMEXCEL: 'beforeimportexcel', BIMEXCEL: "beforeimportexcel",
/** /**
* @static * @static
* @property Excel导出后事件 * @property Excel导出后事件
*/ */
AIMEXCEL: 'afterimportexcel', AIMEXCEL: "afterimportexcel",
/** /**
* @static * @static
* @property PDF打印前事件 * @property PDF打印前事件
*/ */
BPDFPRINT: 'beforepdfprint', BPDFPRINT: "beforepdfprint",
/** /**
* @static * @static
* @property PDF打印后事件 * @property PDF打印后事件
*/ */
APDFPRINT: 'afterpdfprint', APDFPRINT: "afterpdfprint",
/** /**
* @static * @static
* @property Flash打印前事件 * @property Flash打印前事件
*/ */
BFLASHPRINT: 'beforeflashprint', BFLASHPRINT: "beforeflashprint",
/** /**
* @static * @static
* @property Flash打印后事件 * @property Flash打印后事件
*/ */
AFLASHPRINT: 'afterflashprint', AFLASHPRINT: "afterflashprint",
/** /**
* @static * @static
* @property Applet打印前事件 * @property Applet打印前事件
*/ */
BAPPLETPRINT: 'beforeappletprint', BAPPLETPRINT: "beforeappletprint",
/** /**
* @static * @static
* @property Applet打印后事件 * @property Applet打印后事件
*/ */
AAPPLETPRINT: 'afterappletprint', AAPPLETPRINT: "afterappletprint",
/** /**
* @static * @static
* @property 服务器打印前事件 * @property 服务器打印前事件
*/ */
BSEVERPRINT: 'beforeserverprint', BSEVERPRINT: "beforeserverprint",
/** /**
* @static * @static
* @property 服务器打印后事件 * @property 服务器打印后事件
*/ */
ASERVERPRINT: 'afterserverprint', ASERVERPRINT: "afterserverprint",
/** /**
* @static * @static
* @property 邮件发送前事件 * @property 邮件发送前事件
*/ */
BEMAIL: 'beforeemail', BEMAIL: "beforeemail",
/** /**
* @static * @static
* @property 邮件发送后事件 * @property 邮件发送后事件
*/ */
AEMAIL: 'afteremail' AEMAIL: "afteremail"
} }
}); });

42
src/core/func/dom.js

@ -7,7 +7,7 @@ BI.extend(jQuery.fn, {
destroy: function () { destroy: function () {
this.remove(); this.remove();
if (BI.isIE() === true) { if (BI.isIE() === true) {
this[0].outerHTML = ''; this[0].outerHTML = "";
} }
}, },
/** /**
@ -104,13 +104,13 @@ BI.extend(jQuery.fn, {
if (computedStyle) { if (computedStyle) {
return computedStyle.getPropertyValue(BI.hyphenate(name)); return computedStyle.getPropertyValue(BI.hyphenate(name));
} }
if (name === 'display') { if (name === "display") {
return 'none'; return "none";
} }
} }
// Internet Explorer // Internet Explorer
if (node.currentStyle) { if (node.currentStyle) {
if (name === 'float') { if (name === "float") {
return node.currentStyle.cssFloat || node.currentStyle.styleFloat; return node.currentStyle.cssFloat || node.currentStyle.styleFloat;
} }
return node.currentStyle[BI.camelize(name)]; return node.currentStyle[BI.camelize(name)];
@ -121,7 +121,7 @@ BI.extend(jQuery.fn, {
__isMouseInBounds__: function (e) { __isMouseInBounds__: function (e) {
var offset2Body = this.offset(); var offset2Body = this.offset();
return !(e.pageX < offset2Body.left || e.pageX > offset2Body.left + this.outerWidth() return !(e.pageX < offset2Body.left || e.pageX > offset2Body.left + this.outerWidth()
|| e.pageY < offset2Body.top || e.pageY > offset2Body.top + this.outerHeight()) || e.pageY < offset2Body.top || e.pageY > offset2Body.top + this.outerHeight());
}, },
__hasZIndexMask__: function (zindex) { __hasZIndexMask__: function (zindex) {
@ -178,7 +178,7 @@ BI.extend(jQuery, {
var el = combo.element; var el = combo.element;
return { return {
left: el.offset().left + el.outerWidth() + (extraWidth || 0) left: el.offset().left + el.outerWidth() + (extraWidth || 0)
} };
}, },
getTopPosition: function (combo, popup, extraHeight) { getTopPosition: function (combo, popup, extraHeight) {
@ -233,7 +233,7 @@ BI.extend(jQuery, {
} }
return { return {
left: left left: left
} };
}, },
getLeftAdaptPosition: function (combo, popup, extraWidth) { getLeftAdaptPosition: function (combo, popup, extraWidth) {
@ -242,7 +242,7 @@ BI.extend(jQuery, {
} }
return { return {
left: 0 left: 0
} };
}, },
getRightAlignPosition: function (combo, popup, extraWidth) { getRightAlignPosition: function (combo, popup, extraWidth) {
@ -253,7 +253,7 @@ BI.extend(jQuery, {
} }
return { return {
left: left left: left
} };
}, },
getRightAdaptPosition: function (combo, popup, extraWidth) { getRightAdaptPosition: function (combo, popup, extraWidth) {
@ -262,7 +262,7 @@ BI.extend(jQuery, {
} }
return { return {
left: $("body").bounds().width - popup.element.bounds().width left: $("body").bounds().width - popup.element.bounds().width
} };
}, },
getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) {
@ -289,7 +289,7 @@ BI.extend(jQuery, {
adaptHeight: adaptHeight adaptHeight: adaptHeight
} : { } : {
top: top top: top
} };
}, },
getTopAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) { getTopAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) {
@ -301,17 +301,17 @@ BI.extend(jQuery, {
return { return {
top: 0, top: 0,
adaptHeight: combo.element.offset().top - extraHeight adaptHeight: combo.element.offset().top - extraHeight
} };
} }
if (popupBounds.height + extraHeight > windowBounds.height) { if (popupBounds.height + extraHeight > windowBounds.height) {
return { return {
top: 0, top: 0,
adaptHeight: windowBounds.height - extraHeight adaptHeight: windowBounds.height - extraHeight
} };
} }
return { return {
top: 0 top: 0
} };
}, },
getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) {
@ -338,7 +338,7 @@ BI.extend(jQuery, {
adaptHeight: adaptHeight adaptHeight: adaptHeight
} : { } : {
top: top top: top
} };
}, },
getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) { getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) {
@ -352,17 +352,17 @@ BI.extend(jQuery, {
return { return {
top: comboOffset.top + comboBounds.height + extraHeight, top: comboOffset.top + comboBounds.height + extraHeight,
adaptHeight: windowBounds.height - comboOffset.top - comboBounds.height - extraHeight adaptHeight: windowBounds.height - comboOffset.top - comboBounds.height - extraHeight
} };
} }
if (popupBounds.height + extraHeight > windowBounds.height) { if (popupBounds.height + extraHeight > windowBounds.height) {
return { return {
top: extraHeight, top: extraHeight,
adaptHeight: windowBounds.height - extraHeight adaptHeight: windowBounds.height - extraHeight
} };
} }
return { return {
top: windowBounds.height - popupBounds.height - extraHeight top: windowBounds.height - popupBounds.height - extraHeight
} };
}, },
getCenterAdaptPosition: function (combo, popup) { getCenterAdaptPosition: function (combo, popup) {
@ -380,7 +380,7 @@ BI.extend(jQuery, {
} }
return { return {
left: left left: left
} };
}, },
getMiddleAdaptPosition: function (combo, popup) { getMiddleAdaptPosition: function (combo, popup) {
@ -398,7 +398,7 @@ BI.extend(jQuery, {
} }
return { return {
top: top top: top
} };
}, },
getComboPositionByDirections: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions) { getComboPositionByDirections: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions) {
@ -561,7 +561,7 @@ BI.extend(jQuery, {
var bodyHeight = $("body").bounds().height - extraHeight; var bodyHeight = $("body").bounds().height - extraHeight;
var maxHeight = Math.min(popup.attr("maxHeight") || bodyHeight, bodyHeight); var maxHeight = Math.min(popup.attr("maxHeight") || bodyHeight, bodyHeight);
popup.resetHeight && popup.resetHeight(maxHeight); popup.resetHeight && popup.resetHeight(maxHeight);
var position = $.getComboPositionByDirections(combo, popup, extraWidth, extraHeight, needAdaptHeight, directions || ['bottom', 'top', 'right', 'left']); var position = $.getComboPositionByDirections(combo, popup, extraWidth, extraHeight, needAdaptHeight, directions || ["bottom", "top", "right", "left"]);
switch (offsetStyle) { switch (offsetStyle) {
case "center": case "center":
if (position.change) { if (position.change) {

25
src/core/func/function.js

@ -67,7 +67,7 @@ BI.extend(BI.Func, {
return { return {
matched: matched, matched: matched,
finded: finded finded: finded
} };
} }
}); });
@ -113,10 +113,10 @@ BI.extend(BI.DOM, {
images[i] = new Image(); images[i] = new Image();
images[i].src = src; images[i].src = src;
images[i].onload = function () { images[i].onload = function () {
complete() complete();
}; };
images[i].onerror = function () { images[i].onerror = function () {
complete() complete();
}; };
}); });
}, },
@ -219,9 +219,9 @@ BI.extend(BI.DOM, {
}, },
int2hex: function (strNum) { int2hex: function (strNum) {
var hexdig = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; var hexdig = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
return hexdig[strNum >>> 4] + '' + hexdig[strNum & 15]; return hexdig[strNum >>> 4] + "" + hexdig[strNum & 15];
}, },
hex2rgb: function (color) { hex2rgb: function (color) {
@ -234,14 +234,13 @@ BI.extend(BI.DOM, {
var tempValue = "rgb(", colorArray; var tempValue = "rgb(", colorArray;
if (color.length === 7) { if (color.length === 7) {
colorArray = [BI.parseInt('0x' + color.substring(1, 3)), colorArray = [BI.parseInt("0x" + color.substring(1, 3)),
BI.parseInt('0x' + color.substring(3, 5)), BI.parseInt("0x" + color.substring(3, 5)),
BI.parseInt('0x' + color.substring(5, 7))]; BI.parseInt("0x" + color.substring(5, 7))];
} } else if (color.length === 4) {
else if (color.length === 4) { colorArray = [BI.parseInt("0x" + color.substring(1, 2)),
colorArray = [BI.parseInt('0x' + color.substring(1, 2)), BI.parseInt("0x" + color.substring(2, 3)),
BI.parseInt('0x' + color.substring(2, 3)), BI.parseInt("0x" + color.substring(3, 4))];
BI.parseInt('0x' + color.substring(3, 4))];
} }
tempValue += colorArray[0] + ","; tempValue += colorArray[0] + ",";
tempValue += colorArray[1] + ","; tempValue += colorArray[1] + ",";

31
src/core/inject.js

@ -1,4 +1,4 @@
;(function () { (function () {
var constantInjection = {}; var constantInjection = {};
BI.constant = function (xtype, cls) { BI.constant = function (xtype, cls) {
if (constantInjection[xtype] != null) { if (constantInjection[xtype] != null) {
@ -47,35 +47,36 @@
if (!providers[type]) { if (!providers[type]) {
providers[type] = new providerInjection[type](); providers[type] = new providerInjection[type]();
} }
return configFn(providers[type]) return configFn(providers[type]);
}
} }
BI.Plugin.registerWidget(type, configFn);
};
var actions = {} var actions = {};
BI.action = function (type, actionFn) { BI.action = function (type, actionFn) {
if (!actions[type]) { if (!actions[type]) {
actions[type] = []; actions[type] = [];
} }
actions[type].push(actionFn) actions[type].push(actionFn);
return function () { return function () {
actions[type].remove(actionFn); actions[type].remove(actionFn);
if (actions[type].length === 0) { if (actions[type].length === 0) {
delete actions[type]; delete actions[type];
} }
} };
} };
BI.Constants = { BI.Constants = {
getConstant: function (type) { getConstant: function (type) {
return constantInjection[type]; return constantInjection[type];
} }
} };
BI.Models = { BI.Models = {
getModel: function (type, config) { getModel: function (type, config) {
return new modelInjection[type](config); return new modelInjection[type](config);
} }
} };
var stores = {}; var stores = {};
@ -89,7 +90,7 @@
releaseStore: function (type) { releaseStore: function (type) {
delete stores[type]; delete stores[type];
} }
} };
var services = {}; var services = {};
@ -103,9 +104,9 @@
releaseService: function (type) { releaseService: function (type) {
delete services[type]; delete services[type];
} }
} };
var providers = {}, providerInstance = {} var providers = {}, providerInstance = {};
BI.Providers = { BI.Providers = {
getProvider: function (type, config) { getProvider: function (type, config) {
@ -121,13 +122,13 @@
delete providers[type]; delete providers[type];
delete providerInstance[type]; delete providerInstance[type];
} }
} };
BI.Actions = { BI.Actions = {
runAction: function (type, config) { runAction: function (type, config) {
BI.each(actions[type], function (i, act) { BI.each(actions[type], function (i, act) {
act(config); act(config);
}) });
}
} }
};
})(); })();

150
src/core/jquery.js vendored

@ -169,7 +169,7 @@ jQuery.fn = jQuery.prototype = {
return this; return this;
// HANDLE: $(#id) // HANDLE: $(#id)
} else { }
elem = document.getElementById( match[2] ); elem = document.getElementById( match[2] );
// Check parentNode to catch when Blackberry 4.6 returns // Check parentNode to catch when Blackberry 4.6 returns
@ -189,7 +189,7 @@ jQuery.fn = jQuery.prototype = {
this.context = document; this.context = document;
this.selector = selector; this.selector = selector;
return this; return this;
}
// HANDLE: $(expr, $(...)) // HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) { } else if ( !context || context.jquery ) {
@ -197,9 +197,9 @@ jQuery.fn = jQuery.prototype = {
// HANDLE: $(expr, context) // HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr) // (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
} }
return this.constructor( context ).find( selector );
// HANDLE: $(DOMElement) // HANDLE: $(DOMElement)
} else if ( selector.nodeType ) { } else if ( selector.nodeType ) {
@ -1739,10 +1739,10 @@ jQuery.extend({
// The following elements throw uncatchable exceptions if you // The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them. // attempt to add expando properties to them.
noData: { noData: {
"embed": true, embed: true,
// Ban all objects except for Flash (which handle expandos) // Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", object: "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"applet": true applet: true
}, },
hasData: function ( elem ) { hasData: function ( elem ) {
@ -2427,8 +2427,8 @@ jQuery.extend({
propFix: { propFix: {
tabindex: "tabIndex", tabindex: "tabIndex",
readonly: "readOnly", readonly: "readOnly",
"for": "htmlFor", for: "htmlFor",
"class": "className", class: "className",
maxlength: "maxLength", maxlength: "maxLength",
cellspacing: "cellSpacing", cellspacing: "cellSpacing",
cellpadding: "cellPadding", cellpadding: "cellPadding",
@ -2460,18 +2460,18 @@ jQuery.extend({
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret; return ret;
} else {
return ( elem[ name ] = value );
} }
return ( elem[ name ] = value );
} else {
}
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret; return ret;
} else {
return elem[ name ];
}
} }
return elem[ name ];
}, },
propHooks: { propHooks: {
@ -3780,18 +3780,18 @@ var i,
ridentifier = new RegExp( "^" + identifier + "$" ), ridentifier = new RegExp( "^" + identifier + "$" ),
matchExpr = { matchExpr = {
"ID": new RegExp( "^#(" + characterEncoding + ")" ), ID: new RegExp( "^#(" + characterEncoding + ")" ),
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), CLASS: new RegExp( "^\\.(" + characterEncoding + ")" ),
"NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), NAME: new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), TAG: new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
"ATTR": new RegExp( "^" + attributes ), ATTR: new RegExp( "^" + attributes ),
"PSEUDO": new RegExp( "^" + pseudos ), PSEUDO: new RegExp( "^" + pseudos ),
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + CHILD: new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ), "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
// For use in libraries implementing .is() // For use in libraries implementing .is()
// We use this for POS matching in `select` // We use this for POS matching in `select`
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + needsContext: new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
}, },
@ -4088,10 +4088,10 @@ setDocument = Sizzle.setDocument = function( node ) {
}) ? }) ?
{} : {} :
{ {
"href": function( elem ) { href: function ( elem ) {
return elem.getAttribute( "href", 2 ); return elem.getAttribute( "href", 2 );
}, },
"type": function( elem ) { type: function ( elem ) {
return elem.getAttribute("type"); return elem.getAttribute("type");
} }
}; };
@ -4525,12 +4525,12 @@ getText = Sizzle.getText = function( elem ) {
// innerText usage removed for consistency of new lines (see #11153) // innerText usage removed for consistency of new lines (see #11153)
if ( typeof elem.textContent === "string" ) { if ( typeof elem.textContent === "string" ) {
return elem.textContent; return elem.textContent;
} else { }
// Traverse its children // Traverse its children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
ret += getText( elem ); ret += getText( elem );
} }
}
} else if ( nodeType === 3 || nodeType === 4 ) { } else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue; return elem.nodeValue;
} }
@ -4558,7 +4558,7 @@ Expr = Sizzle.selectors = {
}, },
preFilter: { preFilter: {
"ATTR": function( match ) { ATTR: function ( match ) {
match[1] = match[1].replace( runescape, funescape ); match[1] = match[1].replace( runescape, funescape );
// Move the given value to match[3] whether quoted or unquoted // Move the given value to match[3] whether quoted or unquoted
@ -4571,7 +4571,7 @@ Expr = Sizzle.selectors = {
return match.slice( 0, 4 ); return match.slice( 0, 4 );
}, },
"CHILD": function( match ) { CHILD: function ( match ) {
/* matches from matchExpr["CHILD"] /* matches from matchExpr["CHILD"]
1 type (only|nth|...) 1 type (only|nth|...)
2 what (child|of-type) 2 what (child|of-type)
@ -4603,7 +4603,7 @@ Expr = Sizzle.selectors = {
return match; return match;
}, },
"PSEUDO": function( match ) { PSEUDO: function ( match ) {
var excess, var excess,
unquoted = !match[5] && match[2]; unquoted = !match[5] && match[2];
@ -4634,7 +4634,7 @@ Expr = Sizzle.selectors = {
filter: { filter: {
"TAG": function( nodeName ) { TAG: function ( nodeName ) {
if ( nodeName === "*" ) { if ( nodeName === "*" ) {
return function () { return true; }; return function () { return true; };
} }
@ -4645,7 +4645,7 @@ Expr = Sizzle.selectors = {
}; };
}, },
"CLASS": function( className ) { CLASS: function ( className ) {
var pattern = classCache[ className + " " ]; var pattern = classCache[ className + " " ];
return pattern || return pattern ||
@ -4655,7 +4655,7 @@ Expr = Sizzle.selectors = {
}); });
}, },
"ATTR": function( name, operator, check ) { ATTR: function ( name, operator, check ) {
return function ( elem ) { return function ( elem ) {
var result = Sizzle.attr( elem, name ); var result = Sizzle.attr( elem, name );
@ -4679,7 +4679,7 @@ Expr = Sizzle.selectors = {
}; };
}, },
"CHILD": function( type, what, argument, first, last ) { CHILD: function ( type, what, argument, first, last ) {
var simple = type.slice( 0, 3 ) !== "nth", var simple = type.slice( 0, 3 ) !== "nth",
forward = type.slice( -4 ) !== "last", forward = type.slice( -4 ) !== "last",
ofType = what === "of-type"; ofType = what === "of-type";
@ -4768,7 +4768,7 @@ Expr = Sizzle.selectors = {
}; };
}, },
"PSEUDO": function( pseudo, argument ) { PSEUDO: function ( pseudo, argument ) {
// pseudo-class names are case-insensitive // pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes // http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
@ -4808,7 +4808,7 @@ Expr = Sizzle.selectors = {
pseudos: { pseudos: {
// Potentially complex pseudos // Potentially complex pseudos
"not": markFunction(function( selector ) { not: markFunction(function ( selector ) {
// Trim the selector passed to compile // Trim the selector passed to compile
// to avoid treating leading and trailing // to avoid treating leading and trailing
// spaces as combinators // spaces as combinators
@ -4836,13 +4836,13 @@ Expr = Sizzle.selectors = {
}; };
}), }),
"has": markFunction(function( selector ) { has: markFunction(function ( selector ) {
return function ( elem ) { return function ( elem ) {
return Sizzle( selector, elem ).length > 0; return Sizzle( selector, elem ).length > 0;
}; };
}), }),
"contains": markFunction(function( text ) { contains: markFunction(function ( text ) {
return function ( elem ) { return function ( elem ) {
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
}; };
@ -4855,7 +4855,7 @@ Expr = Sizzle.selectors = {
// The matching of C against the element's language value is performed case-insensitively. // The matching of C against the element's language value is performed case-insensitively.
// The identifier C does not have to be a valid language name." // The identifier C does not have to be a valid language name."
// http://www.w3.org/TR/selectors/#lang-pseudo // http://www.w3.org/TR/selectors/#lang-pseudo
"lang": markFunction( function( lang ) { lang: markFunction( function ( lang ) {
// lang value must be a valid identifider // lang value must be a valid identifider
if ( !ridentifier.test(lang || "") ) { if ( !ridentifier.test(lang || "") ) {
Sizzle.error( "unsupported lang: " + lang ); Sizzle.error( "unsupported lang: " + lang );
@ -4877,36 +4877,36 @@ Expr = Sizzle.selectors = {
}), }),
// Miscellaneous // Miscellaneous
"target": function( elem ) { target: function ( elem ) {
var hash = window.location && window.location.hash; var hash = window.location && window.location.hash;
return hash && hash.slice( 1 ) === elem.id; return hash && hash.slice( 1 ) === elem.id;
}, },
"root": function( elem ) { root: function ( elem ) {
return elem === docElem; return elem === docElem;
}, },
"focus": function( elem ) { focus: function ( elem ) {
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
}, },
// Boolean properties // Boolean properties
"enabled": function( elem ) { enabled: function ( elem ) {
return elem.disabled === false; return elem.disabled === false;
}, },
"disabled": function( elem ) { disabled: function ( elem ) {
return elem.disabled === true; return elem.disabled === true;
}, },
"checked": function( elem ) { checked: function ( elem ) {
// In CSS3, :checked should return both checked and selected elements // In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase(); var nodeName = elem.nodeName.toLowerCase();
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
}, },
"selected": function( elem ) { selected: function ( elem ) {
// Accessing this property makes selected-by-default // Accessing this property makes selected-by-default
// options in Safari work properly // options in Safari work properly
if ( elem.parentNode ) { if ( elem.parentNode ) {
@ -4917,7 +4917,7 @@ Expr = Sizzle.selectors = {
}, },
// Contents // Contents
"empty": function( elem ) { empty: function ( elem ) {
// http://www.w3.org/TR/selectors/#empty-pseudo // http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
// not comment, processing instructions, or others // not comment, processing instructions, or others
@ -4931,25 +4931,25 @@ Expr = Sizzle.selectors = {
return true; return true;
}, },
"parent": function( elem ) { parent: function ( elem ) {
return !Expr.pseudos["empty"]( elem ); return !Expr.pseudos["empty"]( elem );
}, },
// Element/input types // Element/input types
"header": function( elem ) { header: function ( elem ) {
return rheader.test( elem.nodeName ); return rheader.test( elem.nodeName );
}, },
"input": function( elem ) { input: function ( elem ) {
return rinputs.test( elem.nodeName ); return rinputs.test( elem.nodeName );
}, },
"button": function( elem ) { button: function ( elem ) {
var name = elem.nodeName.toLowerCase(); var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === "button" || name === "button"; return name === "input" && elem.type === "button" || name === "button";
}, },
"text": function( elem ) { text: function ( elem ) {
var attr; var attr;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case // use getAttribute instead to test this case
@ -4959,19 +4959,19 @@ Expr = Sizzle.selectors = {
}, },
// Position-in-collection // Position-in-collection
"first": createPositionalPseudo(function() { first: createPositionalPseudo(function () {
return [ 0 ]; return [ 0 ];
}), }),
"last": createPositionalPseudo(function( matchIndexes, length ) { last: createPositionalPseudo(function ( matchIndexes, length ) {
return [ length - 1 ]; return [ length - 1 ];
}), }),
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) { eq: createPositionalPseudo(function ( matchIndexes, length, argument ) {
return [ argument < 0 ? argument + length : argument ]; return [ argument < 0 ? argument + length : argument ];
}), }),
"even": createPositionalPseudo(function( matchIndexes, length ) { even: createPositionalPseudo(function ( matchIndexes, length ) {
var i = 0; var i = 0;
for ( ; i < length; i += 2 ) { for ( ; i < length; i += 2 ) {
matchIndexes.push( i ); matchIndexes.push( i );
@ -4979,7 +4979,7 @@ Expr = Sizzle.selectors = {
return matchIndexes; return matchIndexes;
}), }),
"odd": createPositionalPseudo(function( matchIndexes, length ) { odd: createPositionalPseudo(function ( matchIndexes, length ) {
var i = 1; var i = 1;
for ( ; i < length; i += 2 ) { for ( ; i < length; i += 2 ) {
matchIndexes.push( i ); matchIndexes.push( i );
@ -4987,7 +4987,7 @@ Expr = Sizzle.selectors = {
return matchIndexes; return matchIndexes;
}), }),
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) { lt: createPositionalPseudo(function ( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument; var i = argument < 0 ? argument + length : argument;
for ( ; --i >= 0; ) { for ( ; --i >= 0; ) {
matchIndexes.push( i ); matchIndexes.push( i );
@ -4995,7 +4995,7 @@ Expr = Sizzle.selectors = {
return matchIndexes; return matchIndexes;
}), }),
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) { gt: createPositionalPseudo(function ( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument; var i = argument < 0 ? argument + length : argument;
for ( ; ++i < length; ) { for ( ; ++i < length; ) {
matchIndexes.push( i ); matchIndexes.push( i );
@ -5811,9 +5811,9 @@ function winnow( elements, qualifier, keep ) {
if ( isSimple.test( qualifier ) ) { if ( isSimple.test( qualifier ) ) {
return jQuery.filter(qualifier, filtered, !keep); return jQuery.filter(qualifier, filtered, !keep);
} else {
qualifier = jQuery.filter( qualifier, filtered );
} }
qualifier = jQuery.filter( qualifier, filtered );
} }
return jQuery.grep(elements, function ( elem ) { return jQuery.grep(elements, function ( elem ) {
@ -6183,7 +6183,7 @@ jQuery.fn.extend({
dataType: "script", dataType: "script",
async: false, async: false,
global: false, global: false,
"throws": true throws: true
}); });
} else { } else {
jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
@ -6781,22 +6781,22 @@ jQuery.extend({
// Exclude the following css properties to add px // Exclude the following css properties to add px
cssNumber: { cssNumber: {
"columnCount": true, columnCount: true,
"fillOpacity": true, fillOpacity: true,
"fontWeight": true, fontWeight: true,
"lineHeight": true, lineHeight: true,
"opacity": true, opacity: true,
"orphans": true, orphans: true,
"widows": true, widows: true,
"zIndex": true, zIndex: true,
"zoom": true zoom: true
}, },
// Add in properties whose names you wish to fix before // Add in properties whose names you wish to fix before
// setting or getting the value // setting or getting the value
cssProps: { cssProps: {
// normalize float css property // normalize float css property
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" float: jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
}, },
// Get and set the style property on a DOM Node // Get and set the style property on a DOM Node
@ -7227,7 +7227,7 @@ jQuery(function() {
if ( computed ) { if ( computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block // Work around by temporarily setting element display to inline-block
return jQuery.swap( elem, { "display": "inline-block" }, return jQuery.swap( elem, { display: "inline-block" },
curCSS, [ elem, "marginRight" ] ); curCSS, [ elem, "marginRight" ] );
} }
} }
@ -8734,10 +8734,10 @@ function Animation( elem, properties, options ) {
if ( percent < 1 && length ) { if ( percent < 1 && length ) {
return remaining; return remaining;
} else { }
deferred.resolveWith( elem, [ animation ] ); deferred.resolveWith( elem, [ animation ] );
return false; return false;
}
}, },
animation = deferred.promise({ animation = deferred.promise({
elem: elem, elem: elem,

2
src/core/listener/listener.show.js

@ -41,7 +41,7 @@ BI.ShowListener = BI.inherit(BI.OB, {
self.fireEvent(BI.ShowListener.EVENT_CHANGE, cardName); self.fireEvent(BI.ShowListener.EVENT_CHANGE, cardName);
}); });
} }
}) });
} }
}); });
BI.ShowListener.EVENT_CHANGE = "ShowListener.EVENT_CHANGE"; BI.ShowListener.EVENT_CHANGE = "ShowListener.EVENT_CHANGE";

6
src/core/loader/loader.style.js

@ -15,9 +15,9 @@ BI.StyleLoaderManager = BI.inherit(BI.OB, {
}, },
loadStyle: function (name, styleString) { loadStyle: function (name, styleString) {
var d = document, styles = d.createElement('style'); var d = document, styles = d.createElement("style");
d.getElementsByTagName('head')[0].appendChild(styles); d.getElementsByTagName("head")[0].appendChild(styles);
styles.setAttribute('type', 'text/css'); styles.setAttribute("type", "text/css");
if (styles.styleSheet) { if (styles.styleSheet) {
styles.styleSheet.cssText = styleString; styles.styleSheet.cssText = styleString;
} else { } else {

2
src/core/logic/logic.js

@ -59,7 +59,7 @@ BI.LogicFactory = {
el: item, el: item,
width: item.options.width, width: item.options.width,
height: item.options.height height: item.options.height
} };
} }
return item; return item;
}); });

8
src/core/logic/logic.layout.js

@ -42,7 +42,7 @@ BI.VerticalLayoutLogic = BI.inherit(BI.Logic, {
tgap: o.tgap, tgap: o.tgap,
bgap: o.bgap, bgap: o.bgap,
items: o.items items: o.items
} };
}, },
_init: function () { _init: function () {
@ -95,7 +95,7 @@ BI.HorizontalLayoutLogic = BI.inherit(BI.Logic, {
tgap: o.tgap, tgap: o.tgap,
bgap: o.bgap, bgap: o.bgap,
items: o.items items: o.items
} };
}, },
_init: function () { _init: function () {
@ -147,7 +147,7 @@ BI.TableLayoutLogic = BI.inherit(BI.Logic, {
hgap: o.hgap, hgap: o.hgap,
vgap: o.vgap, vgap: o.vgap,
items: o.items items: o.items
} };
}, },
_init: function () { _init: function () {
@ -203,7 +203,7 @@ BI.HorizontalFillLayoutLogic = BI.inherit(BI.Logic, {
tgap: o.tgap, tgap: o.tgap,
bgap: o.bgap, bgap: o.bgap,
items: o.items items: o.items
} };
}, },
_init: function () { _init: function () {

8
src/core/ob.js

@ -30,8 +30,8 @@ $.extend(BI.OB.prototype, {
var self = this; var self = this;
if (this.options.listeners != null) { if (this.options.listeners != null) {
$.each(this.options.listeners, function (i, lis) { $.each(this.options.listeners, function (i, lis) {
(lis.target ? lis.target : self)[lis.once ? 'once' : 'on'] (lis.target ? lis.target : self)[lis.once ? "once" : "on"]
(lis.eventName, _.bind(lis.action, self)) (lis.eventName, _.bind(lis.action, self));
}); });
delete this.options.listeners; delete this.options.listeners;
} }
@ -46,7 +46,7 @@ $.extend(BI.OB.prototype, {
_getEvents: function () { _getEvents: function () {
if (!$.isArray(this.events)) { if (!$.isArray(this.events)) {
this.events = [] this.events = [];
} }
return this.events; return this.events;
}, },
@ -97,7 +97,7 @@ $.extend(BI.OB.prototype, {
if (ifn != fn) { if (ifn != fn) {
newFns.push(ifn); newFns.push(ifn);
} }
}) });
this._getEvents()[eventName] = newFns; this._getEvents()[eventName] = newFns;
} }
} }

3
src/core/plugin.js

@ -1,6 +1,5 @@
BI.Plugin = BI.Plugin || {}; BI.Plugin = BI.Plugin || {};
; !(function () {
(function () {
var _WidgetsPlugin = {}; var _WidgetsPlugin = {};
var _ObjectPlugin = {}; var _ObjectPlugin = {};
BI.extend(BI.Plugin, { BI.extend(BI.Plugin, {

38
src/core/proto/date.js

@ -59,10 +59,10 @@ $(function () {
/** Adds the number of days array to the Date object. */ /** Adds the number of days array to the Date object. */
Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
}) });
/** Constants used for time computations */ /** Constants used for time computations */
Date.SECOND = 1000 /* milliseconds */; Date.SECOND = 1000;
Date.MINUTE = 60 * Date.SECOND; Date.MINUTE = 60 * Date.SECOND;
Date.HOUR = 60 * Date.MINUTE; Date.HOUR = 60 * Date.MINUTE;
Date.DAY = 24 * Date.HOUR; Date.DAY = 24 * Date.HOUR;
@ -79,14 +79,14 @@ Date.prototype.getTimezone = function () {
/** Returns the number of days in the current month */ /** Returns the number of days in the current month */
Date.prototype.getMonthDays = function (month) { Date.prototype.getMonthDays = function (month) {
var year = this.getFullYear(); var year = this.getFullYear();
if (typeof month == "undefined") { if (typeof month === "undefined") {
month = this.getMonth(); month = this.getMonth();
} }
if (((0 == (year % 4)) && ( (0 != (year % 100)) || (0 == (year % 400)))) && month == 1) { if (((0 == (year % 4)) && ( (0 != (year % 100)) || (0 == (year % 400)))) && month == 1) {
return 29; return 29;
} else {
return Date._MD[month];
} }
return Date._MD[month];
}; };
/** /**
@ -259,7 +259,7 @@ Date.prototype.print = function (str) {
s["%k"] = hr; // hour, range 0 to 23 (24h format) s["%k"] = hr; // hour, range 0 to 23 (24h format)
s["%l"] = ir; // hour, range 1 to 12 (12h format) s["%l"] = ir; // hour, range 1 to 12 (12h format)
s["%X"] = (m < 9) ? ("0" + (1 + m)) : (1 + m); // month, range 01 to 12 s["%X"] = (m < 9) ? ("0" + (1 + m)) : (1 + m); // month, range 01 to 12
s["%x"] = m + 1 // month, range 1 to 12 s["%x"] = m + 1; // month, range 1 to 12
s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59 s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59
s["%n"] = "\n"; // a newline character s["%n"] = "\n"; // a newline character
s["%p"] = pm ? "PM" : "AM"; s["%p"] = pm ? "PM" : "AM";
@ -275,7 +275,7 @@ Date.prototype.print = function (str) {
s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN) s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN)
// FIXME: %x : preferred date representation for the current locale without the time // FIXME: %x : preferred date representation for the current locale without the time
// FIXME: %X : preferred time representation for the current locale without the date // FIXME: %X : preferred time representation for the current locale without the date
s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) s["%y"] = ("" + y).substr(2, 2); // year without the century (range 00 to 99)
s["%Y"] = y; // year with the century s["%Y"] = y; // year with the century
s["%%"] = "%"; // a literal '%' character s["%%"] = "%"; // a literal '%' character
s["%Q"] = qr; s["%Q"] = qr;
@ -291,7 +291,7 @@ Date.prototype.print = function (str) {
for (var i = 0; i < a.length; i++) { for (var i = 0; i < a.length; i++) {
var tmp = s[a[i]]; var tmp = s[a[i]];
if (tmp) { if (tmp) {
re = new RegExp(a[i], 'g'); re = new RegExp(a[i], "g");
str = str.replace(re, tmp); str = str.replace(re, tmp);
} }
} }
@ -326,25 +326,25 @@ Date.checkVoid = function (YY, MM, DD, minDate, maxDate) {
minDate = BI.isString(minDate) ? minDate.match(/\d+/g) : minDate; minDate = BI.isString(minDate) ? minDate.match(/\d+/g) : minDate;
maxDate = BI.isString(maxDate) ? maxDate.match(/\d+/g) : maxDate; maxDate = BI.isString(maxDate) ? maxDate.match(/\d+/g) : maxDate;
if (YY < minDate[0]) { if (YY < minDate[0]) {
back = ['y']; back = ["y"];
} else if (YY > maxDate[0]) { } else if (YY > maxDate[0]) {
back = ['y', 1]; back = ["y", 1];
} else if (YY >= minDate[0] && YY <= maxDate[0]) { } else if (YY >= minDate[0] && YY <= maxDate[0]) {
if (YY == minDate[0]) { if (YY == minDate[0]) {
if (MM < minDate[1]) { if (MM < minDate[1]) {
back = ['m']; back = ["m"];
} else if (MM == minDate[1]) { } else if (MM == minDate[1]) {
if (DD < minDate[2]) { if (DD < minDate[2]) {
back = ['d']; back = ["d"];
} }
} }
} }
if (YY == maxDate[0]) { if (YY == maxDate[0]) {
if (MM > maxDate[1]) { if (MM > maxDate[1]) {
back = ['m', 1]; back = ["m", 1];
} else if (MM == maxDate[1]) { } else if (MM == maxDate[1]) {
if (DD > maxDate[2]) { if (DD > maxDate[2]) {
back = ['d', 1]; back = ["d", 1];
} }
} }
} }
@ -373,7 +373,7 @@ Date.parseDateTime = function (str, fmt) {
var d = 1; var d = 1;
// wei : 对于fmt为‘YYYYMM’或者‘YYYYMMdd’的格式,str的值为类似'201111'的形式,因为年月之间没有分隔符,所以正则表达式分割无效,导致bug7376。 // wei : 对于fmt为‘YYYYMM’或者‘YYYYMMdd’的格式,str的值为类似'201111'的形式,因为年月之间没有分隔符,所以正则表达式分割无效,导致bug7376。
var a = str.split(/\W+/); var a = str.split(/\W+/);
if (fmt.toLowerCase() == '%y%x' || fmt.toLowerCase() == '%y%x%d') { if (fmt.toLowerCase() == "%y%x" || fmt.toLowerCase() == "%y%x%d") {
var yearlength = 4; var yearlength = 4;
var otherlength = 2; var otherlength = 2;
a[0] = str.substring(0, yearlength); a[0] = str.substring(0, yearlength);
@ -505,16 +505,16 @@ Date.getDate = function () {
var localOffset = dt.getTimezoneOffset() * 60000; // 获得当地时间偏移的毫秒数 var localOffset = dt.getTimezoneOffset() * 60000; // 获得当地时间偏移的毫秒数
var utc = localTime + localOffset; // utc即GMT时间标准时区 var utc = localTime + localOffset; // utc即GMT时间标准时区
return new Date(utc + Date.timeZone);// + Pool.timeZone.offset); return new Date(utc + Date.timeZone);// + Pool.timeZone.offset);
}else{
return dt;
} }
return dt;
}; };
Date.getTime = function () { Date.getTime = function () {
var dt = Function.prototype.bind.apply(Date.getDate, BI.concat([null], [].slice.apply(arguments)))(); var dt = Function.prototype.bind.apply(Date.getDate, BI.concat([null], [].slice.apply(arguments)))();
if(BI.isNotNull(Date.timeZone)) { if(BI.isNotNull(Date.timeZone)) {
return dt.getTime() - Date.timeZone - dt.getTimezoneOffset() * 60000; return dt.getTime() - Date.timeZone - dt.getTimezoneOffset() * 60000;
}else{
return dt.getTime();
} }
return dt.getTime();
}; };

4
src/core/proto/function.js

@ -5,7 +5,7 @@ Function.prototype.before = function (func) {
return false; return false;
} }
return __self.apply(this, arguments); return __self.apply(this, arguments);
} };
}; };
Function.prototype.after = function (func) { Function.prototype.after = function (func) {
@ -17,5 +17,5 @@ Function.prototype.after = function (func) {
} }
func.apply(this, arguments); func.apply(this, arguments);
return ret; return ret;
} };
}; };

21
src/core/proto/jquery.js vendored

@ -6,10 +6,10 @@ if (jQuery) {
var p = this.padding(), var p = this.padding(),
b = this.border(); b = this.border();
return { return {
'top': p.top, top: p.top,
'bottom': p.bottom + b.bottom + b.top, bottom: p.bottom + b.bottom + b.top,
'left': p.left, left: p.left,
'right': p.right + b.right + b.left right: p.right + b.right + b.left
}; };
}; };
} }
@ -41,19 +41,18 @@ if (jQuery) {
this.css(tmp); this.css(tmp);
return this; return this;
} }
else {
// richer:注意此方法只对可见元素有效 // richer:注意此方法只对可见元素有效
tmp = this.position(); tmp = this.position();
return { return {
'x': tmp.left, x: tmp.left,
'y': tmp.top, y: tmp.top,
// richer:这里计算外部宽度和高度的时候,都不包括边框 // richer:这里计算外部宽度和高度的时候,都不包括边框
'width': this.outerWidth(), width: this.outerWidth(),
'height': this.outerHeight() height: this.outerHeight()
}; };
}
}; };
} }
})(jQuery); })(jQuery);
} }
;

46
src/core/proto/number.js

@ -1,5 +1,5 @@
if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' || if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== "0.000" ||
(0.9).toFixed(0) === '0' || (1.255).toFixed(2) !== '1.25' || (0.9).toFixed(0) === "0" || (1.255).toFixed(2) !== "1.25" ||
(1000000000000000128).toFixed(0) !== "1000000000000000128") { (1000000000000000128).toFixed(0) !== "1000000000000000128") {
(function () { (function () {
var base, size, data, i; var base, size, data, i;
@ -26,14 +26,14 @@ if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' ||
function toString () { function toString () {
var i = size; var i = size;
var s = ''; var s = "";
while (--i >= 0) { while (--i >= 0) {
if (s !== '' || i === 0 || data[i] !== 0) { if (s !== "" || i === 0 || data[i] !== 0) {
var t = String(data[i]); var t = String(data[i]);
if (s === '') { if (s === "") {
s = t; s = t;
} else { } else {
s += '0000000'.slice(0, 7 - t.length) + t; s += "0000000".slice(0, 7 - t.length) + t;
} }
} }
} }
@ -64,7 +64,7 @@ if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' ||
f = f !== f ? 0 : Math.floor(f); f = f !== f ? 0 : Math.floor(f);
if (f < 0 || f > 20) { if (f < 0 || f > 20) {
throw new RangeError('Number.toFixed called with invalid number of decimals'); throw new RangeError("Number.toFixed called with invalid number of decimals");
} }
x = Number(this); x = Number(this);
@ -119,7 +119,7 @@ if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' ||
} else { } else {
multiply(0, z); multiply(0, z);
multiply(1 << (-e), 0); multiply(1 << (-e), 0);
m = toString() + '0.00000000000000000000'.slice(2, 2 + f); m = toString() + "0.00000000000000000000".slice(2, 2 + f);
} }
} }
@ -127,16 +127,16 @@ if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' ||
k = m.length; k = m.length;
if (k <= f) { if (k <= f) {
m = s + '0.0000000000000000000'.slice(0, f - k + 2) + m; m = s + "0.0000000000000000000".slice(0, f - k + 2) + m;
} else { } else {
m = s + m.slice(0, k - f) + '.' + m.slice(k - f); m = s + m.slice(0, k - f) + "." + m.slice(k - f);
} }
} else { } else {
m = s + m; m = s + m;
} }
return m; return m;
} };
})(); })();
} }
@ -152,14 +152,12 @@ function accAdd(arg1, arg2) {
var r1, r2, m, c; var r1, r2, m, c;
try { try {
r1 = arg1.toString().split(".")[1].length; r1 = arg1.toString().split(".")[1].length;
} } catch (e) {
catch (e) {
r1 = 0; r1 = 0;
} }
try { try {
r2 = arg2.toString().split(".")[1].length; r2 = arg2.toString().split(".")[1].length;
} } catch (e) {
catch (e) {
r2 = 0; r2 = 0;
} }
c = Math.abs(r1 - r2); c = Math.abs(r1 - r2);
@ -194,14 +192,12 @@ function accSub(arg1, arg2) {
var r1, r2, m, n; var r1, r2, m, n;
try { try {
r1 = arg1.toString().split(".")[1].length; r1 = arg1.toString().split(".")[1].length;
} } catch (e) {
catch (e) {
r1 = 0; r1 = 0;
} }
try { try {
r2 = arg2.toString().split(".")[1].length; r2 = arg2.toString().split(".")[1].length;
} } catch (e) {
catch (e) {
r2 = 0; r2 = 0;
} }
m = Math.pow(10, Math.max(r1, r2)); // last modify by deeka //动态控制精度长度 m = Math.pow(10, Math.max(r1, r2)); // last modify by deeka //动态控制精度长度
@ -223,13 +219,11 @@ function accMul(arg1, arg2) {
var m = 0, s1 = arg1.toString(), s2 = arg2.toString(); var m = 0, s1 = arg1.toString(), s2 = arg2.toString();
try { try {
m += s1.split(".")[1].length; m += s1.split(".")[1].length;
} } catch (e) {
catch (e) {
} }
try { try {
m += s2.split(".")[1].length; m += s2.split(".")[1].length;
} } catch (e) {
catch (e) {
} }
return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m); return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
} }
@ -248,13 +242,11 @@ function accDiv(arg1, arg2) {
var t1 = 0, t2 = 0, r1, r2; var t1 = 0, t2 = 0, r1, r2;
try { try {
t1 = arg1.toString().split(".")[1].length; t1 = arg1.toString().split(".")[1].length;
} } catch (e) {
catch (e) {
} }
try { try {
t2 = arg2.toString().split(".")[1].length; t2 = arg2.toString().split(".")[1].length;
} } catch (e) {
catch (e) {
} }
with (Math) { with (Math) {
r1 = Number(arg1.toString().replace(".", "")); r1 = Number(arg1.toString().replace(".", ""));

8
src/core/proto/string.js

@ -61,7 +61,7 @@ $.extend(String.prototype, {
src += "&"; src += "&";
} }
$.each(paras, function (name, value) { $.each(paras, function (name, value) {
if (typeof(name) === 'string') { if (typeof(name) === "string") {
src += name + "=" + value + "&"; src += name + "=" + value + "&";
} }
}); });
@ -85,9 +85,9 @@ $.extend(String.prototype, {
perfectStart: function (start) { perfectStart: function (start) {
if (this.startWith(start)) { if (this.startWith(start)) {
return this; return this;
} else {
return start + this;
} }
return start + this;
}, },
/** /**
@ -96,7 +96,7 @@ $.extend(String.prototype, {
* @return {Number[]} 子字符串在父字符串中出现的所有位置组成的数组 * @return {Number[]} 子字符串在父字符串中出现的所有位置组成的数组
*/ */
allIndexOf: function (sub) { allIndexOf: function (sub) {
if (typeof sub != 'string') { if (typeof sub !== "string") {
return []; return [];
} }
var str = this; var str = this;

124
src/core/underscore.js

@ -45,8 +45,8 @@
// Export the Underscore object for **Node.js**, with // Export the Underscore object for **Node.js**, with
// backwards-compatibility for the old `require()` API. If we're in // backwards-compatibility for the old `require()` API. If we're in
// the browser, add `_` as a global object. // the browser, add `_` as a global object.
if (typeof exports !== 'undefined') { if (typeof exports !== "undefined") {
if (typeof module !== 'undefined' && module.exports) { if (typeof module !== "undefined" && module.exports) {
exports = module.exports = _; exports = module.exports = _;
} }
exports._ = _; exports._ = _;
@ -55,7 +55,7 @@
} }
// Current version. // Current version.
_.VERSION = '1.8.2'; _.VERSION = "1.8.2";
// Internal function that returns an efficient (for current engines) version // Internal function that returns an efficient (for current engines) version
// of the passed-in callback, to be repeatedly applied in other Underscore // of the passed-in callback, to be repeatedly applied in other Underscore
@ -128,7 +128,7 @@
var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1; var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
var isArrayLike = function (collection) { var isArrayLike = function (collection) {
var length = collection != null && collection.length; var length = collection != null && collection.length;
return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX; return typeof length === "number" && length >= 0 && length <= MAX_ARRAY_INDEX;
}; };
// Collection Functions // Collection Functions
@ -256,7 +256,7 @@
// Aliased as `includes` and `include`. // Aliased as `includes` and `include`.
_.contains = _.includes = _.include = function (obj, target, fromIndex) { _.contains = _.includes = _.include = function (obj, target, fromIndex) {
if (!isArrayLike(obj)) obj = _.values(obj); if (!isArrayLike(obj)) obj = _.values(obj);
return _.indexOf(obj, target, typeof fromIndex == 'number' && fromIndex) >= 0; return _.indexOf(obj, target, typeof fromIndex === "number" && fromIndex) >= 0;
}; };
// Invoke a method (with arguments) on every item in a collection. // Invoke a method (with arguments) on every item in a collection.
@ -378,7 +378,7 @@
if (a < b || b === void 0) return -1; if (a < b || b === void 0) return -1;
} }
return left.index - right.index; return left.index - right.index;
}), 'value'); }), "value");
}; };
// An internal function used for aggregate "group by" operations. // An internal function used for aggregate "group by" operations.
@ -579,7 +579,7 @@
// Complement of _.zip. Unzip accepts an array of arrays and groups // Complement of _.zip. Unzip accepts an array of arrays and groups
// each array's elements on shared indices // each array's elements on shared indices
_.unzip = function (array) { _.unzip = function (array) {
var length = array && _.max(array, 'length').length || 0; var length = array && _.max(array, "length").length || 0;
var result = Array(length); var result = Array(length);
for (var index = 0; index < length; index++) { for (var index = 0; index < length; index++) {
@ -609,7 +609,7 @@
// for **isSorted** to use binary search. // for **isSorted** to use binary search.
_.indexOf = function (array, item, isSorted) { _.indexOf = function (array, item, isSorted) {
var i = 0, length = array && array.length; var i = 0, length = array && array.length;
if (typeof isSorted == 'number') { if (typeof isSorted === "number") {
i = isSorted < 0 ? Math.max(0, length + isSorted) : isSorted; i = isSorted < 0 ? Math.max(0, length + isSorted) : isSorted;
} else if (isSorted && length) { } else if (isSorted && length) {
i = _.sortedIndex(array, item); i = _.sortedIndex(array, item);
@ -624,7 +624,7 @@
_.lastIndexOf = function (array, item, from) { _.lastIndexOf = function (array, item, from) {
var idx = array ? array.length : 0; var idx = array ? array.length : 0;
if (typeof from == 'number') { if (typeof from === "number") {
idx = from < 0 ? idx + from + 1 : Math.min(idx, from + 1); idx = from < 0 ? idx + from + 1 : Math.min(idx, from + 1);
} }
if (item !== item) { if (item !== item) {
@ -703,7 +703,7 @@
// available. // available.
_.bind = function (func, context) { _.bind = function (func, context) {
if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function'); if (!_.isFunction(func)) throw new TypeError("Bind must be called on a function");
var args = slice.call(arguments, 2); var args = slice.call(arguments, 2);
var bound = function () { var bound = function () {
return executeBound(func, bound, context, this, args.concat(slice.call(arguments))); return executeBound(func, bound, context, this, args.concat(slice.call(arguments)));
@ -733,7 +733,7 @@
// defined on an object belong to it. // defined on an object belong to it.
_.bindAll = function (obj) { _.bindAll = function (obj) {
var i, length = arguments.length, key; var i, length = arguments.length, key;
if (length <= 1) throw new Error('bindAll must be passed function names'); if (length <= 1) throw new Error("bindAll must be passed function names");
for (i = 1; i < length; i++) { for (i = 1; i < length; i++) {
key = arguments[i]; key = arguments[i];
obj[key] = _.bind(obj[key], obj); obj[key] = _.bind(obj[key], obj);
@ -745,7 +745,7 @@
_.memoize = function (func, hasher) { _.memoize = function (func, hasher) {
var memoize = function (key) { var memoize = function (key) {
var cache = memoize.cache; var cache = memoize.cache;
var address = '' + (hasher ? hasher.apply(this, arguments) : key); var address = "" + (hasher ? hasher.apply(this, arguments) : key);
if (!_.has(cache, address)) cache[address] = func.apply(this, arguments); if (!_.has(cache, address)) cache[address] = func.apply(this, arguments);
return cache[address]; return cache[address];
}; };
@ -895,9 +895,9 @@
// ---------------- // ----------------
// Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed. // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString'); var hasEnumBug = !{toString: null}.propertyIsEnumerable("toString");
var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString', var nonEnumerableProps = ["valueOf", "isPrototypeOf", "toString",
'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; "propertyIsEnumerable", "hasOwnProperty", "toLocaleString"];
function collectNonEnumProps (obj, keys) { function collectNonEnumProps (obj, keys) {
var nonEnumIdx = nonEnumerableProps.length; var nonEnumIdx = nonEnumerableProps.length;
@ -905,7 +905,7 @@
var proto = (_.isFunction(constructor) && constructor.prototype) || ObjProto; var proto = (_.isFunction(constructor) && constructor.prototype) || ObjProto;
// Constructor is a special case. // Constructor is a special case.
var prop = 'constructor'; var prop = "constructor";
if (_.has(obj, prop) && !_.contains(keys, prop)) keys.push(prop); if (_.has(obj, prop) && !_.contains(keys, prop)) keys.push(prop);
while (nonEnumIdx--) { while (nonEnumIdx--) {
@ -1099,36 +1099,36 @@
if (className !== toString.call(b)) return false; if (className !== toString.call(b)) return false;
switch (className) { switch (className) {
// Strings, numbers, regular expressions, dates, and booleans are compared by value. // Strings, numbers, regular expressions, dates, and booleans are compared by value.
case '[object RegExp]': case "[object RegExp]":
// RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
case '[object String]': case "[object String]":
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
// equivalent to `new String("5")`. // equivalent to `new String("5")`.
return '' + a === '' + b; return "" + a === "" + b;
case '[object Number]': case "[object Number]":
// `NaN`s are equivalent, but non-reflexive. // `NaN`s are equivalent, but non-reflexive.
// Object(NaN) is equivalent to NaN // Object(NaN) is equivalent to NaN
if (+a !== +a) return +b !== +b; if (+a !== +a) return +b !== +b;
// An `egal` comparison is performed for other numeric values. // An `egal` comparison is performed for other numeric values.
return +a === 0 ? 1 / +a === 1 / b : +a === +b; return +a === 0 ? 1 / +a === 1 / b : +a === +b;
case '[object Date]': case "[object Date]":
case '[object Boolean]': case "[object Boolean]":
// Coerce dates and booleans to numeric primitive values. Dates are compared by their // Coerce dates and booleans to numeric primitive values. Dates are compared by their
// millisecond representations. Note that invalid dates with millisecond representations // millisecond representations. Note that invalid dates with millisecond representations
// of `NaN` are not equivalent. // of `NaN` are not equivalent.
return +a === +b; return +a === +b;
} }
var areArrays = className === '[object Array]'; var areArrays = className === "[object Array]";
if (!areArrays) { if (!areArrays) {
if (typeof a != 'object' || typeof b != 'object') return false; if (typeof a !== "object" || typeof b !== "object") return false;
// Objects with different constructors are not equivalent, but `Object`s or `Array`s // Objects with different constructors are not equivalent, but `Object`s or `Array`s
// from different frames are. // from different frames are.
var aCtor = a.constructor, bCtor = b.constructor; var aCtor = a.constructor, bCtor = b.constructor;
if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor && if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor &&
_.isFunction(bCtor) && bCtor instanceof bCtor) _.isFunction(bCtor) && bCtor instanceof bCtor)
&& ('constructor' in a && 'constructor' in b)) { && ("constructor" in a && "constructor" in b)) {
return false; return false;
} }
} }
@ -1198,19 +1198,19 @@
// Is a given value an array? // Is a given value an array?
// Delegates to ECMA5's native Array.isArray // Delegates to ECMA5's native Array.isArray
_.isArray = nativeIsArray || function (obj) { _.isArray = nativeIsArray || function (obj) {
return toString.call(obj) === '[object Array]'; return toString.call(obj) === "[object Array]";
}; };
// Is a given variable an object? // Is a given variable an object?
_.isObject = function (obj) { _.isObject = function (obj) {
var type = typeof obj; var type = typeof obj;
return type === 'function' || type === 'object' && !!obj; return type === "function" || type === "object" && !!obj;
}; };
// Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError. // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError.
_.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error'], function(name) { _.each(["Arguments", "Function", "String", "Number", "Date", "RegExp", "Error"], function (name) {
_['is' + name] = function(obj) { _["is" + name] = function (obj) {
return toString.call(obj) === '[object ' + name + ']'; return toString.call(obj) === "[object " + name + "]";
}; };
}); });
@ -1218,15 +1218,15 @@
// there isn't any inspectable "Arguments" type. // there isn't any inspectable "Arguments" type.
if (!_.isArguments(arguments)) { if (!_.isArguments(arguments)) {
_.isArguments = function (obj) { _.isArguments = function (obj) {
return _.has(obj, 'callee'); return _.has(obj, "callee");
}; };
} }
// Optimize `isFunction` if appropriate. Work around some typeof bugs in old v8, // Optimize `isFunction` if appropriate. Work around some typeof bugs in old v8,
// IE 11 (#1621), and in Safari 8 (#1929). // IE 11 (#1621), and in Safari 8 (#1929).
if (typeof /./ != 'function' && typeof Int8Array != 'object') { if (typeof /./ !== "function" && typeof Int8Array !== "object") {
_.isFunction = function (obj) { _.isFunction = function (obj) {
return typeof obj == 'function' || false; return typeof obj === "function" || false;
}; };
} }
@ -1242,7 +1242,7 @@
// Is a given value a boolean? // Is a given value a boolean?
_.isBoolean = function (obj) { _.isBoolean = function (obj) {
return obj === true || obj === false || toString.call(obj) === '[object Boolean]'; return obj === true || obj === false || toString.call(obj) === "[object Boolean]";
}; };
// Is a given value equal to null? // Is a given value equal to null?
@ -1331,12 +1331,12 @@
// List of HTML entities for escaping. // List of HTML entities for escaping.
var escapeMap = { var escapeMap = {
'&': '&amp;', "&": "&amp;",
'<': '&lt;', "<": "&lt;",
'>': '&gt;', ">": "&gt;",
'"': '&quot;', "\"": "&quot;",
"'": '&#x27;', "'": "&#x27;",
'`': '&#x60;' "`": "&#x60;"
}; };
var unescapeMap = _.invert(escapeMap); var unescapeMap = _.invert(escapeMap);
@ -1346,11 +1346,11 @@
return map[match]; return map[match];
}; };
// Regexes for identifying a key that needs to be escaped // Regexes for identifying a key that needs to be escaped
var source = '(?:' + _.keys(map).join('|') + ')'; var source = "(?:" + _.keys(map).join("|") + ")";
var testRegexp = RegExp(source); var testRegexp = RegExp(source);
var replaceRegexp = RegExp(source, 'g'); var replaceRegexp = RegExp(source, "g");
return function (string) { return function (string) {
string = string == null ? '' : '' + string; string = string == null ? "" : "" + string;
return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string; return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
}; };
}; };
@ -1371,7 +1371,7 @@
// Useful for temporary DOM ids. // Useful for temporary DOM ids.
var idCounter = 0; var idCounter = 0;
_.uniqueId = function (prefix) { _.uniqueId = function (prefix) {
var id = ++idCounter + ''; var id = ++idCounter + "";
return prefix ? prefix + id : id; return prefix ? prefix + id : id;
}; };
@ -1392,17 +1392,17 @@
// string literal. // string literal.
var escapes = { var escapes = {
"'": "'", "'": "'",
'\\': '\\', "\\": "\\",
'\r': 'r', "\r": "r",
'\n': 'n', "\n": "n",
'\u2028': 'u2028', "\u2028": "u2028",
'\u2029': 'u2029' "\u2029": "u2029"
}; };
var escaper = /\\|'|\r|\n|\u2028|\u2029/g; var escaper = /\\|'|\r|\n|\u2028|\u2029/g;
var escapeChar = function (match) { var escapeChar = function (match) {
return '\\' + escapes[match]; return "\\" + escapes[match];
}; };
// JavaScript micro-templating, similar to John Resig's implementation. // JavaScript micro-templating, similar to John Resig's implementation.
@ -1418,7 +1418,7 @@
(settings.escape || noMatch).source, (settings.escape || noMatch).source,
(settings.interpolate || noMatch).source, (settings.interpolate || noMatch).source,
(settings.evaluate || noMatch).source (settings.evaluate || noMatch).source
].join('|') + '|$', 'g'); ].join("|") + "|$", "g");
// Compile the template source, escaping string literals appropriately. // Compile the template source, escaping string literals appropriately.
var index = 0; var index = 0;
@ -1441,14 +1441,14 @@
source += "';\n"; source += "';\n";
// If a variable is not specified, place data values in local scope. // If a variable is not specified, place data values in local scope.
if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n'; if (!settings.variable) source = "with(obj||{}){\n" + source + "}\n";
source = "var __t,__p='',__j=Array.prototype.join," + source = "var __t,__p='',__j=Array.prototype.join," +
"print=function(){__p+=__j.call(arguments,'');};\n" + "print=function(){__p+=__j.call(arguments,'');};\n" +
source + 'return __p;\n'; source + "return __p;\n";
try { try {
var render = new Function(settings.variable || 'obj', '_', source); var render = new Function(settings.variable || "obj", "_", source);
} catch (e) { } catch (e) {
e.source = source; e.source = source;
throw e; throw e;
@ -1459,8 +1459,8 @@
}; };
// Provide the compiled source as a convenience for precompilation. // Provide the compiled source as a convenience for precompilation.
var argument = settings.variable || 'obj'; var argument = settings.variable || "obj";
template.source = 'function(' + argument + '){\n' + source + '}'; template.source = "function(" + argument + "){\n" + source + "}";
return template; return template;
}; };
@ -1499,18 +1499,18 @@
_.mixin(_); _.mixin(_);
// Add all mutator Array functions to the wrapper. // Add all mutator Array functions to the wrapper.
_.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { _.each(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function (name) {
var method = ArrayProto[name]; var method = ArrayProto[name];
_.prototype[name] = function () { _.prototype[name] = function () {
var obj = this._wrapped; var obj = this._wrapped;
method.apply(obj, arguments); method.apply(obj, arguments);
if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0]; if ((name === "shift" || name === "splice") && obj.length === 0) delete obj[0];
return result(this, obj); return result(this, obj);
}; };
}); });
// Add all accessor Array functions to the wrapper. // Add all accessor Array functions to the wrapper.
_.each(['concat', 'join', 'slice'], function(name) { _.each(["concat", "join", "slice"], function (name) {
var method = ArrayProto[name]; var method = ArrayProto[name];
_.prototype[name] = function () { _.prototype[name] = function () {
return result(this, method.apply(this._wrapped, arguments)); return result(this, method.apply(this._wrapped, arguments));
@ -1527,7 +1527,7 @@
_.prototype.valueOf = _.prototype.toJSON = _.prototype.value; _.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
_.prototype.toString = function () { _.prototype.toString = function () {
return '' + this._wrapped; return "" + this._wrapped;
}; };
// AMD registration happens at the end for compatibility with AMD loaders // AMD registration happens at the end for compatibility with AMD loaders
@ -1537,8 +1537,8 @@
// popular enough to be bundled in a third party lib, but not be part of // popular enough to be bundled in a third party lib, but not be part of
// an AMD load request. Those cases could generate an error when an // an AMD load request. Those cases could generate an error when an
// anonymous define() is called outside of a loader request. // anonymous define() is called outside of a loader request.
if (typeof define === 'function' && define.amd) { if (typeof define === "function" && define.amd) {
define('underscore', [], function() { define("underscore", [], function () {
return _; return _;
}); });
} }

4
src/core/utils/base64.js

@ -1,4 +1,4 @@
;
!(function () { !(function () {
var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
@ -126,5 +126,5 @@
return output; return output;
} }
}) });
})(); })();

4
src/core/utils/cache.js

@ -61,9 +61,7 @@ BI.Cache = {
}, },
getCookie: function (name) { getCookie: function (name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
if (arr = document.cookie.match(reg)) if (arr = document.cookie.match(reg)) {return unescape(arr[2]);}
return unescape(arr[2]);
else
return null; return null;
}, },
deleteCookie: function (name, path) { deleteCookie: function (name, path) {

40
src/core/utils/cellSizeAndPositionManager.js

@ -59,12 +59,12 @@ BI.CellSizeAndPositionManager.prototype = {
: { : {
offset: 0, offset: 0,
size: 0 size: 0
} };
}, },
getTotalSize: function () { getTotalSize: function () {
var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell(); var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell();
return lastMeasuredCellSizeAndPosition.offset + lastMeasuredCellSizeAndPosition.size + (this._cellCount - this._lastMeasuredIndex - 1) * this._estimatedCellSize return lastMeasuredCellSizeAndPosition.offset + lastMeasuredCellSizeAndPosition.size + (this._cellCount - this._lastMeasuredIndex - 1) * this._estimatedCellSize;
}, },
getUpdatedOffsetForIndex: function (align, containerSize, currentOffset, targetIndex) { getUpdatedOffsetForIndex: function (align, containerSize, currentOffset, targetIndex) {
@ -75,13 +75,13 @@ BI.CellSizeAndPositionManager.prototype = {
var idealOffset; var idealOffset;
switch (align) { switch (align) {
case 'start': case "start":
idealOffset = maxOffset; idealOffset = maxOffset;
break; break;
case 'end': case "end":
idealOffset = minOffset; idealOffset = minOffset;
break; break;
case 'center': case "center":
idealOffset = maxOffset - ((containerSize - datum.size) / 2); idealOffset = maxOffset - ((containerSize - datum.size) / 2);
break; break;
default: default:
@ -98,7 +98,7 @@ BI.CellSizeAndPositionManager.prototype = {
var totalSize = this.getTotalSize(); var totalSize = this.getTotalSize();
if (totalSize === 0) { if (totalSize === 0) {
return {} return {};
} }
var maxOffset = offset + containerSize; var maxOffset = offset + containerSize;
@ -117,11 +117,11 @@ BI.CellSizeAndPositionManager.prototype = {
return { return {
start: start, start: start,
stop: stop stop: stop
} };
}, },
resetCell: function (index) { resetCell: function (index) {
this._lastMeasuredIndex = Math.min(this._lastMeasuredIndex, index - 1) this._lastMeasuredIndex = Math.min(this._lastMeasuredIndex, index - 1);
}, },
_binarySearch: function (high, low, offset) { _binarySearch: function (high, low, offset) {
@ -169,15 +169,15 @@ BI.CellSizeAndPositionManager.prototype = {
if (lastMeasuredCellSizeAndPosition.offset >= offset) { if (lastMeasuredCellSizeAndPosition.offset >= offset) {
return this._binarySearch(lastMeasuredIndex, 0, offset); return this._binarySearch(lastMeasuredIndex, 0, offset);
} else {
return this._exponentialSearch(lastMeasuredIndex, offset);
} }
return this._exponentialSearch(lastMeasuredIndex, offset);
} }
}; };
BI.ScalingCellSizeAndPositionManager = function (cellCount, cellSizeGetter, estimatedCellSize, maxScrollSize) { BI.ScalingCellSizeAndPositionManager = function (cellCount, cellSizeGetter, estimatedCellSize, maxScrollSize) {
this._cellSizeAndPositionManager = new BI.CellSizeAndPositionManager(cellCount, cellSizeGetter, estimatedCellSize); this._cellSizeAndPositionManager = new BI.CellSizeAndPositionManager(cellCount, cellSizeGetter, estimatedCellSize);
this._maxScrollSize = maxScrollSize || 10000000 this._maxScrollSize = maxScrollSize || 10000000;
}; };
BI.ScalingCellSizeAndPositionManager.prototype = { BI.ScalingCellSizeAndPositionManager.prototype = {
@ -188,15 +188,15 @@ BI.ScalingCellSizeAndPositionManager.prototype = {
}, },
getCellCount: function () { getCellCount: function () {
return this._cellSizeAndPositionManager.getCellCount() return this._cellSizeAndPositionManager.getCellCount();
}, },
getEstimatedCellSize: function () { getEstimatedCellSize: function () {
return this._cellSizeAndPositionManager.getEstimatedCellSize() return this._cellSizeAndPositionManager.getEstimatedCellSize();
}, },
getLastMeasuredIndex: function () { getLastMeasuredIndex: function () {
return this._cellSizeAndPositionManager.getLastMeasuredIndex() return this._cellSizeAndPositionManager.getLastMeasuredIndex();
}, },
getOffsetAdjustment: function (containerSize, offset) { getOffsetAdjustment: function (containerSize, offset) {
@ -234,13 +234,13 @@ BI.ScalingCellSizeAndPositionManager.prototype = {
}, },
resetCell: function (index) { resetCell: function (index) {
this._cellSizeAndPositionManager.resetCell(index) this._cellSizeAndPositionManager.resetCell(index);
}, },
_getOffsetPercentage: function (containerSize, offset, totalSize) { _getOffsetPercentage: function (containerSize, offset, totalSize) {
return totalSize <= containerSize return totalSize <= containerSize
? 0 ? 0
: offset / (totalSize - containerSize) : offset / (totalSize - containerSize);
}, },
_offsetToSafeOffset: function (containerSize, offset) { _offsetToSafeOffset: function (containerSize, offset) {
@ -249,11 +249,11 @@ BI.ScalingCellSizeAndPositionManager.prototype = {
if (totalSize === safeTotalSize) { if (totalSize === safeTotalSize) {
return offset; return offset;
} else { }
var offsetPercentage = this._getOffsetPercentage(containerSize, offset, totalSize); var offsetPercentage = this._getOffsetPercentage(containerSize, offset, totalSize);
return Math.round(offsetPercentage * (safeTotalSize - containerSize)); return Math.round(offsetPercentage * (safeTotalSize - containerSize));
}
}, },
_safeOffsetToOffset: function (containerSize, offset) { _safeOffsetToOffset: function (containerSize, offset) {
@ -262,10 +262,10 @@ BI.ScalingCellSizeAndPositionManager.prototype = {
if (totalSize === safeTotalSize) { if (totalSize === safeTotalSize) {
return offset; return offset;
} else { }
var offsetPercentage = this._getOffsetPercentage(containerSize, offset, safeTotalSize); var offsetPercentage = this._getOffsetPercentage(containerSize, offset, safeTotalSize);
return Math.round(offsetPercentage * (totalSize - containerSize)); return Math.round(offsetPercentage * (totalSize - containerSize));
}
} }
}; };

750
src/core/utils/chinesePY.js

File diff suppressed because one or more lines are too long

81
src/core/utils/detectElementResize.js

@ -9,16 +9,16 @@
**/ **/
!(function () { !(function () {
// Check `document` and `window` in case of server-side rendering // Check `document` and `window` in case of server-side rendering
var _window var _window;
if (typeof window !== 'undefined') { if (typeof window !== "undefined") {
_window = window _window = window;
} else if (typeof self !== 'undefined') { } else if (typeof self !== "undefined") {
_window = self _window = self;
} else { } else {
_window = this _window = this;
} }
var addEventListener = typeof document !== 'undefined' && document.addEventListener; var addEventListener = typeof document !== "undefined" && document.addEventListener;
var stylesCreated = false; var stylesCreated = false;
if (addEventListener) { if (addEventListener) {
@ -47,8 +47,8 @@
expandChild = expand.firstElementChild; expandChild = expand.firstElementChild;
contract.scrollLeft = contract.scrollWidth; contract.scrollLeft = contract.scrollWidth;
contract.scrollTop = contract.scrollHeight; contract.scrollTop = contract.scrollHeight;
expandChild.style.width = expand.offsetWidth + 1 + 'px'; expandChild.style.width = expand.offsetWidth + 1 + "px";
expandChild.style.height = expand.offsetHeight + 1 + 'px'; expandChild.style.height = expand.offsetHeight + 1 + "px";
expand.scrollLeft = expand.scrollWidth; expand.scrollLeft = expand.scrollWidth;
expand.scrollTop = expand.scrollHeight; expand.scrollTop = expand.scrollHeight;
}; };
@ -56,7 +56,7 @@
var checkTriggers = function (element) { var checkTriggers = function (element) {
return element.offsetWidth !== element.__resizeLast__.width || return element.offsetWidth !== element.__resizeLast__.width ||
element.offsetHeight !== element.__resizeLast__.height; element.offsetHeight !== element.__resizeLast__.height;
} };
var scrollListener = function (e) { var scrollListener = function (e) {
var element = this; var element = this;
@ -75,24 +75,24 @@
/* Detect CSS Animations support to detect element display/re-attach */ /* Detect CSS Animations support to detect element display/re-attach */
var animation = false, var animation = false,
animationstring = 'animation', animationstring = "animation",
keyframeprefix = '', keyframeprefix = "",
animationstartevent = 'animationstart', animationstartevent = "animationstart",
domPrefixes = 'Webkit Moz O ms'.split(' '), domPrefixes = "Webkit Moz O ms".split(" "),
startEvents = 'webkitAnimationStart animationstart oAnimationStart MSAnimationStart'.split(' '), startEvents = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "),
pfx = ''; pfx = "";
{ {
var elm = document.createElement('fakeelement'); var elm = document.createElement("fakeelement");
if (elm.style.animationName !== undefined) { if (elm.style.animationName !== undefined) {
animation = true; animation = true;
} }
if (animation === false) { if (animation === false) {
for (var i = 0; i < domPrefixes.length; i++) { for (var i = 0; i < domPrefixes.length; i++) {
if (elm.style[domPrefixes[i] + 'AnimationName'] !== undefined) { if (elm.style[domPrefixes[i] + "AnimationName"] !== undefined) {
pfx = domPrefixes[i]; pfx = domPrefixes[i];
animationstring = pfx + 'Animation'; animationstring = pfx + "Animation";
keyframeprefix = '-' + pfx.toLowerCase() + '-'; keyframeprefix = "-" + pfx.toLowerCase() + "-";
animationstartevent = startEvents[i]; animationstartevent = startEvents[i];
animation = true; animation = true;
break; break;
@ -101,21 +101,21 @@
} }
} }
var animationName = 'resizeanim'; var animationName = "resizeanim";
var animationKeyframes = '@' + keyframeprefix + 'keyframes ' + animationName + ' { from { opacity: 0; } to { opacity: 0; } } '; var animationKeyframes = "@" + keyframeprefix + "keyframes " + animationName + " { from { opacity: 0; } to { opacity: 0; } } ";
var animationStyle = keyframeprefix + 'animation: 1ms ' + animationName + '; '; var animationStyle = keyframeprefix + "animation: 1ms " + animationName + "; ";
} }
var createStyles = function () { var createStyles = function () {
if (!stylesCreated) { if (!stylesCreated) {
// opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360 // opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
var css = (animationKeyframes ? animationKeyframes : '') + var css = (animationKeyframes ? animationKeyframes : "") +
'.resize-triggers { ' + (animationStyle ? animationStyle : '') + 'visibility: hidden; opacity: 0; } ' + ".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " +
'.resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }', ".resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }",
head = document.head || document.getElementsByTagName('head')[0], head = document.head || document.getElementsByTagName("head")[0],
style = document.createElement('style'); style = document.createElement("style");
style.type = 'text/css'; style.type = "text/css";
if (style.styleSheet) { if (style.styleSheet) {
style.styleSheet.cssText = css; style.styleSheet.cssText = css;
} else { } else {
@ -125,32 +125,31 @@
head.appendChild(style); head.appendChild(style);
stylesCreated = true; stylesCreated = true;
} }
} };
var addResizeListener = function (element, fn) { var addResizeListener = function (element, fn) {
if (addEventListener) { if (addEventListener) {
if (!element.__resizeTriggers__) { if (!element.__resizeTriggers__) {
if (getComputedStyle(element).position === 'static') element.style.position = 'relative'; if (getComputedStyle(element).position === "static") element.style.position = "relative";
createStyles(); createStyles();
element.__resizeLast__ = {}; element.__resizeLast__ = {};
element.__resizeListeners__ = []; element.__resizeListeners__ = [];
(element.__resizeTriggers__ = document.createElement('div')).className = 'resize-triggers'; (element.__resizeTriggers__ = document.createElement("div")).className = "resize-triggers";
element.__resizeTriggers__.innerHTML = '<div class="expand-trigger"><div></div></div>' + element.__resizeTriggers__.innerHTML = "<div class=\"expand-trigger\"><div></div></div>" +
'<div class="contract-trigger"></div>'; "<div class=\"contract-trigger\"></div>";
element.appendChild(element.__resizeTriggers__); element.appendChild(element.__resizeTriggers__);
resetTriggers(element); resetTriggers(element);
element.addEventListener('scroll', scrollListener, true); element.addEventListener("scroll", scrollListener, true);
/* Listen for a css animation to detect element display/re-attach */ /* Listen for a css animation to detect element display/re-attach */
animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) { animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) {
if (e.animationName === animationName) if (e.animationName === animationName) {resetTriggers(element);}
resetTriggers(element);
}); });
} }
element.__resizeListeners__.push(fn); element.__resizeListeners__.push(fn);
} else { } else {
element.attachEvent('onresize', fn); element.attachEvent("onresize", fn);
} }
}; };
@ -158,11 +157,11 @@
if (addEventListener) { if (addEventListener) {
element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1); element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
if (!element.__resizeListeners__.length) { if (!element.__resizeListeners__.length) {
element.removeEventListener('scroll', scrollListener, true); element.removeEventListener("scroll", scrollListener, true);
element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__); element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__);
} }
} else { } else {
element.detachEvent('onresize', fn); element.detachEvent("onresize", fn);
} }
}; };
@ -171,7 +170,7 @@
addResizeListener(widget.element[0], fn); addResizeListener(widget.element[0], fn);
return function () { return function () {
removeResizeListener(widget.element[0], fn); removeResizeListener(widget.element[0], fn);
} };
}, },
removeResizeListener: function (widget, fn) { removeResizeListener: function (widget, fn) {
removeResizeListener(widget.element[0], fn); removeResizeListener(widget.element[0], fn);

8
src/core/utils/events/eventlistener.js

@ -8,10 +8,10 @@ BI.EventListener = {
} }
}; };
} else if (target.attachEvent) { } else if (target.attachEvent) {
target.attachEvent('on' + eventType, callback); target.attachEvent("on" + eventType, callback);
return { return {
remove: function remove () { remove: function remove () {
target.detachEvent('on' + eventType, callback); target.detachEvent("on" + eventType, callback);
} }
}; };
} }
@ -25,11 +25,11 @@ BI.EventListener = {
target.removeEventListener(eventType, callback, true); target.removeEventListener(eventType, callback, true);
} }
}; };
} else { }
return { return {
remove: BI.emptyFn remove: BI.emptyFn
}; };
}
}, },
registerDefault: function registerDefault () { registerDefault: function registerDefault () {

4
src/core/utils/events/mousemovetracker.js

@ -27,12 +27,12 @@
if (!this._eventMoveToken && !this._eventUpToken) { if (!this._eventMoveToken && !this._eventUpToken) {
this._eventMoveToken = BI.EventListener.listen( this._eventMoveToken = BI.EventListener.listen(
this._domNode, this._domNode,
'mousemove', "mousemove",
this._onMouseMove this._onMouseMove
); );
this._eventUpToken = BI.EventListener.listen( this._eventUpToken = BI.EventListener.listen(
this._domNode, this._domNode,
'mouseup', "mouseup",
this._onMouseUp this._onMouseUp
); );
} }

32
src/core/utils/events/wheelhandler.js

@ -12,21 +12,21 @@
pY = 0; // pixelX, pixelY pY = 0; // pixelX, pixelY
// Legacy // Legacy
if ('detail' in event) { if ("detail" in event) {
sY = event.detail; sY = event.detail;
} }
if ('wheelDelta' in event) { if ("wheelDelta" in event) {
sY = -event.wheelDelta / 120; sY = -event.wheelDelta / 120;
} }
if ('wheelDeltaY' in event) { if ("wheelDeltaY" in event) {
sY = -event.wheelDeltaY / 120; sY = -event.wheelDeltaY / 120;
} }
if ('wheelDeltaX' in event) { if ("wheelDeltaX" in event) {
sX = -event.wheelDeltaX / 120; sX = -event.wheelDeltaX / 120;
} }
// side scrolling on FF with DOMMouseScroll // side scrolling on FF with DOMMouseScroll
if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) { if ("axis" in event && event.axis === event.HORIZONTAL_AXIS) {
sX = sY; sX = sY;
sY = 0; sY = 0;
} }
@ -34,10 +34,10 @@
pX = sX * PIXEL_STEP; pX = sX * PIXEL_STEP;
pY = sY * PIXEL_STEP; pY = sY * PIXEL_STEP;
if ('deltaY' in event) { if ("deltaY" in event) {
pY = event.deltaY; pY = event.deltaY;
} }
if ('deltaX' in event) { if ("deltaX" in event) {
pX = event.deltaX; pX = event.deltaX;
} }
@ -74,33 +74,33 @@
this._deltaX = 0; this._deltaX = 0;
this._deltaY = 0; this._deltaY = 0;
this._didWheel = BI.bind(this._didWheel, this); this._didWheel = BI.bind(this._didWheel, this);
if (typeof handleScrollX !== 'function') { if (typeof handleScrollX !== "function") {
handleScrollX = handleScrollX ? handleScrollX = handleScrollX ?
function () { function () {
return true return true;
} : } :
function () { function () {
return false return false;
}; };
} }
if (typeof handleScrollY !== 'function') { if (typeof handleScrollY !== "function") {
handleScrollY = handleScrollY ? handleScrollY = handleScrollY ?
function () { function () {
return true return true;
} : } :
function () { function () {
return false return false;
}; };
} }
if (typeof stopPropagation !== 'function') { if (typeof stopPropagation !== "function") {
stopPropagation = stopPropagation ? stopPropagation = stopPropagation ?
function () { function () {
return true return true;
} : } :
function () { function () {
return false return false;
}; };
} }

4
src/core/utils/heap.js

@ -1,4 +1,4 @@
;
(function () { (function () {
function defaultComparator (a, b) { function defaultComparator (a, b) {
return a < b; return a < b;
@ -111,5 +111,5 @@
index = swapIndex; index = swapIndex;
} }
} }
} };
})(); })();

4
src/core/utils/helper.scroll.js

@ -1,4 +1,4 @@
;(function () { (function () {
var clamp = function (min, value, max) { var clamp = function (min, value, max) {
if (value < min) { if (value < min) {
return min; return min;
@ -32,7 +32,7 @@
this._defaultRowHeight = defaultRowHeight; this._defaultRowHeight = defaultRowHeight;
this._rowHeightGetter = rowHeightGetter ? this._rowHeightGetter = rowHeightGetter ?
rowHeightGetter : function () { rowHeightGetter : function () {
return defaultRowHeight return defaultRowHeight;
}; };
this._viewportHeight = viewportHeight; this._viewportHeight = viewportHeight;

10
src/core/utils/linkedHashMap.js

@ -1,4 +1,4 @@
;
!(function () { !(function () {
BI.LinkHashMap = function () { BI.LinkHashMap = function () {
this.array = []; this.array = [];
@ -14,7 +14,7 @@
}, },
add: function (key, value) { add: function (key, value) {
if (typeof key == 'undefined') { if (typeof key === "undefined") {
return; return;
} }
if (key in this.map) { if (key in this.map) {
@ -44,7 +44,7 @@
each: function (fn, scope) { each: function (fn, scope) {
var scope = scope || window; var scope = scope || window;
var fn = fn || null; var fn = fn || null;
if (fn == null || typeof (fn) != "function") { if (fn == null || typeof (fn) !== "function") {
return; return;
} }
for (var i = 0; i < this.array.length; i++) { for (var i = 0; i < this.array.length; i++) {
@ -65,8 +65,8 @@
var array = []; var array = [];
this.each(function (key, value) { this.each(function (key, value) {
array.push(value); array.push(value);
}) });
return array; return array;
} }
} };
})(); })();

22
src/core/utils/load.js

@ -5,18 +5,18 @@ $.extend(BI, {
var config; var config;
if (BI.isObject(options)) { if (BI.isObject(options)) {
config = $.extend({ config = $.extend({
op: 'resource', op: "resource",
path: null, path: null,
type: null, type: null,
must: false must: false
}, options); }, options);
config.url = BI.servletURL + '?op=' + config.op + '&resource=' + config.path; config.url = BI.servletURL + "?op=" + config.op + "&resource=" + config.path;
} else { } else {
config = { config = {
url: BI.servletURL + "?op=resource&resource=" + options, url: BI.servletURL + "?op=resource&resource=" + options,
type: arguments[1], type: arguments[1],
must: arguments[2] must: arguments[2]
} };
} }
this.$import(config.url, config.type, config.must); this.$import(config.url, config.type, config.must);
}, },
@ -45,12 +45,12 @@ $.extend(BI, {
if (_LOADED[src] === true) { if (_LOADED[src] === true) {
return; return;
} }
if (ext === 'css') { if (ext === "css") {
var link = document.createElement('link'); var link = document.createElement("link");
link.rel = 'stylesheet'; link.rel = "stylesheet";
link.type = 'text/css'; link.type = "text/css";
link.href = src; link.href = src;
var head = document.getElementsByTagName('head')[0]; var head = document.getElementsByTagName("head")[0];
head.appendChild(link); head.appendChild(link);
_LOADED[src] = true; _LOADED[src] = true;
} else { } else {
@ -65,12 +65,12 @@ $.extend(BI, {
* alex:发现jquery会很智能地判断一下返回的数据类型是不是script,然后做一个globalEval * alex:发现jquery会很智能地判断一下返回的数据类型是不是script,然后做一个globalEval
* 所以当status为success时就不需要再把其中的内容加到script里面去了 * 所以当status为success时就不需要再把其中的内容加到script里面去了
*/ */
if (status == 'success') { if (status == "success") {
_LOADED[src] = true; _LOADED[src] = true;
} }
} }
}) });
}
} }
};
}() }()
}); });

14
src/core/utils/lru.js

@ -1,4 +1,4 @@
;
!(function () { !(function () {
BI.LRU = function (limit) { BI.LRU = function (limit) {
this.size = 0; this.size = 0;
@ -23,9 +23,9 @@
this._keymap[key] = entry; this._keymap[key] = entry;
if (this.tail) { if (this.tail) {
this.tail.newer = entry; this.tail.newer = entry;
entry.older = this.tail entry.older = this.tail;
} else { } else {
this.head = entry this.head = entry;
} }
this.tail = entry; this.tail = entry;
this.size++; this.size++;
@ -54,7 +54,7 @@
if (entry === this.tail) { if (entry === this.tail) {
return returnEntry return returnEntry
? entry ? entry
: entry.value : entry.value;
} }
// HEAD--------------TAIL // HEAD--------------TAIL
// <.older .newer> // <.older .newer>
@ -62,7 +62,7 @@
// A B C <D> E // A B C <D> E
if (entry.newer) { if (entry.newer) {
if (entry === this.head) { if (entry === this.head) {
this.head = entry.newer this.head = entry.newer;
} }
entry.newer.older = entry.older; // C <-- E. entry.newer.older = entry.older; // C <-- E.
} }
@ -77,10 +77,10 @@
this.tail = entry; this.tail = entry;
return returnEntry return returnEntry
? entry ? entry
: entry.value : entry.value;
}; };
p.has = function (key) { p.has = function (key) {
return this._keymap[key] != null; return this._keymap[key] != null;
} };
})(); })();

13
src/core/utils/md5.js

@ -1,4 +1,4 @@
;
!(function () { !(function () {
var MD5 = function (hexcase) { var MD5 = function (hexcase) {
this.hexcase = !hexcase ? 0 : 1; this.hexcase = !hexcase ? 0 : 1;
@ -167,8 +167,7 @@
*/ */
MD5.prototype.core_hmac_md5 = function (key, data) { MD5.prototype.core_hmac_md5 = function (key, data) {
var bkey = this.str2binl(key); var bkey = this.str2binl(key);
if (bkey.length > 16) if (bkey.length > 16) {bkey = this.core_md5(bkey, key.length * this.chrsz);}
bkey = this.core_md5(bkey, key.length * this.chrsz);
var ipad = Array(16), opad = Array(16); var ipad = Array(16), opad = Array(16);
for (var i = 0; i < 16; i++) { for (var i = 0; i < 16; i++) {
@ -204,8 +203,7 @@
MD5.prototype.str2binl = function (str) { MD5.prototype.str2binl = function (str) {
var bin = Array(); var bin = Array();
var mask = (1 << this.chrsz) - 1; var mask = (1 << this.chrsz) - 1;
for (var i = 0; i < str.length * this.chrsz; i += this.chrsz) for (var i = 0; i < str.length * this.chrsz; i += this.chrsz) {bin[i >> 5] |= (str.charCodeAt(i / this.chrsz) & mask) << (i % 32);}
bin[i >> 5] |= (str.charCodeAt(i / this.chrsz) & mask) << (i % 32);
return bin; return bin;
}; };
@ -233,10 +231,7 @@
| (((binarray[i + 1 >> 2] >> 8 * ((i + 1) % 4)) & 0xFF) << 8) | (((binarray[i + 1 >> 2] >> 8 * ((i + 1) % 4)) & 0xFF) << 8)
| ((binarray[i + 2 >> 2] >> 8 * ((i + 2) % 4)) & 0xFF); | ((binarray[i + 2 >> 2] >> 8 * ((i + 2) % 4)) & 0xFF);
for (var j = 0; j < 4; j++) { for (var j = 0; j < 4; j++) {
if (i * 8 + j * 6 > binarray.length * 32) if (i * 8 + j * 6 > binarray.length * 32) {str += this.b64pad;} else {str += tab.charAt((triplet >> 6 * (3 - j)) & 0x3F);}
str += this.b64pad;
else
str += tab.charAt((triplet >> 6 * (3 - j)) & 0x3F);
} }
} }
return str; return str;

2
src/core/utils/prefixIntervalTree.js

@ -1,5 +1,5 @@
// 线段树 // 线段树
;(function () { (function () {
var parent = function (node) { var parent = function (node) {
return Math.floor(node / 2); return Math.floor(node / 2);
}; };

8
src/core/utils/queue.js

@ -1,4 +1,4 @@
;
!(function () { !(function () {
BI.Queue = function (capacity) { BI.Queue = function (capacity) {
this.capacity = capacity; this.capacity = capacity;
@ -60,7 +60,7 @@
each: function (fn, scope) { each: function (fn, scope) {
var scope = scope || window; var scope = scope || window;
var fn = fn || null; var fn = fn || null;
if (fn == null || typeof (fn) != "function") { if (fn == null || typeof (fn) !== "function") {
return; return;
} }
for (var i = 0; i < this.array.length; i++) { for (var i = 0; i < this.array.length; i++) {
@ -79,11 +79,11 @@
var self = this; var self = this;
BI.each(array, function (i, v) { BI.each(array, function (i, v) {
self.push(v); self.push(v);
}) });
}, },
clear: function () { clear: function () {
this.array.clear(); this.array.clear();
} }
} };
})(); })();

16
src/core/utils/sectionManager.js

@ -19,7 +19,7 @@
}, },
getCellIndices: function () { getCellIndices: function () {
return this._indices return this._indices;
} }
}; };
@ -37,12 +37,12 @@
BI.each(this.getSections(height, width, x, y), function (i, section) { BI.each(this.getSections(height, width, x, y), function (i, section) {
BI.each(section.getCellIndices(), function (j, index) { BI.each(section.getCellIndices(), function (j, index) {
indices[index] = index indices[index] = index;
}) });
}); });
return BI.map(BI.keys(indices), function (i, index) { return BI.map(BI.keys(indices), function (i, index) {
return indices[index] return indices[index];
}); });
}, },
@ -63,14 +63,14 @@
var key = sectionX + "." + sectionY; var key = sectionX + "." + sectionY;
if (!this._sections[key]) { if (!this._sections[key]) {
this._sections[key] = new Section(this._sectionSize, this._sectionSize, sectionX * this._sectionSize, sectionY * this._sectionSize) this._sections[key] = new Section(this._sectionSize, this._sectionSize, sectionX * this._sectionSize, sectionY * this._sectionSize);
} }
sections.push(this._sections[key]) sections.push(this._sections[key]);
} }
} }
return sections return sections;
}, },
getTotalSectionCount: function () { getTotalSectionCount: function () {
@ -84,5 +84,5 @@
section.addCellIndex(index); section.addCellIndex(index);
}); });
} }
} };
})(); })();

4
src/core/utils/tableRowBuffer.js

@ -1,4 +1,4 @@
;
(function () { (function () {
var clamp = function (value, min, max) { var clamp = function (value, min, max) {
if (value < min) { if (value < min) {
@ -114,6 +114,6 @@
this._rows[rowPosition] = rowIndex; this._rows[rowPosition] = rowIndex;
} }
} }
} };
})(); })();

16
src/core/utils/tree.js

@ -1,4 +1,4 @@
;
(function () { (function () {
BI.Tree = function () { BI.Tree = function () {
this.root = new BI.Node(BI.UUID()); this.root = new BI.Node(BI.UUID());
@ -46,7 +46,7 @@
n.set("data", child); n.set("data", child);
queue.push(n); queue.push(n);
self.addNode(parent, n); self.addNode(parent, n);
}) });
} }
}, },
@ -465,9 +465,9 @@
delete tmpMap[sNodes[i].id].pId; delete tmpMap[sNodes[i].id].pId;
} }
return r; return r;
} else {
return [sNodes];
} }
return [sNodes];
}, },
treeFormat: function (sNodes) { treeFormat: function (sNodes) {
@ -496,9 +496,9 @@
} }
} }
return r; return r;
} else {
return [sNodes];
} }
return [sNodes];
}, },
traversal: function (array, callback) { traversal: function (array, callback) {
@ -511,7 +511,7 @@
return true; return true;
} }
self.traversal(item.children, callback); self.traversal(item.children, callback);
}) });
} }
}) });
})(); })();

102
src/core/var.js

@ -16,57 +16,57 @@ _.extend(BI, {
}, },
empty: null, empty: null,
Key: { Key: {
"48": "0", 48: "0",
"49": "1", 49: "1",
"50": "2", 50: "2",
"51": "3", 51: "3",
"52": "4", 52: "4",
"53": "5", 53: "5",
"54": "6", 54: "6",
"55": "7", 55: "7",
"56": "8", 56: "8",
"57": "9", 57: "9",
"65": "a", 65: "a",
"66": "b", 66: "b",
"67": "c", 67: "c",
"68": "d", 68: "d",
"69": "e", 69: "e",
"70": "f", 70: "f",
"71": "g", 71: "g",
"72": "h", 72: "h",
"73": "i", 73: "i",
"74": "j", 74: "j",
"75": "k", 75: "k",
"76": "l", 76: "l",
"77": "m", 77: "m",
"78": "n", 78: "n",
"79": "o", 79: "o",
"80": "p", 80: "p",
"81": "q", 81: "q",
"82": "r", 82: "r",
"83": "s", 83: "s",
"84": "t", 84: "t",
"85": "u", 85: "u",
"86": "v", 86: "v",
"87": "w", 87: "w",
"88": "x", 88: "x",
"89": "y", 89: "y",
"90": "z", 90: "z",
"96": "0", 96: "0",
"97": "1", 97: "1",
"98": "2", 98: "2",
"99": "3", 99: "3",
"100": "4", 100: "4",
"101": "5", 101: "5",
"102": "6", 102: "6",
"103": "7", 103: "7",
"104": "8", 104: "8",
"105": "9", 105: "9",
"106": "*", 106: "*",
"107": "+", 107: "+",
"109": "-", 109: "-",
"110": ".", 110: ".",
"111": "/" 111: "/"
}, },
KeyCode: { KeyCode: {
BACKSPACE: 8, BACKSPACE: 8,

8
src/core/widget.js

@ -20,7 +20,7 @@ BI.Widget = BI.inherit(BI.OB, {
baseCls: "", baseCls: "",
extraCls: "", extraCls: "",
cls: "" cls: ""
}) });
}, },
// 生命周期函数 // 生命周期函数
@ -142,8 +142,8 @@ BI.Widget = BI.inherit(BI.OB, {
BI.each(els, function (i, el) { BI.each(els, function (i, el) {
BI.createWidget(el, { BI.createWidget(el, {
element: self element: self
}) });
}) });
} }
// if (this._isRoot === true || !(this instanceof BI.Layout)) { // if (this._isRoot === true || !(this instanceof BI.Layout)) {
this._mount(); this._mount();
@ -350,7 +350,7 @@ BI.Widget = BI.inherit(BI.OB, {
if (BI.isPlainObject(key)) { if (BI.isPlainObject(key)) {
BI.each(key, function (k, v) { BI.each(key, function (k, v) {
self.attr(k, v); self.attr(k, v);
}) });
return; return;
} }
if (BI.isNotNull(value)) { if (BI.isNotNull(value)) {

38
src/core/wrapper/layout.js

@ -25,16 +25,16 @@ BI.Layout = BI.inherit(BI.Widget, {
_init4Margin: function () { _init4Margin: function () {
if (this.options.top) { if (this.options.top) {
this.element.css('top', this.options.top); this.element.css("top", this.options.top);
} }
if (this.options.left) { if (this.options.left) {
this.element.css('left', this.options.left); this.element.css("left", this.options.left);
} }
if (this.options.bottom) { if (this.options.bottom) {
this.element.css('bottom', this.options.bottom); this.element.css("bottom", this.options.bottom);
} }
if (this.options.right) { if (this.options.right) {
this.element.css('right', this.options.right); this.element.css("right", this.options.right);
} }
}, },
@ -126,20 +126,20 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
var className = Object.prototype.toString.call(a); var className = Object.prototype.toString.call(a);
switch (className) { switch (className) {
case '[object RegExp]': case "[object RegExp]":
case '[object String]': case "[object String]":
return '' + a === '' + b; return "" + a === "" + b;
case '[object Number]': case "[object Number]":
if (+a !== +a) { if (+a !== +a) {
return +b !== +b; return +b !== +b;
} }
return +a === 0 ? 1 / +a === 1 / b : +a === +b; return +a === 0 ? 1 / +a === 1 / b : +a === +b;
case '[object Date]': case "[object Date]":
case '[object Boolean]': case "[object Boolean]":
return +a === +b; return +a === +b;
} }
var areArrays = className === '[object Array]'; var areArrays = className === "[object Array]";
if (!areArrays) { if (!areArrays) {
if (BI.isFunction(a) && BI.isFunction(b)) { if (BI.isFunction(a) && BI.isFunction(b)) {
return true; return true;
@ -306,7 +306,7 @@ BI.Layout = BI.inherit(BI.Widget, {
this._getWrapper().append(fragment); this._getWrapper().append(fragment);
BI.each(added, function (i, w) { BI.each(added, function (i, w) {
w._mount(); w._mount();
}) });
}, },
prependItems: function (items) { prependItems: function (items) {
@ -325,7 +325,7 @@ BI.Layout = BI.inherit(BI.Widget, {
this._getWrapper().prepend(fragment); this._getWrapper().prepend(fragment);
BI.each(added, function (i, w) { BI.each(added, function (i, w) {
w._mount(); w._mount();
}) });
}, },
getValue: function () { getValue: function () {
@ -346,7 +346,7 @@ BI.Layout = BI.inherit(BI.Widget, {
if (child = self._children[self._getChildName(i)]) { if (child = self._children[self._getChildName(i)]) {
child.setValue(v); child.setValue(v);
} }
}) });
}, },
setText: function (v) { setText: function (v) {
@ -355,7 +355,7 @@ BI.Layout = BI.inherit(BI.Widget, {
if (child = self._children[self._getChildName(i)]) { if (child = self._children[self._getChildName(i)]) {
child.setText(v); child.setText(v);
} }
}) });
}, },
patchItem: function (oldVnode, vnode, index) { patchItem: function (oldVnode, vnode, index) {
@ -440,7 +440,7 @@ BI.Layout = BI.inherit(BI.Widget, {
return vnode1.key === vnode2.key; return vnode1.key === vnode2.key;
} }
if (oldIndex >= 0) { if (oldIndex >= 0) {
return oldIndex === newIndex return oldIndex === newIndex;
} }
} }
@ -523,7 +523,7 @@ BI.Layout = BI.inherit(BI.Widget, {
stroke: function (items) { stroke: function (items) {
var self = this; var self = this;
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (!!item) { if (item) {
self._addElement(i, item); self._addElement(i, item);
} }
}); });
@ -536,7 +536,7 @@ BI.Layout = BI.inherit(BI.Widget, {
if (child === nameOrWidget) { if (child === nameOrWidget) {
removeIndex = name; removeIndex = name;
} }
}) });
} else { } else {
removeIndex = nameOrWidget; removeIndex = nameOrWidget;
} }
@ -570,4 +570,4 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
}); });
BI.shortcut('bi.layout', BI.Layout); BI.shortcut("bi.layout", BI.Layout);

14
src/core/wrapper/layout/adapt/absolute.center.js

@ -25,12 +25,12 @@ BI.AbsoluteCenterLayout = BI.inherit(BI.Layout, {
var o = this.options; var o = this.options;
var w = BI.AbsoluteCenterLayout.superclass._addElement.apply(this, arguments); var w = BI.AbsoluteCenterLayout.superclass._addElement.apply(this, arguments);
w.element.css({ w.element.css({
"position": "absolute", position: "absolute",
"left": o.hgap + o.lgap + (item.lgap || 0), left: o.hgap + o.lgap + (item.lgap || 0),
"right": o.hgap + o.rgap + (item.rgap || 0), right: o.hgap + o.rgap + (item.rgap || 0),
"top": o.vgap + o.tgap + (item.tgap || 0), top: o.vgap + o.tgap + (item.tgap || 0),
"bottom": o.vgap + o.bgap + (item.bgap || 0), bottom: o.vgap + o.bgap + (item.bgap || 0),
"margin": "auto" margin: "auto"
}); });
return w; return w;
}, },
@ -44,4 +44,4 @@ BI.AbsoluteCenterLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.absolute_center_adapt', BI.AbsoluteCenterLayout); BI.shortcut("bi.absolute_center_adapt", BI.AbsoluteCenterLayout);

10
src/core/wrapper/layout/adapt/absolute.horizontal.js

@ -25,10 +25,10 @@ BI.AbsoluteHorizontalLayout = BI.inherit(BI.Layout, {
var o = this.options; var o = this.options;
var w = BI.AbsoluteHorizontalLayout.superclass._addElement.apply(this, arguments); var w = BI.AbsoluteHorizontalLayout.superclass._addElement.apply(this, arguments);
w.element.css({ w.element.css({
"position": "absolute", position: "absolute",
"left": o.hgap + o.lgap + (item.lgap || 0), left: o.hgap + o.lgap + (item.lgap || 0),
"right": o.hgap + o.rgap + (item.rgap || 0), right: o.hgap + o.rgap + (item.rgap || 0),
"margin": "auto" margin: "auto"
}); });
if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) !== 0) {
w.element.css("top", o.vgap + o.tgap + (item.tgap || 0)); w.element.css("top", o.vgap + o.tgap + (item.tgap || 0));
@ -48,4 +48,4 @@ BI.AbsoluteHorizontalLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.absolute_horizontal_adapt', BI.AbsoluteHorizontalLayout); BI.shortcut("bi.absolute_horizontal_adapt", BI.AbsoluteHorizontalLayout);

14
src/core/wrapper/layout/adapt/absolute.vertical.js

@ -25,12 +25,12 @@ BI.AbsoluteVerticalLayout = BI.inherit(BI.Layout, {
var o = this.options; var o = this.options;
var w = BI.AbsoluteVerticalLayout.superclass._addElement.apply(this, arguments); var w = BI.AbsoluteVerticalLayout.superclass._addElement.apply(this, arguments);
w.element.css({ w.element.css({
"position": "absolute", position: "absolute",
"left": item.lgap, left: item.lgap,
"right": item.rgap, right: item.rgap,
"top": o.vgap + o.tgap + (item.tgap || 0), top: o.vgap + o.tgap + (item.tgap || 0),
"bottom": o.vgap + o.bgap + (item.bgap || 0), bottom: o.vgap + o.bgap + (item.bgap || 0),
"margin": "auto" margin: "auto"
}); });
if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) !== 0) {
w.element.css("left", o.hgap + o.lgap + (item.lgap || 0)); w.element.css("left", o.hgap + o.lgap + (item.lgap || 0));
@ -50,4 +50,4 @@ BI.AbsoluteVerticalLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.absolute_vertical_adapt', BI.AbsoluteVerticalLayout); BI.shortcut("bi.absolute_vertical_adapt", BI.AbsoluteVerticalLayout);

32
src/core/wrapper/layout/adapt/adapt.center.js

@ -18,13 +18,13 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
}, },
render: function () { render: function () {
BI.CenterAdaptLayout.superclass.render.apply(this, arguments); BI.CenterAdaptLayout.superclass.render.apply(this, arguments);
this.$table = $("<table>").attr({"cellspacing": 0, "cellpadding": 0}).css({ this.$table = $("<table>").attr({cellspacing: 0, cellpadding: 0}).css({
"position": "relative", position: "relative",
"width": "100%", width: "100%",
"height": "100%", height: "100%",
"white-space": "nowrap", "white-space": "nowrap",
"border-spacing": "0px", "border-spacing": "0px",
"border": "none", border: "none",
"border-collapse": "separate" "border-collapse": "separate"
}); });
this.$tr = $("<tr>"); this.$tr = $("<tr>");
@ -38,7 +38,7 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
var w = BI.createWidget(item); var w = BI.createWidget(item);
w.element.css({"position": "relative", "top": "0", "left": "0", "margin": "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
tagName: "td", tagName: "td",
@ -57,32 +57,32 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
td.element.addClass("first-element"); td.element.addClass("first-element");
} }
td.element.css({ td.element.css({
"position": "relative", position: "relative",
"height": "100%", height: "100%",
"vertical-align": "middle", "vertical-align": "middle",
"margin": "0", margin: "0",
"padding": "0", padding: "0",
"border": "none" border: "none"
}); });
if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
}) });
} }
if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
}) });
} }
if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
}) });
} }
if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
}) });
} }
return td; return td;
}, },
@ -116,4 +116,4 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.center_adapt', BI.CenterAdaptLayout); BI.shortcut("bi.center_adapt", BI.CenterAdaptLayout);

28
src/core/wrapper/layout/adapt/adapt.horizontal.js

@ -19,12 +19,12 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
}, },
render: function () { render: function () {
BI.HorizontalAdaptLayout.superclass.render.apply(this, arguments); BI.HorizontalAdaptLayout.superclass.render.apply(this, arguments);
this.$table = $("<table>").attr({"cellspacing": 0, "cellpadding": 0}).css({ this.$table = $("<table>").attr({cellspacing: 0, cellpadding: 0}).css({
"position": "relative", position: "relative",
"width": "100%", width: "100%",
"white-space": "nowrap", "white-space": "nowrap",
"border-spacing": "0px", "border-spacing": "0px",
"border": "none", border: "none",
"border-collapse": "separate" "border-collapse": "separate"
}); });
this.$tr = $("<tr>"); this.$tr = $("<tr>");
@ -38,7 +38,7 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
var w = BI.createWidget(item); var w = BI.createWidget(item);
w.element.css({"position": "relative", "top": "0", "left": "0", "margin": "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
tagName: "td", tagName: "td",
@ -57,31 +57,31 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
td.element.addClass("first-element"); td.element.addClass("first-element");
} }
td.element.css({ td.element.css({
"position": "relative", position: "relative",
"vertical-align": o.verticalAlign, "vertical-align": o.verticalAlign,
"margin": "0", margin: "0",
"padding": "0", padding: "0",
"border": "none" border: "none"
}); });
if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
}) });
} }
if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
}) });
} }
if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
}) });
} }
if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
}) });
} }
return td; return td;
}, },
@ -115,4 +115,4 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.horizontal_adapt', BI.HorizontalAdaptLayout); BI.shortcut("bi.horizontal_adapt", BI.HorizontalAdaptLayout);

12
src/core/wrapper/layout/adapt/adapt.leftrightvertical.js

@ -31,7 +31,7 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
addItem: function () { addItem: function () {
// do nothing // do nothing
throw new Error("cannot be added") throw new Error("cannot be added");
}, },
stroke: function (items) { stroke: function (items) {
@ -73,7 +73,7 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.left_right_vertical_adapt', BI.LeftRightVerticalAdaptLayout); BI.shortcut("bi.left_right_vertical_adapt", BI.LeftRightVerticalAdaptLayout);
BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, { BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
@ -97,7 +97,7 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
addItem: function () { addItem: function () {
// do nothing // do nothing
throw new Error("cannot be added") throw new Error("cannot be added");
}, },
stroke: function (items) { stroke: function (items) {
@ -122,7 +122,7 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.left_vertical_adapt', BI.LeftVerticalAdaptLayout); BI.shortcut("bi.left_vertical_adapt", BI.LeftVerticalAdaptLayout);
BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, { BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
props: function () { props: function () {
@ -145,7 +145,7 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
addItem: function () { addItem: function () {
// do nothing // do nothing
throw new Error("cannot be added") throw new Error("cannot be added");
}, },
stroke: function (items) { stroke: function (items) {
@ -170,4 +170,4 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.right_vertical_adapt', BI.RightVerticalAdaptLayout); BI.shortcut("bi.right_vertical_adapt", BI.RightVerticalAdaptLayout);

32
src/core/wrapper/layout/adapt/adapt.vertical.js

@ -18,13 +18,13 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
render: function () { render: function () {
BI.VerticalAdaptLayout.superclass.render.apply(this, arguments); BI.VerticalAdaptLayout.superclass.render.apply(this, arguments);
var o = this.options; var o = this.options;
this.$table = $("<table>").attr({"cellspacing": 0, "cellpadding": 0}).css({ this.$table = $("<table>").attr({cellspacing: 0, cellpadding: 0}).css({
"position": "relative", position: "relative",
"width": o.horizontalAlign === BI.HorizontalAlign.Stretch ? "100%" : "auto", width: o.horizontalAlign === BI.HorizontalAlign.Stretch ? "100%" : "auto",
"height": "100%", height: "100%",
"white-space": "nowrap", "white-space": "nowrap",
"border-spacing": "0px", "border-spacing": "0px",
"border": "none", border: "none",
"border-collapse": "separate" "border-collapse": "separate"
}); });
this.$tr = $("<tr>"); this.$tr = $("<tr>");
@ -38,7 +38,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
var w = BI.createWidget(item); var w = BI.createWidget(item);
w.element.css({"position": "relative", "top": "0", "left": "0", "margin": "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
tagName: "td", tagName: "td",
@ -57,32 +57,32 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
td.element.addClass("first-element"); td.element.addClass("first-element");
} }
td.element.css({ td.element.css({
"position": "relative", position: "relative",
"height": "100%", height: "100%",
"vertical-align": "middle", "vertical-align": "middle",
"margin": "0", margin: "0",
"padding": "0", padding: "0",
"border": "none" border: "none"
}); });
if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
}) });
} }
if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
}) });
} }
if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
}) });
} }
if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
}) });
} }
return td; return td;
}, },
@ -116,4 +116,4 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.vertical_adapt', BI.VerticalAdaptLayout); BI.shortcut("bi.vertical_adapt", BI.VerticalAdaptLayout);

14
src/core/wrapper/layout/adapt/auto.horizontal.js

@ -25,28 +25,28 @@ BI.HorizontalAutoLayout = BI.inherit(BI.Layout, {
var o = this.options; var o = this.options;
var w = BI.HorizontalAutoLayout.superclass._addElement.apply(this, arguments); var w = BI.HorizontalAutoLayout.superclass._addElement.apply(this, arguments);
w.element.css({ w.element.css({
"position": "relative", position: "relative",
"margin": "0px auto" margin: "0px auto"
}); });
if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
}) });
} }
if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
}) });
} }
if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
}) });
} }
if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
}) });
} }
return w; return w;
}, },
@ -60,4 +60,4 @@ BI.HorizontalAutoLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.horizontal_auto', BI.HorizontalAutoLayout); BI.shortcut("bi.horizontal_auto", BI.HorizontalAutoLayout);

4
src/core/wrapper/layout/adapt/float.center.js

@ -25,7 +25,7 @@ BI.FloatCenterAdaptLayout = BI.inherit(BI.Layout, {
addItem: function () { addItem: function () {
// do nothing // do nothing
throw new Error("cannot be added") throw new Error("cannot be added");
}, },
mounted: function () { mounted: function () {
@ -71,4 +71,4 @@ BI.FloatCenterAdaptLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.float_center_adapt', BI.FloatCenterAdaptLayout); BI.shortcut("bi.float_center_adapt", BI.FloatCenterAdaptLayout);

2
src/core/wrapper/layout/adapt/float.horizontal.js

@ -67,4 +67,4 @@ BI.FloatHorizontalLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.horizontal_float', BI.FloatHorizontalLayout); BI.shortcut("bi.horizontal_float", BI.FloatHorizontalLayout);

4
src/core/wrapper/layout/flex/flex.center.js

@ -19,7 +19,7 @@ BI.FlexCenterLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var w = BI.FlexCenterLayout.superclass._addElement.apply(this, arguments); var w = BI.FlexCenterLayout.superclass._addElement.apply(this, arguments);
w.element.css({"position": "relative", "flex-shrink": "0"}); w.element.css({position: "relative", "flex-shrink": "0"});
return w; return w;
}, },
@ -32,4 +32,4 @@ BI.FlexCenterLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.flex_center', BI.FlexCenterLayout); BI.shortcut("bi.flex_center", BI.FlexCenterLayout);

12
src/core/wrapper/layout/flex/flex.horizontal.js

@ -30,26 +30,26 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var w = BI.FlexHorizontalLayout.superclass._addElement.apply(this, arguments); var w = BI.FlexHorizontalLayout.superclass._addElement.apply(this, arguments);
w.element.css({"position": "relative", "flex-shrink": "0"}); w.element.css({position: "relative", "flex-shrink": "0"});
if (o.hgap + o.lgap + (item.lgap || 0) > 0) { if (o.hgap + o.lgap + (item.lgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
}) });
} }
if (o.hgap + o.rgap + (item.rgap || 0) > 0) { if (o.hgap + o.rgap + (item.rgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
}) });
} }
if (o.vgap + o.tgap + (item.tgap || 0) > 0) { if (o.vgap + o.tgap + (item.tgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
}) });
} }
if (o.vgap + o.bgap + (item.bgap || 0) > 0) { if (o.vgap + o.bgap + (item.bgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
}) });
} }
return w; return w;
}, },
@ -63,4 +63,4 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.flex_horizontal', BI.FlexHorizontalLayout); BI.shortcut("bi.flex_horizontal", BI.FlexHorizontalLayout);

12
src/core/wrapper/layout/flex/flex.vertical.center.js

@ -29,26 +29,26 @@ BI.FlexVerticalCenter = BI.inherit(BI.Layout, {
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var w = BI.FlexVerticalCenter.superclass._addElement.apply(this, arguments); var w = BI.FlexVerticalCenter.superclass._addElement.apply(this, arguments);
w.element.css({"position": "relative", "flex-shrink": "0"}); w.element.css({position: "relative", "flex-shrink": "0"});
if (o.hgap + o.lgap + (item.lgap || 0) > 0) { if (o.hgap + o.lgap + (item.lgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
}) });
} }
if (o.hgap + o.rgap + (item.rgap || 0) > 0) { if (o.hgap + o.rgap + (item.rgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
}) });
} }
if (o.vgap + o.tgap + (item.tgap || 0) > 0) { if (o.vgap + o.tgap + (item.tgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
}) });
} }
if (o.vgap + o.bgap + (item.bgap || 0) > 0) { if (o.vgap + o.bgap + (item.bgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
}) });
} }
return w; return w;
}, },
@ -62,4 +62,4 @@ BI.FlexVerticalCenter = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.flex_vertical_center', BI.FlexVerticalCenter); BI.shortcut("bi.flex_vertical_center", BI.FlexVerticalCenter);

4
src/core/wrapper/layout/flex/wrapper/flex.wrapper.center.js

@ -20,7 +20,7 @@ BI.FlexCenterLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var w = BI.FlexCenterLayout.superclass._addElement.apply(this, arguments); var w = BI.FlexCenterLayout.superclass._addElement.apply(this, arguments);
w.element.css({"position": "relative"}); w.element.css({position: "relative"});
return w; return w;
}, },
@ -53,4 +53,4 @@ BI.FlexCenterLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.flex_wrapper_center', BI.FlexCenterLayout); BI.shortcut("bi.flex_wrapper_center", BI.FlexCenterLayout);

12
src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js

@ -30,26 +30,26 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var w = BI.FlexHorizontalLayout.superclass._addElement.apply(this, arguments); var w = BI.FlexHorizontalLayout.superclass._addElement.apply(this, arguments);
w.element.css({"position": "relative"}); w.element.css({position: "relative"});
if (o.hgap + o.lgap + (item.lgap || 0) > 0) { if (o.hgap + o.lgap + (item.lgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
}) });
} }
if (o.hgap + o.rgap + (item.rgap || 0) > 0) { if (o.hgap + o.rgap + (item.rgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
}) });
} }
if (o.vgap + o.tgap + (item.tgap || 0) > 0) { if (o.vgap + o.tgap + (item.tgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
}) });
} }
if (o.vgap + o.bgap + (item.bgap || 0) > 0) { if (o.vgap + o.bgap + (item.bgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
}) });
} }
return w; return w;
}, },
@ -83,4 +83,4 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.flex_wrapper_horizontal', BI.FlexHorizontalLayout); BI.shortcut("bi.flex_wrapper_horizontal", BI.FlexHorizontalLayout);

12
src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.center.js

@ -30,26 +30,26 @@ BI.FlexVerticalCenter = BI.inherit(BI.Layout, {
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var w = BI.FlexVerticalCenter.superclass._addElement.apply(this, arguments); var w = BI.FlexVerticalCenter.superclass._addElement.apply(this, arguments);
w.element.css({"position": "relative"}); w.element.css({position: "relative"});
if (o.hgap + o.lgap + (item.lgap || 0) > 0) { if (o.hgap + o.lgap + (item.lgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
}) });
} }
if (o.hgap + o.rgap + (item.rgap || 0) > 0) { if (o.hgap + o.rgap + (item.rgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
}) });
} }
if (o.vgap + o.tgap + (item.tgap || 0) > 0) { if (o.vgap + o.tgap + (item.tgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
}) });
} }
if (o.vgap + o.bgap + (item.bgap || 0) > 0) { if (o.vgap + o.bgap + (item.bgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
}) });
} }
return w; return w;
}, },
@ -83,4 +83,4 @@ BI.FlexVerticalCenter = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.flex_wrapper_vertical_center', BI.FlexVerticalCenter); BI.shortcut("bi.flex_wrapper_vertical_center", BI.FlexVerticalCenter);

34
src/core/wrapper/layout/layout.absolute.js

@ -25,60 +25,60 @@ BI.AbsoluteLayout = BI.inherit(BI.Layout, {
var w = BI.AbsoluteLayout.superclass._addElement.apply(this, arguments); var w = BI.AbsoluteLayout.superclass._addElement.apply(this, arguments);
var left = 0, right = 0, top = 0, bottom = 0; var left = 0, right = 0, top = 0, bottom = 0;
if (BI.isNotNull(item.left)) { if (BI.isNotNull(item.left)) {
w.element.css({"left": item.left}); w.element.css({left: item.left});
left += item.left; left += item.left;
} }
if (BI.isNotNull(item.right)) { if (BI.isNotNull(item.right)) {
w.element.css({"right": item.right}); w.element.css({right: item.right});
right += item.right; right += item.right;
} }
if (BI.isNotNull(item.top)) { if (BI.isNotNull(item.top)) {
w.element.css({"top": item.top}); w.element.css({top: item.top});
top += item.top; top += item.top;
} }
if (BI.isNotNull(item.bottom)) { if (BI.isNotNull(item.bottom)) {
w.element.css({"bottom": item.bottom}); w.element.css({bottom: item.bottom});
bottom += item.bottom; bottom += item.bottom;
} }
if (BI.isNotNull(o.hgap)) { if (BI.isNotNull(o.hgap)) {
left += o.hgap; left += o.hgap;
w.element.css({"left": left}); w.element.css({left: left});
right += o.hgap; right += o.hgap;
w.element.css({"right": right}); w.element.css({right: right});
} }
if (BI.isNotNull(o.vgap)) { if (BI.isNotNull(o.vgap)) {
top += o.vgap; top += o.vgap;
w.element.css({"top": top}); w.element.css({top: top});
bottom += o.vgap; bottom += o.vgap;
w.element.css({"bottom": bottom}); w.element.css({bottom: bottom});
} }
if (BI.isNotNull(o.lgap)) { if (BI.isNotNull(o.lgap)) {
left += o.lgap; left += o.lgap;
w.element.css({"left": left}); w.element.css({left: left});
} }
if (BI.isNotNull(o.rgap)) { if (BI.isNotNull(o.rgap)) {
right += o.rgap; right += o.rgap;
w.element.css({"right": right}); w.element.css({right: right});
} }
if (BI.isNotNull(o.tgap)) { if (BI.isNotNull(o.tgap)) {
top += o.tgap; top += o.tgap;
w.element.css({"top": top}); w.element.css({top: top});
} }
if (BI.isNotNull(o.bgap)) { if (BI.isNotNull(o.bgap)) {
bottom += o.bgap; bottom += o.bgap;
w.element.css({"bottom": bottom}); w.element.css({bottom: bottom});
} }
if (BI.isNotNull(item.width)) { if (BI.isNotNull(item.width)) {
w.element.css({"width": item.width}); w.element.css({width: item.width});
} }
if (BI.isNotNull(item.height)) { if (BI.isNotNull(item.height)) {
w.element.css({"height": item.height}); w.element.css({height: item.height});
} }
w.element.css({"position": "absolute"}); w.element.css({position: "absolute"});
return w; return w;
}, },
@ -90,7 +90,7 @@ BI.AbsoluteLayout = BI.inherit(BI.Layout, {
this.options.items = items || []; this.options.items = items || [];
var self = this; var self = this;
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (!!item) { if (item) {
if (!BI.isWidget(item) && !item.el) { if (!BI.isWidget(item) && !item.el) {
throw new Error("el must be exist"); throw new Error("el must be exist");
} }
@ -104,4 +104,4 @@ BI.AbsoluteLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.absolute', BI.AbsoluteLayout); BI.shortcut("bi.absolute", BI.AbsoluteLayout);

32
src/core/wrapper/layout/layout.adaptive.js

@ -18,64 +18,64 @@ BI.AdaptiveLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var w = BI.AdaptiveLayout.superclass._addElement.apply(this, arguments); var w = BI.AdaptiveLayout.superclass._addElement.apply(this, arguments);
w.element.css({"position": "relative"}); w.element.css({position: "relative"});
var left = 0, right = 0, top = 0, bottom = 0; var left = 0, right = 0, top = 0, bottom = 0;
if (BI.isNotNull(item.left)) { if (BI.isNotNull(item.left)) {
w.element.css({ w.element.css({
"margin-left": item.left "margin-left": item.left
}) });
} }
if (BI.isNotNull(item.right)) { if (BI.isNotNull(item.right)) {
w.element.css({ w.element.css({
"margin-right": item.right "margin-right": item.right
}) });
} }
if (BI.isNotNull(item.top)) { if (BI.isNotNull(item.top)) {
w.element.css({ w.element.css({
"margin-top": item.top "margin-top": item.top
}) });
} }
if (BI.isNotNull(item.bottom)) { if (BI.isNotNull(item.bottom)) {
w.element.css({ w.element.css({
"margin-bottom": item.bottom "margin-bottom": item.bottom
}) });
} }
if (BI.isNotNull(o.hgap)) { if (BI.isNotNull(o.hgap)) {
left += o.hgap; left += o.hgap;
w.element.css({"left": left}); w.element.css({left: left});
right += o.hgap; right += o.hgap;
w.element.css({"right": right}); w.element.css({right: right});
} }
if (BI.isNotNull(o.vgap)) { if (BI.isNotNull(o.vgap)) {
top += o.vgap; top += o.vgap;
w.element.css({"top": top}); w.element.css({top: top});
bottom += o.vgap; bottom += o.vgap;
w.element.css({"bottom": bottom}); w.element.css({bottom: bottom});
} }
if (BI.isNotNull(o.lgap)) { if (BI.isNotNull(o.lgap)) {
left += o.lgap; left += o.lgap;
w.element.css({"left": left}); w.element.css({left: left});
} }
if (BI.isNotNull(o.rgap)) { if (BI.isNotNull(o.rgap)) {
right += o.rgap; right += o.rgap;
w.element.css({"right": right}); w.element.css({right: right});
} }
if (BI.isNotNull(o.tgap)) { if (BI.isNotNull(o.tgap)) {
top += o.tgap; top += o.tgap;
w.element.css({"top": top}); w.element.css({top: top});
} }
if (BI.isNotNull(o.bgap)) { if (BI.isNotNull(o.bgap)) {
bottom += o.bgap; bottom += o.bgap;
w.element.css({"bottom": bottom}); w.element.css({bottom: bottom});
} }
if (BI.isNotNull(item.width)) { if (BI.isNotNull(item.width)) {
w.element.css({"width": item.width}); w.element.css({width: item.width});
} }
if (BI.isNotNull(item.height)) { if (BI.isNotNull(item.height)) {
w.element.css({"height": item.height}); w.element.css({height: item.height});
} }
return w; return w;
}, },
@ -89,4 +89,4 @@ BI.AdaptiveLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.adaptive', BI.AdaptiveLayout); BI.shortcut("bi.adaptive", BI.AdaptiveLayout);

38
src/core/wrapper/layout/layout.border.js

@ -22,7 +22,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
addItem: function (item) { addItem: function (item) {
// do nothing // do nothing
throw new Error("cannot be added") throw new Error("cannot be added");
}, },
stroke: function (regions) { stroke: function (regions) {
@ -41,11 +41,11 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
} }
this.getWidgetByName(this.getName() + "north").element.height(item.height) this.getWidgetByName(this.getName() + "north").element.height(item.height)
.css({ .css({
"position": "absolute", position: "absolute",
"top": (item.top || 0), top: (item.top || 0),
"left": (item.left || 0), left: (item.left || 0),
"right": (item.right || 0), right: (item.right || 0),
"bottom": "initial" bottom: "initial"
}); });
} }
top = (item.height || 0) + (item.top || 0) + (item.bottom || 0); top = (item.height || 0) + (item.top || 0) + (item.bottom || 0);
@ -61,11 +61,11 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
} }
this.getWidgetByName(this.getName() + "south").element.height(item.height) this.getWidgetByName(this.getName() + "south").element.height(item.height)
.css({ .css({
"position": "absolute", position: "absolute",
"bottom": (item.bottom || 0), bottom: (item.bottom || 0),
"left": (item.left || 0), left: (item.left || 0),
"right": (item.right || 0), right: (item.right || 0),
"top": "initial" top: "initial"
}); });
} }
bottom = (item.height || 0) + (item.top || 0) + (item.bottom || 0); bottom = (item.height || 0) + (item.top || 0) + (item.bottom || 0);
@ -81,11 +81,11 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
} }
this.getWidgetByName(this.getName() + "west").element.width(item.width) this.getWidgetByName(this.getName() + "west").element.width(item.width)
.css({ .css({
"position": "absolute", position: "absolute",
"left": (item.left || 0), left: (item.left || 0),
top: top, top: top,
bottom: bottom, bottom: bottom,
"right": "initial" right: "initial"
}); });
} }
left = (item.width || 0) + (item.left || 0) + (item.right || 0); left = (item.width || 0) + (item.left || 0) + (item.right || 0);
@ -101,11 +101,11 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
} }
this.getWidgetByName(this.getName() + "east").element.width(item.width) this.getWidgetByName(this.getName() + "east").element.width(item.width)
.css({ .css({
"position": "absolute", position: "absolute",
"right": (item.right || 0), right: (item.right || 0),
top: top, top: top,
bottom: bottom, bottom: bottom,
"left": "initial" left: "initial"
}); });
} }
right = (item.width || 0) + (item.left || 0) + (item.right || 0); right = (item.width || 0) + (item.left || 0) + (item.right || 0);
@ -119,7 +119,7 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
this.addWidget(this.getName() + "center", w); this.addWidget(this.getName() + "center", w);
} }
this.getWidgetByName(this.getName() + "center").element this.getWidgetByName(this.getName() + "center").element
.css({"position": "absolute", "top": top, "bottom": bottom, "left": left, "right": right}); .css({position: "absolute", top: top, bottom: bottom, left: left, right: right});
} }
} }
}, },
@ -129,4 +129,4 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.border', BI.BorderLayout); BI.shortcut("bi.border", BI.BorderLayout);

26
src/core/wrapper/layout/layout.card.js

@ -26,7 +26,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
var self = this, o = this.options; var self = this, o = this.options;
this.showIndex = void 0; this.showIndex = void 0;
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (!!item) { if (item) {
if (!self.hasWidget(item.cardName)) { if (!self.hasWidget(item.cardName)) {
var w = BI.createWidget(item); var w = BI.createWidget(item);
w.on(BI.Events.DESTROY, function () { w.on(BI.Events.DESTROY, function () {
@ -41,7 +41,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
} else { } else {
var w = self.getWidgetByName(item.cardName); var w = self.getWidgetByName(item.cardName);
} }
w.element.css({"position": "absolute", "top": "0", "right": "0", "bottom": "0", "left": "0"}); w.element.css({position: "absolute", top: "0", right: "0", bottom: "0", left: "0"});
w.setVisible(false); w.setVisible(false);
} }
}); });
@ -100,11 +100,11 @@ BI.CardLayout = BI.inherit(BI.Layout, {
} }
var widget = BI.createWidget(cardItem); var widget = BI.createWidget(cardItem);
widget.element.css({ widget.element.css({
"position": "relative", position: "relative",
"top": "0", top: "0",
"left": "0", left: "0",
"width": "100%", width: "100%",
"height": "100%" height: "100%"
}).appendTo(this.element); }).appendTo(this.element);
widget.invisible(); widget.invisible();
this.addWidget(cardName, widget); this.addWidget(cardName, widget);
@ -128,7 +128,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
// 动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了 // 动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了
!flag && !exist && (BI.Action && action instanceof BI.Action) ? (action.actionBack(el), flag = true) : el.invisible(); !flag && !exist && (BI.Action && action instanceof BI.Action) ? (action.actionBack(el), flag = true) : el.invisible();
} else { } else {
(BI.Action && action instanceof BI.Action) ? action.actionPerformed(void 0, el, callback) : (el.visible(), callback && callback()) (BI.Action && action instanceof BI.Action) ? action.actionPerformed(void 0, el, callback) : (el.visible(), callback && callback());
} }
} }
}); });
@ -139,7 +139,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
this.showIndex = this.lastShowIndex; this.showIndex = this.lastShowIndex;
BI.each(this.options.items, function (i, item) { BI.each(this.options.items, function (i, item) {
self._children[item.cardName].setVisible(self.showIndex == i); self._children[item.cardName].setVisible(self.showIndex == i);
}) });
}, },
setDefaultShowName: function (name) { setDefaultShowName: function (name) {
@ -154,7 +154,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
getAllCardNames: function () { getAllCardNames: function () {
return BI.map(this.options.items, function (i, item) { return BI.map(this.options.items, function (i, item) {
return item.cardName; return item.cardName;
}) });
}, },
getShowingCard: function () { getShowingCard: function () {
@ -168,7 +168,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
var self = this; var self = this;
BI.each(this.getAllCardNames(), function (i, name) { BI.each(this.getAllCardNames(), function (i, name) {
self.deleteCardByName(name); self.deleteCardByName(name);
}) });
}, },
hideAllCard: function () { hideAllCard: function () {
@ -197,7 +197,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
if (child === nameOrWidget) { if (child === nameOrWidget) {
removeName = name; removeName = name;
} }
}) });
} else { } else {
removeName = nameOrWidget; removeName = nameOrWidget;
} }
@ -206,4 +206,4 @@ BI.CardLayout = BI.inherit(BI.Layout, {
} }
} }
}); });
BI.shortcut('bi.card', BI.CardLayout); BI.shortcut("bi.card", BI.CardLayout);

10
src/core/wrapper/layout/layout.default.js

@ -27,22 +27,22 @@ BI.DefaultLayout = BI.inherit(BI.Layout, {
if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
}) });
} }
if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
}) });
} }
if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
}) });
} }
if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
}) });
} }
return w; return w;
}, },
@ -56,4 +56,4 @@ BI.DefaultLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.default', BI.DefaultLayout); BI.shortcut("bi.default", BI.DefaultLayout);

20
src/core/wrapper/layout/layout.division.js

@ -47,7 +47,7 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
addItem: function (item) { addItem: function (item) {
// do nothing // do nothing
throw new Error("cannot be added") throw new Error("cannot be added");
}, },
stroke: function (items) { stroke: function (items) {
@ -56,7 +56,7 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
var map = BI.makeArray(rows), widths = {}, heights = {}; var map = BI.makeArray(rows), widths = {}, heights = {};
function firstElement (item, row, col) { function firstElement (item, row, col) {
if (row === 0) { if (row === 0) {
item.addClass("first-row") item.addClass("first-row");
} }
if (col === 0) { if (col === 0) {
item.addClass("first-col"); item.addClass("first-col");
@ -85,7 +85,7 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
} else if (item.el instanceof BI.Widget) { } else if (item.el instanceof BI.Widget) {
firstElement(item.el.element, row, col); firstElement(item.el.element, row, col);
} else if (item.el) { } else if (item.el) {
firstObject(item.el, row, col) firstObject(item.el, row, col);
} else { } else {
firstObject(item, row, col); firstObject(item, row, col);
} }
@ -119,13 +119,13 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
w = this.getWidgetByName(this.getName() + i + "_" + j); w = this.getWidgetByName(this.getName() + i + "_" + j);
} }
var left = totalW * 100 / widths[i]; var left = totalW * 100 / widths[i];
w.element.css({"position": "absolute", "left": left + "%"}); w.element.css({position: "absolute", left: left + "%"});
if (j > 0) { if (j > 0) {
var lastW = this.getWidgetByName(this.getName() + i + "_" + (j - 1)); var lastW = this.getWidgetByName(this.getName() + i + "_" + (j - 1));
lastW.element.css({"right": (100 - left) + "%"}); lastW.element.css({right: (100 - left) + "%"});
} }
if (j == o.columns - 1) { if (j == o.columns - 1) {
w.element.css({"right": "0%"}); w.element.css({right: "0%"});
} }
first(w, i, j); first(w, i, j);
totalW += map[i][j].width; totalW += map[i][j].width;
@ -136,13 +136,13 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
for (var i = 0; i < o.rows; i++) { for (var i = 0; i < o.rows; i++) {
var w = this.getWidgetByName(this.getName() + i + "_" + j); var w = this.getWidgetByName(this.getName() + i + "_" + j);
var top = totalH * 100 / heights[j]; var top = totalH * 100 / heights[j];
w.element.css({"top": top + "%"}); w.element.css({top: top + "%"});
if (i > 0) { if (i > 0) {
var lastW = this.getWidgetByName(this.getName() + (i - 1) + "_" + j); var lastW = this.getWidgetByName(this.getName() + (i - 1) + "_" + j);
lastW.element.css({"bottom": (100 - top) + "%"}); lastW.element.css({bottom: (100 - top) + "%"});
} }
if (i == o.rows - 1) { if (i == o.rows - 1) {
w.element.css({"bottom": "0%"}); w.element.css({bottom: "0%"});
} }
totalH += map[i][j].height; totalH += map[i][j].height;
} }
@ -154,4 +154,4 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.division', BI.DivisionLayout); BI.shortcut("bi.division", BI.DivisionLayout);

20
src/core/wrapper/layout/layout.flow.js

@ -27,15 +27,15 @@ BI.FloatLeftLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var w = BI.FloatLeftLayout.superclass._addElement.apply(this, arguments); var w = BI.FloatLeftLayout.superclass._addElement.apply(this, arguments);
w.element.css({"position": "relative", "float": "left"}); w.element.css({position: "relative", float: "left"});
if (BI.isNotNull(item.left)) { if (BI.isNotNull(item.left)) {
w.element.css({"left": item.left}); w.element.css({left: item.left});
} }
if (BI.isNotNull(item.right)) { if (BI.isNotNull(item.right)) {
w.element.css({"right": item.right}); w.element.css({right: item.right});
} }
if (BI.isNotNull(item.top)) { if (BI.isNotNull(item.top)) {
w.element.css({"top": item.top}); w.element.css({top: item.top});
} }
if ((item.lgap || 0) + o.hgap + o.lgap !== 0) { if ((item.lgap || 0) + o.hgap + o.lgap !== 0) {
w.element.css("margin-left", (item.lgap || 0) + o.hgap + o.lgap); w.element.css("margin-left", (item.lgap || 0) + o.hgap + o.lgap);
@ -61,7 +61,7 @@ BI.FloatLeftLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.left', BI.FloatLeftLayout); BI.shortcut("bi.left", BI.FloatLeftLayout);
/** /**
* 靠右对齐的自由浮动布局 * 靠右对齐的自由浮动布局
@ -92,15 +92,15 @@ BI.FloatRightLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var w = BI.FloatRightLayout.superclass._addElement.apply(this, arguments); var w = BI.FloatRightLayout.superclass._addElement.apply(this, arguments);
w.element.css({"position": "relative", "float": "right"}); w.element.css({position: "relative", float: "right"});
if (BI.isNotNull(item.left)) { if (BI.isNotNull(item.left)) {
w.element.css({"left": item.left}); w.element.css({left: item.left});
} }
if (BI.isNotNull(item.right)) { if (BI.isNotNull(item.right)) {
w.element.css({"right": item.right}); w.element.css({right: item.right});
} }
if (BI.isNotNull(item.top)) { if (BI.isNotNull(item.top)) {
w.element.css({"top": item.top}); w.element.css({top: item.top});
} }
if ((item.lgap || 0) + o.hgap + o.lgap !== 0) { if ((item.lgap || 0) + o.hgap + o.lgap !== 0) {
w.element.css("margin-left", (item.lgap || 0) + o.hgap + o.lgap); w.element.css("margin-left", (item.lgap || 0) + o.hgap + o.lgap);
@ -126,4 +126,4 @@ BI.FloatRightLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.right', BI.FloatRightLayout); BI.shortcut("bi.right", BI.FloatRightLayout);

18
src/core/wrapper/layout/layout.grid.js

@ -41,7 +41,7 @@ BI.GridLayout = BI.inherit(BI.Layout, {
addItem: function () { addItem: function () {
// do nothing // do nothing
throw new Error("cannot be added") throw new Error("cannot be added");
}, },
stroke: function (items) { stroke: function (items) {
@ -54,7 +54,7 @@ BI.GridLayout = BI.inherit(BI.Layout, {
} }
function firstElement (item, row, col) { function firstElement (item, row, col) {
if (row === 0) { if (row === 0) {
item.addClass("first-row") item.addClass("first-row");
} }
if (col === 0) { if (col === 0) {
item.addClass("first-col"); item.addClass("first-col");
@ -83,7 +83,7 @@ BI.GridLayout = BI.inherit(BI.Layout, {
} else if (item.el instanceof BI.Widget) { } else if (item.el instanceof BI.Widget) {
firstElement(item.el.element, row, col); firstElement(item.el.element, row, col);
} else if (item.el) { } else if (item.el) {
firstObject(item.el, row, col) firstObject(item.el, row, col);
} else { } else {
firstObject(item, row, col); firstObject(item, row, col);
} }
@ -107,11 +107,11 @@ BI.GridLayout = BI.inherit(BI.Layout, {
} }
first(els[i][j], i, j); first(els[i][j], i, j);
els[i][j].element.css({ els[i][j].element.css({
"position": "absolute", position: "absolute",
"top": height * i + "%", top: height * i + "%",
"left": width * j + "%", left: width * j + "%",
"right": (100 - (width * (j + 1))) + "%", right: (100 - (width * (j + 1))) + "%",
"bottom": (100 - (height * (i + 1))) + "%" bottom: (100 - (height * (i + 1))) + "%"
}); });
this.addWidget(els[i][j]); this.addWidget(els[i][j]);
} }
@ -123,4 +123,4 @@ BI.GridLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.grid', BI.GridLayout); BI.shortcut("bi.grid", BI.GridLayout);

40
src/core/wrapper/layout/layout.horizontal.js

@ -20,11 +20,11 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
}, },
render: function () { render: function () {
BI.HorizontalLayout.superclass.render.apply(this, arguments); BI.HorizontalLayout.superclass.render.apply(this, arguments);
this.$table = $("<table>").attr({"cellspacing": 0, "cellpadding": 0}).css({ this.$table = $("<table>").attr({cellspacing: 0, cellpadding: 0}).css({
"position": "relative", position: "relative",
"white-space": "nowrap", "white-space": "nowrap",
"border-spacing": "0px", "border-spacing": "0px",
"border": "none", border: "none",
"border-collapse": "separate" "border-collapse": "separate"
}); });
this.$tr = $("<tr>"); this.$tr = $("<tr>");
@ -38,7 +38,7 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {
var w = BI.createWidget(item); var w = BI.createWidget(item);
w.element.css({"position": "relative", "margin": "0px auto"}); w.element.css({position: "relative", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
tagName: "td", tagName: "td",
@ -57,31 +57,31 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
td.element.addClass("first-element"); td.element.addClass("first-element");
} }
td.element.css({ td.element.css({
"position": "relative", position: "relative",
"vertical-align": o.verticalAlign, "vertical-align": o.verticalAlign,
"margin": "0", margin: "0",
"padding": "0", padding: "0",
"border": "none" border: "none"
}); });
if (o.hgap + o.lgap + (item.lgap || 0) > 0) { if (o.hgap + o.lgap + (item.lgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
}) });
} }
if (o.hgap + o.rgap + (item.rgap || 0) > 0) { if (o.hgap + o.rgap + (item.rgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
}) });
} }
if (o.vgap + o.tgap + (item.tgap || 0) > 0) { if (o.vgap + o.tgap + (item.tgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
}) });
} }
if (o.vgap + o.bgap + (item.bgap || 0) > 0) { if (o.vgap + o.bgap + (item.bgap || 0) > 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
}) });
} }
return td; return td;
}, },
@ -116,7 +116,7 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.horizontal', BI.HorizontalLayout); BI.shortcut("bi.horizontal", BI.HorizontalLayout);
/** /**
* 水平布局 * 水平布局
@ -138,33 +138,33 @@ BI.HorizontalCellLayout = BI.inherit(BI.Layout, {
}, },
render: function () { render: function () {
BI.HorizontalCellLayout.superclass.render.apply(this, arguments); BI.HorizontalCellLayout.superclass.render.apply(this, arguments);
this.element.css({"display": "table", "vertical-align": "top"}); this.element.css({display: "table", "vertical-align": "top"});
this.populate(this.options.items); this.populate(this.options.items);
}, },
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var w = BI.HorizontalCellLayout.superclass._addElement.apply(this, arguments); var w = BI.HorizontalCellLayout.superclass._addElement.apply(this, arguments);
w.element.css({"position": "relative", "display": "table-cell", "vertical-align": "middle"}); w.element.css({position: "relative", display: "table-cell", "vertical-align": "middle"});
if (o.hgap + o.lgap > 0) { if (o.hgap + o.lgap > 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + "px" "margin-left": o.hgap + o.lgap + "px"
}) });
} }
if (o.hgap + o.rgap > 0) { if (o.hgap + o.rgap > 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + "px" "margin-right": o.hgap + o.rgap + "px"
}) });
} }
if (o.vgap + o.tgap > 0) { if (o.vgap + o.tgap > 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + "px" "margin-top": o.vgap + o.tgap + "px"
}) });
} }
if (o.vgap + o.bgap > 0) { if (o.vgap + o.bgap > 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + "px" "margin-bottom": o.vgap + o.bgap + "px"
}) });
} }
return w; return w;
}, },
@ -178,4 +178,4 @@ BI.HorizontalCellLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.horizontal_cell', BI.HorizontalCellLayout); BI.shortcut("bi.horizontal_cell", BI.HorizontalCellLayout);

6
src/core/wrapper/layout/layout.lattice.js

@ -25,9 +25,9 @@ BI.LatticeLayout = BI.inherit(BI.Layout, {
if (o.columnSize && o.columnSize[i]) { if (o.columnSize && o.columnSize[i]) {
var width = o.columnSize[i] / BI.sum(o.columnSize) * 100 + "%"; var width = o.columnSize[i] / BI.sum(o.columnSize) * 100 + "%";
} else { } else {
var width = 1 / this.options.items.length * 100 + "%" var width = 1 / this.options.items.length * 100 + "%";
} }
w.element.css({"position": "relative", "float": "left", "width": width}); w.element.css({position: "relative", float: "left", width: width});
return w; return w;
}, },
@ -52,4 +52,4 @@ BI.LatticeLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.lattice', BI.LatticeLayout); BI.shortcut("bi.lattice", BI.LatticeLayout);

22
src/core/wrapper/layout/layout.table.js

@ -9,19 +9,19 @@ BI.TableLayout = BI.inherit(BI.Layout, {
return BI.extend(BI.TableLayout.superclass.props.apply(this, arguments), { return BI.extend(BI.TableLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-table-layout", baseCls: "bi-table-layout",
scrolly: true, scrolly: true,
columnSize: [200, 200, 'fill'], columnSize: [200, 200, "fill"],
rowSize: 30, // or [30,30,30] rowSize: 30, // or [30,30,30]
hgap: 0, hgap: 0,
vgap: 0, vgap: 0,
items: [[ items: [[
{ {
el: {text: 'label1'} el: {text: "label1"}
}, },
{ {
el: {text: 'label2'} el: {text: "label2"}
}, },
{ {
el: {text: 'label3'} el: {text: "label3"}
} }
]] ]]
}); });
@ -38,7 +38,7 @@ BI.TableLayout = BI.inherit(BI.Layout, {
function firstElement (item, row, col) { function firstElement (item, row, col) {
if (row === 0) { if (row === 0) {
item.addClass("first-row") item.addClass("first-row");
} }
if (col === 0) { if (col === 0) {
item.addClass("first-col"); item.addClass("first-col");
@ -67,7 +67,7 @@ BI.TableLayout = BI.inherit(BI.Layout, {
} else if (item.el instanceof BI.Widget) { } else if (item.el instanceof BI.Widget) {
firstElement(item.el.element, row, col); firstElement(item.el.element, row, col);
} else if (item.el) { } else if (item.el) {
firstObject(item.el, row, col) firstObject(item.el, row, col);
} else { } else {
firstObject(item, row, col); firstObject(item, row, col);
} }
@ -95,7 +95,7 @@ BI.TableLayout = BI.inherit(BI.Layout, {
bottom: 0, bottom: 0,
right: o.columnSize[j] <= 1 ? right * 100 + "%" : right, right: o.columnSize[j] <= 1 ? right * 100 + "%" : right,
width: o.columnSize[j] <= 1 ? o.columnSize[j] * 100 + "%" : o.columnSize[j] width: o.columnSize[j] <= 1 ? o.columnSize[j] * 100 + "%" : o.columnSize[j]
}, arr[j])) }, arr[j]));
right += o.columnSize[j] + (o.columnSize[j] < 1 ? 0 : o.hgap); right += o.columnSize[j] + (o.columnSize[j] < 1 ? 0 : o.hgap);
} else { } else {
throw new Error("item with fill can only be one"); throw new Error("item with fill can only be one");
@ -108,7 +108,7 @@ BI.TableLayout = BI.inherit(BI.Layout, {
bottom: 0, bottom: 0,
left: left <= 1 ? left * 100 + "%" : left, left: left <= 1 ? left * 100 + "%" : left,
right: right <= 1 ? right * 100 + "%" : right right: right <= 1 ? right * 100 + "%" : right
}, arr[i])) }, arr[i]));
} }
var w = BI.createWidget({ var w = BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
@ -118,10 +118,10 @@ BI.TableLayout = BI.inherit(BI.Layout, {
if (this.rows > 0) { if (this.rows > 0) {
this.getWidgetByName(this.getName() + (this.rows - 1)).element.css({ this.getWidgetByName(this.getName() + (this.rows - 1)).element.css({
"margin-bottom": o.vgap "margin-bottom": o.vgap
}) });
} }
w.element.css({ w.element.css({
"position": "relative" position: "relative"
}); });
this.addWidget(this.getName() + (this.rows++), w); this.addWidget(this.getName() + (this.rows++), w);
return w; return w;
@ -143,4 +143,4 @@ BI.TableLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.table', BI.TableLayout); BI.shortcut("bi.table", BI.TableLayout);

48
src/core/wrapper/layout/layout.tape.js

@ -16,15 +16,15 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
items: [ items: [
{ {
width: 100, width: 100,
el: {type: 'bi.button', text: 'button1'} el: {type: "bi.button", text: "button1"}
}, },
{ {
width: 'fill', width: "fill",
el: {type: 'bi.button', text: 'button2'} el: {type: "bi.button", text: "button2"}
}, },
{ {
width: 200, width: 200,
el: {type: 'bi.button', text: 'button3'} el: {type: "bi.button", text: "button3"}
} }
] ]
}); });
@ -39,7 +39,7 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
}, },
addItem: function (item) { addItem: function (item) {
// do nothing // do nothing
throw new Error("cannot be added") throw new Error("cannot be added");
}, },
stroke: function (items) { stroke: function (items) {
@ -52,7 +52,7 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
} else { } else {
w = self.getWidgetByName(self.getName() + i + ""); w = self.getWidgetByName(self.getName() + i + "");
} }
w.element.css({"position": "absolute", top: o.vgap + o.tgap + "px", bottom: o.vgap + o.bgap + "px"}); w.element.css({position: "absolute", top: o.vgap + o.tgap + "px", bottom: o.vgap + o.bgap + "px"});
}); });
var left = {}, right = {}; var left = {}, right = {};
@ -65,10 +65,10 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
left[i] = left[i - 1] + items[i - 1].width + 2 * o.hgap + o.lgap + o.rgap; left[i] = left[i - 1] + items[i - 1].width + 2 * o.hgap + o.lgap + o.rgap;
} }
if (item.width < 1 && item.width >= 0) { if (item.width < 1 && item.width >= 0) {
w.element.css({"left": left[i] * 100 + "%", width: item.width * 100 + "%"}) w.element.css({left: left[i] * 100 + "%", width: item.width * 100 + "%"});
} else { } else {
w.element.css({ w.element.css({
"left": left[i] + o.hgap + o.lgap + "px", left: left[i] + o.hgap + o.lgap + "px",
width: BI.isNumber(item.width) ? item.width : "" width: BI.isNumber(item.width) ? item.width : ""
}); });
} }
@ -82,17 +82,17 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
right[i] = right[i + 1] + items[i + 1].width + 2 * o.hgap + o.lgap + o.rgap; right[i] = right[i + 1] + items[i + 1].width + 2 * o.hgap + o.lgap + o.rgap;
} }
if (item.width < 1 && item.width >= 0) { if (item.width < 1 && item.width >= 0) {
w.element.css({"right": right[i] * 100 + "%", width: item.width * 100 + "%"}) w.element.css({right: right[i] * 100 + "%", width: item.width * 100 + "%"});
} else { } else {
w.element.css({ w.element.css({
"right": right[i] + o.hgap + o.rgap + "px", right: right[i] + o.hgap + o.rgap + "px",
width: BI.isNumber(item.width) ? item.width : "" width: BI.isNumber(item.width) ? item.width : ""
}); });
} }
if (!BI.isNumber(item.width)) { if (!BI.isNumber(item.width)) {
return true; return true;
} }
}) });
}, },
populate: function (items) { populate: function (items) {
@ -100,7 +100,7 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.htape', BI.HTapeLayout); BI.shortcut("bi.htape", BI.HTapeLayout);
/** /**
* 垂直tape布局 * 垂直tape布局
@ -120,15 +120,15 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
items: [ items: [
{ {
height: 100, height: 100,
el: {type: 'bi.button', text: 'button1'} el: {type: "bi.button", text: "button1"}
}, },
{ {
height: 'fill', height: "fill",
el: {type: 'bi.button', text: 'button2'} el: {type: "bi.button", text: "button2"}
}, },
{ {
height: 200, height: 200,
el: {type: 'bi.button', text: 'button3'} el: {type: "bi.button", text: "button3"}
} }
] ]
}); });
@ -144,7 +144,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
addItem: function (item) { addItem: function (item) {
// do nothing // do nothing
throw new Error("cannot be added") throw new Error("cannot be added");
}, },
stroke: function (items) { stroke: function (items) {
@ -157,7 +157,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
} else { } else {
w = self.getWidgetByName(self.getName() + i + ""); w = self.getWidgetByName(self.getName() + i + "");
} }
w.element.css({"position": "absolute", left: o.hgap + o.lgap + "px", right: o.hgap + o.rgap + "px"}); w.element.css({position: "absolute", left: o.hgap + o.lgap + "px", right: o.hgap + o.rgap + "px"});
}); });
var top = {}, bottom = {}; var top = {}, bottom = {};
@ -170,10 +170,10 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
top[i] = top[i - 1] + items[i - 1].height + 2 * o.vgap + o.tgap + o.bgap; top[i] = top[i - 1] + items[i - 1].height + 2 * o.vgap + o.tgap + o.bgap;
} }
if (item.height < 1 && item.height >= 0) { if (item.height < 1 && item.height >= 0) {
w.element.css({"top": top[i] * 100 + "%", height: item.height * 100 + "%"}) w.element.css({top: top[i] * 100 + "%", height: item.height * 100 + "%"});
} else { } else {
w.element.css({ w.element.css({
"top": top[i] + o.vgap + o.tgap + "px", top: top[i] + o.vgap + o.tgap + "px",
height: BI.isNumber(item.height) ? item.height : "" height: BI.isNumber(item.height) ? item.height : ""
}); });
} }
@ -187,17 +187,17 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
bottom[i] = bottom[i + 1] + items[i + 1].height + 2 * o.vgap + o.tgap + o.bgap; bottom[i] = bottom[i + 1] + items[i + 1].height + 2 * o.vgap + o.tgap + o.bgap;
} }
if (item.height < 1 && item.height >= 0) { if (item.height < 1 && item.height >= 0) {
w.element.css({"bottom": bottom[i] * 100 + "%", height: item.height * 100 + "%"}) w.element.css({bottom: bottom[i] * 100 + "%", height: item.height * 100 + "%"});
} else { } else {
w.element.css({ w.element.css({
"bottom": bottom[i] + o.vgap + o.bgap + "px", bottom: bottom[i] + o.vgap + o.bgap + "px",
height: BI.isNumber(item.height) ? item.height : "" height: BI.isNumber(item.height) ? item.height : ""
}); });
} }
if (!BI.isNumber(item.height)) { if (!BI.isNumber(item.height)) {
return true; return true;
} }
}) });
}, },
populate: function (items) { populate: function (items) {
@ -205,4 +205,4 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.vtape', BI.VTapeLayout); BI.shortcut("bi.vtape", BI.VTapeLayout);

36
src/core/wrapper/layout/layout.td.js

@ -12,25 +12,25 @@ BI.TdLayout = BI.inherit(BI.Layout, {
vgap: 0, vgap: 0,
items: [[ items: [[
{ {
el: {text: 'label1'} el: {text: "label1"}
}, },
{ {
el: {text: 'label2'} el: {text: "label2"}
}, },
{ {
el: {text: 'label3'} el: {text: "label3"}
} }
]] ]]
}); });
}, },
render: function () { render: function () {
BI.TdLayout.superclass.render.apply(this, arguments); BI.TdLayout.superclass.render.apply(this, arguments);
this.$table = $("<table>").attr({"cellspacing": 0, "cellpadding": 0}).css({ this.$table = $("<table>").attr({cellspacing: 0, cellpadding: 0}).css({
"position": "relative", position: "relative",
"width": "100%", width: "100%",
"height": "100%", height: "100%",
"border-spacing": "0px", "border-spacing": "0px",
"border": "none", border: "none",
"border-collapse": "separate" "border-collapse": "separate"
}); });
this.rows = 0; this.rows = 0;
@ -42,7 +42,7 @@ BI.TdLayout = BI.inherit(BI.Layout, {
function firstElement (item, row, col) { function firstElement (item, row, col) {
if (row === 0) { if (row === 0) {
item.addClass("first-row") item.addClass("first-row");
} }
if (col === 0) { if (col === 0) {
item.addClass("first-col"); item.addClass("first-col");
@ -71,7 +71,7 @@ BI.TdLayout = BI.inherit(BI.Layout, {
} else if (item.el instanceof BI.Widget) { } else if (item.el instanceof BI.Widget) {
firstElement(item.el.element, row, col); firstElement(item.el.element, row, col);
} else if (item.el) { } else if (item.el) {
firstObject(item.el, row, col) firstObject(item.el, row, col);
} else { } else {
firstObject(item, row, col); firstObject(item, row, col);
} }
@ -84,7 +84,7 @@ BI.TdLayout = BI.inherit(BI.Layout, {
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
var w = BI.createWidget(arr[i]); var w = BI.createWidget(arr[i]);
w.element.css({"position": "relative", "top": "0", "left": "0", "margin": "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
if (arr[i].lgap) { if (arr[i].lgap) {
w.element.css({"margin-left": arr[i].lgap + "px"}); w.element.css({"margin-left": arr[i].lgap + "px"});
} }
@ -99,19 +99,19 @@ BI.TdLayout = BI.inherit(BI.Layout, {
} }
first(w, this.rows++, i); first(w, this.rows++, i);
var td = BI.createWidget({ var td = BI.createWidget({
type: 'bi.default', type: "bi.default",
attributes: { attributes: {
width: o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i] width: o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]
}, },
tagName: 'td', tagName: "td",
items: [w] items: [w]
}); });
td.element.css({ td.element.css({
"position": "relative", position: "relative",
"vertical-align": "middle", "vertical-align": "middle",
"margin": "0", margin: "0",
"padding": "0", padding: "0",
"border": "none" border: "none"
}); });
tr.addItem(td); tr.addItem(td);
} }
@ -151,4 +151,4 @@ BI.TdLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.td', BI.TdLayout); BI.shortcut("bi.td", BI.TdLayout);

12
src/core/wrapper/layout/layout.vertical.js

@ -25,27 +25,27 @@ BI.VerticalLayout = BI.inherit(BI.Layout, {
var o = this.options; var o = this.options;
var w = BI.VerticalLayout.superclass._addElement.apply(this, arguments); var w = BI.VerticalLayout.superclass._addElement.apply(this, arguments);
w.element.css({ w.element.css({
"position": "relative" position: "relative"
}); });
if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px"
}) });
} }
if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px"
}) });
} }
if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { if (o.hgap + o.rgap + (item.rgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px"
}) });
} }
if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { if (o.vgap + o.bgap + (item.bgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px"
}) });
} }
return w; return w;
}, },
@ -59,4 +59,4 @@ BI.VerticalLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.vertical', BI.VerticalLayout); BI.shortcut("bi.vertical", BI.VerticalLayout);

26
src/core/wrapper/layout/layout.window.js

@ -19,13 +19,13 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
rowSize: [100, "fill"], rowSize: [100, "fill"],
items: [[ items: [[
{ {
el: {type: 'bi.button', text: 'button1'} el: {type: "bi.button", text: "button1"}
}, },
{ {
el: {type: 'bi.button', text: 'button2'} el: {type: "bi.button", text: "button2"}
}, },
{ {
el: {type: 'bi.button', text: 'button3'} el: {type: "bi.button", text: "button3"}
} }
]] ]]
}); });
@ -41,7 +41,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
addItem: function (item) { addItem: function (item) {
// do nothing // do nothing
throw new Error("cannot be added") throw new Error("cannot be added");
}, },
stroke: function (items) { stroke: function (items) {
@ -54,7 +54,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
} }
function firstElement (item, row, col) { function firstElement (item, row, col) {
if (row === 0) { if (row === 0) {
item.addClass("first-row") item.addClass("first-row");
} }
if (col === 0) { if (col === 0) {
item.addClass("first-col"); item.addClass("first-col");
@ -83,7 +83,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
} else if (item.el instanceof BI.Widget) { } else if (item.el instanceof BI.Widget) {
firstElement(item.el.element, row, col); firstElement(item.el.element, row, col);
} else if (item.el) { } else if (item.el) {
firstObject(item.el, row, col) firstObject(item.el, row, col);
} else { } else {
firstObject(item, row, col); firstObject(item, row, col);
} }
@ -96,7 +96,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
} }
if (!this.hasWidget(this.getName() + i + "_" + j)) { if (!this.hasWidget(this.getName() + i + "_" + j)) {
var w = BI.createWidget(o.items[i][j]); var w = BI.createWidget(o.items[i][j]);
w.element.css({"position": "absolute"}); w.element.css({position: "absolute"});
this.addWidget(this.getName() + i + "_" + j, w); this.addWidget(this.getName() + i + "_" + j, w);
} }
} }
@ -117,7 +117,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
if (BI.isNumber(o.rowSize[i])) { if (BI.isNumber(o.rowSize[i])) {
h = o.rowSize[i] <= 1 ? o.rowSize[i] * 100 + "%" : o.rowSize[i] + "px"; h = o.rowSize[i] <= 1 ? o.rowSize[i] * 100 + "%" : o.rowSize[i] + "px";
} }
wi.element.css({"top": t, height: h}); wi.element.css({top: t, height: h});
first(wi, i, j); first(wi, i, j);
} }
if (!BI.isNumber(o.rowSize[i])) { if (!BI.isNumber(o.rowSize[i])) {
@ -135,7 +135,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
if (BI.isNumber(o.rowSize[i])) { if (BI.isNumber(o.rowSize[i])) {
h = o.rowSize[i] <= 1 ? o.rowSize[i] * 100 + "%" : o.rowSize[i] + "px"; h = o.rowSize[i] <= 1 ? o.rowSize[i] * 100 + "%" : o.rowSize[i] + "px";
} }
wi.element.css({"bottom": b, height: h}); wi.element.css({bottom: b, height: h});
first(wi, i, j); first(wi, i, j);
} }
if (!BI.isNumber(o.rowSize[i])) { if (!BI.isNumber(o.rowSize[i])) {
@ -153,7 +153,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
if (BI.isNumber(o.columnSize[j])) { if (BI.isNumber(o.columnSize[j])) {
w = o.columnSize[j] <= 1 ? o.columnSize[j] * 100 + "%" : o.columnSize[j] + "px"; w = o.columnSize[j] <= 1 ? o.columnSize[j] * 100 + "%" : o.columnSize[j] + "px";
} }
wi.element.css({"left": l, width: w}); wi.element.css({left: l, width: w});
first(wi, i, j); first(wi, i, j);
} }
if (!BI.isNumber(o.columnSize[j])) { if (!BI.isNumber(o.columnSize[j])) {
@ -165,13 +165,13 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
for (var i = 0; i < o.rows; i++) { for (var i = 0; i < o.rows; i++) {
var wi = this.getWidgetByName(this.getName() + i + "_" + j); var wi = this.getWidgetByName(this.getName() + i + "_" + j);
if (BI.isNull(right[j])) { if (BI.isNull(right[j])) {
right[j] = right[j + 1] + (o.columnSize[j + 1] < 1 ? o.columnSize[j + 1] : o.columnSize[j + 1] + o.hgap + o.lgap) right[j] = right[j + 1] + (o.columnSize[j + 1] < 1 ? o.columnSize[j + 1] : o.columnSize[j + 1] + o.hgap + o.lgap);
} }
var r = right[j] <= 1 ? right[j] * 100 + "%" : right[j] + o.hgap + o.rgap + "px", w = ""; var r = right[j] <= 1 ? right[j] * 100 + "%" : right[j] + o.hgap + o.rgap + "px", w = "";
if (BI.isNumber(o.columnSize[j])) { if (BI.isNumber(o.columnSize[j])) {
w = o.columnSize[j] <= 1 ? o.columnSize[j] * 100 + "%" : o.columnSize[j] + "px"; w = o.columnSize[j] <= 1 ? o.columnSize[j] * 100 + "%" : o.columnSize[j] + "px";
} }
wi.element.css({"right": r, width: w}); wi.element.css({right: r, width: w});
first(wi, i, j); first(wi, i, j);
} }
if (!BI.isNumber(o.columnSize[j])) { if (!BI.isNumber(o.columnSize[j])) {
@ -185,4 +185,4 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.window', BI.WindowLayout); BI.shortcut("bi.window", BI.WindowLayout);

4
src/core/wrapper/layout/middle/middle.center.js

@ -44,7 +44,7 @@ BI.CenterLayout = BI.inherit(BI.Layout, {
}); });
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (!!item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
@ -72,4 +72,4 @@ BI.CenterLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.center', BI.CenterLayout); BI.shortcut("bi.center", BI.CenterLayout);

6
src/core/wrapper/layout/middle/middle.float.center.js

@ -26,7 +26,7 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
addItem: function (item) { addItem: function (item) {
// do nothing // do nothing
throw new Error("cannot be added") throw new Error("cannot be added");
}, },
stroke: function (items) { stroke: function (items) {
@ -45,7 +45,7 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
}); });
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (!!item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
@ -71,4 +71,4 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.float_center', BI.FloatCenterLayout); BI.shortcut("bi.float_center", BI.FloatCenterLayout);

6
src/core/wrapper/layout/middle/middle.horizontal.js

@ -26,7 +26,7 @@ BI.HorizontalCenterLayout = BI.inherit(BI.Layout, {
addItem: function (item) { addItem: function (item) {
// do nothing // do nothing
throw new Error("cannot be added") throw new Error("cannot be added");
}, },
stroke: function (items) { stroke: function (items) {
@ -43,7 +43,7 @@ BI.HorizontalCenterLayout = BI.inherit(BI.Layout, {
}); });
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (!!item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
@ -70,4 +70,4 @@ BI.HorizontalCenterLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.horizontal_center', BI.HorizontalCenterLayout); BI.shortcut("bi.horizontal_center", BI.HorizontalCenterLayout);

6
src/core/wrapper/layout/middle/middle.vertical.js

@ -26,7 +26,7 @@ BI.VerticalCenterLayout = BI.inherit(BI.Layout, {
addItem: function (item) { addItem: function (item) {
// do nothing // do nothing
throw new Error("cannot be added") throw new Error("cannot be added");
}, },
stroke: function (items) { stroke: function (items) {
@ -43,7 +43,7 @@ BI.VerticalCenterLayout = BI.inherit(BI.Layout, {
}); });
}); });
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (!!item) { if (item) {
var w = BI.createWidget(item); var w = BI.createWidget(item);
w.element.css({ w.element.css({
position: "absolute", position: "absolute",
@ -70,4 +70,4 @@ BI.VerticalCenterLayout = BI.inherit(BI.Layout, {
this._mount(); this._mount();
} }
}); });
BI.shortcut('bi.vertical_center', BI.VerticalCenterLayout); BI.shortcut("bi.vertical_center", BI.VerticalCenterLayout);
Loading…
Cancel
Save