windy 8 years ago
parent
commit
d106c83108
  1. 2005
      dist/base.css
  2. 274
      dist/core.js
  3. 8
      src/core/base.js
  4. 14
      src/css/base/pager/pager.all.css
  5. 11
      src/css/base/pager/pager.number.css
  6. 11
      src/css/base/pager/pager.skip.css
  7. 1481
      src/css/base/third/jquery.mCustomScrollbar.css

2005
dist/base.css vendored

File diff suppressed because it is too large Load Diff

274
dist/core.js vendored

@ -12906,7 +12906,7 @@ if (!window.BI) {
//Utility //Utility
_.extend(BI, { _.extend(BI, {
i18nText: function (key) { i18nText: function (key) {
var localeText = key; var localeText = "";
if (!localeText) { if (!localeText) {
localeText = key; localeText = key;
} }
@ -12923,7 +12923,7 @@ if (!window.BI) {
assert: function (v, is) { assert: function (v, is) {
if (this.isFunction(is)) { if (this.isFunction(is)) {
if (!is(v)) { if (!is(v)) {
throw new Error(v + "值不合法"); throw new Error(v + " error");
} else { } else {
return true; return true;
} }
@ -12932,7 +12932,7 @@ if (!window.BI) {
is = [is]; is = [is];
} }
if (!this.deepContains(is, v)) { if (!this.deepContains(is, v)) {
throw new Error(v + "值不合法"); throw new Error(v + " error");
} }
}, },
@ -12954,9 +12954,33 @@ if (!window.BI) {
return widget instanceof BI.Widget || (BI.View && widget instanceof BI.View); return widget instanceof BI.Widget || (BI.View && widget instanceof BI.View);
}, },
createWidget: function (item, options) {
var el;
options || (options = {});
if (BI.isEmpty(item) && BI.isEmpty(options)) {
return BI.Plugin.getObject("bi.layout", BI.createWidget({
type: "bi.layout"
}));
}
if (BI.isWidget(item)) {
return item;
}
if (item && (item.type || options.type)) {
el = BI.extend({}, options, item);
return BI.Plugin.getObject(el.type, FR.createWidget(BI.Plugin.getWidget(el.type, el), true));
}
if (item && item.el && (item.el.type || options.type)) {
el = BI.extend({}, options, item.el);
return BI.Plugin.getObject(el.type, FR.createWidget(BI.Plugin.getWidget(el.type, el), true));
}
if (item && BI.isWidget(item.el)) {
return item.el;
}
},
createWidgets: function (items, options) { createWidgets: function (items, options) {
if (!BI.isArray(items)) { if (!BI.isArray(items)) {
throw new Error("无法根据items创建组件?") 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));
@ -13127,7 +13151,9 @@ if (!window.BI) {
backAny: function (obj, predicate, context) { backAny: function (obj, predicate, context) {
predicate = BI.iteratee(predicate, context); predicate = BI.iteratee(predicate, context);
for (var index = obj.length - 1; index >= 0; index--) { for (var index = obj.length - 1; index >= 0; index--) {
if (predicate(index, obj[index], obj)) return true; if (predicate(index, obj[index], obj)) {
return true;
}
} }
return false; return false;
}, },
@ -13135,7 +13161,9 @@ if (!window.BI) {
backEvery: function (obj, predicate, context) { backEvery: function (obj, predicate, context) {
predicate = BI.iteratee(predicate, context); predicate = BI.iteratee(predicate, context);
for (var index = obj.length - 1; index >= 0; index--) { for (var index = obj.length - 1; index >= 0; index--) {
if (!predicate(index, obj[index], obj)) return false; if (!predicate(index, obj[index], obj)) {
return false;
}
} }
return true; return true;
}, },
@ -13261,7 +13289,9 @@ if (!window.BI) {
}, },
uniq: function (array, isSorted, iteratee, context) { uniq: function (array, isSorted, iteratee, context) {
if (array == null) return []; if (array == null) {
return [];
}
if (!_.isBoolean(isSorted)) { if (!_.isBoolean(isSorted)) {
context = iteratee; context = iteratee;
iteratee = isSorted; iteratee = isSorted;
@ -13423,11 +13453,15 @@ if (!window.BI) {
isDeepMatch: function (object, attrs) { isDeepMatch: function (object, attrs) {
var keys = BI.keys(attrs), length = keys.length; var keys = BI.keys(attrs), length = keys.length;
if (object == null) return !length; if (object == null) {
return !length;
}
var obj = Object(object); var obj = Object(object);
for (var i = 0; i < length; i++) { for (var i = 0; i < length; i++) {
var key = keys[i]; var key = keys[i];
if (!BI.isEqual(attrs[key], obj[key]) || !(key in obj)) return false; if (!BI.isEqual(attrs[key], obj[key]) || !(key in obj)) {
return false;
}
} }
return true; return true;
}, },
@ -13453,20 +13487,24 @@ if (!window.BI) {
}, },
deepRemove: function (obj, target) { deepRemove: function (obj, target) {
var done = false;
var i; var i;
if (BI.isArray(obj)) { if (BI.isArray(obj)) {
for (i = 0; i < obj.length; i++) { for (i = 0; i < obj.length; i++) {
if (BI.isEqual(target, obj[i])) { if (BI.isEqual(target, obj[i])) {
obj.splice(i--, 1); obj.splice(i--, 1);
done = true;
} }
} }
} else { } else {
BI.each(obj, function (i, v) { BI.each(obj, function (i, v) {
if (BI.isEqual(target, obj[i])) { if (BI.isEqual(target, obj[i])) {
delete obj[i]; delete obj[i];
done = true;
} }
}); });
} }
return done;
}, },
deepWithout: function (obj, target) { deepWithout: function (obj, target) {
@ -13489,8 +13527,14 @@ if (!window.BI) {
} }
}, },
deepUniq: function () { deepUnique: function (array) {
var result = [];
BI.each(array, function (i, item) {
if (!BI.deepContains(result, item)) {
result.push(item);
}
});
return result;
}, },
//比较两个对象得出不一样的key值 //比较两个对象得出不一样的key值
@ -13541,31 +13585,54 @@ if (!window.BI) {
var copies = callbacks.slice(0); var copies = callbacks.slice(0);
callbacks = []; callbacks = [];
for (var i = 0; i < copies.length; i++) { for (var i = 0; i < copies.length; i++) {
copies[i].func.apply(null, copies[i].args); copies[i]();
}
} }
if (typeof Promise !== 'undefined') {
var p = Promise.resolve();
timerFunc = function () {
p.then(nextTickHandler);
} }
} 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 + "");
observer.observe(textNode, { observer.observe(textNode, {
characterData: true characterData: true
}); });
timerFunc = function () { timerFunc = function () {
counter = (counter + 1) % 2; counter = (counter + 1) % 2;
textNode.data = counter; textNode.data = counter + "";
} }
} else { } else {
timerFunc = setTimeout timerFunc = function () {
setTimeout(nextTickHandler, 0)
}
} }
return function (cb) { return function queueNextTick(cb) {
var _resolve;
var args = [].slice.call(arguments, 1); var args = [].slice.call(arguments, 1);
callbacks.push({func: cb, args: args}); callbacks.push(function () {
if (pending) return; if (cb) {
cb.apply(null, args);
}
if (_resolve) {
_resolve.apply(null, args);
}
});
if (!pending) {
pending = true; pending = true;
timerFunc(nextTickHandler, 0); timerFunc();
}
if (!cb && typeof Promise !== 'undefined') {
return new Promise(function (resolve) {
_resolve = resolve
})
}
} }
})() })()
}); });
@ -13599,7 +13666,7 @@ if (!window.BI) {
try { try {
return parseInt(number, radix); return parseInt(number, radix);
} catch (e) { } catch (e) {
throw new Error("转成int类型失败"); throw new Error(number + "parse int error");
return NaN; return NaN;
} }
}, },
@ -13608,7 +13675,7 @@ if (!window.BI) {
try { try {
return parseFloat(number); return parseFloat(number);
} catch (e) { } catch (e) {
throw new Error("转成float类型失败"); throw new Error(number + "parse float error");
return NaN; return NaN;
} }
}, },
@ -13670,9 +13737,9 @@ if (!window.BI) {
var sum = 0; var sum = 0;
BI.each(array, function (i, item) { BI.each(array, function (i, item) {
if (iteratee) { if (iteratee) {
sum += new Number(iteratee.apply(context, [i, item])); sum += Number(iteratee.apply(context, [i, item]));
} else { } else {
sum += new Number(item); sum += Number(item);
} }
}); });
return sum; return sum;
@ -13735,6 +13802,10 @@ if (!window.BI) {
return BI.isString(str) && BI.isEmpty(str); return BI.isString(str) && BI.isEmpty(str);
}, },
contentFormat: function () {
return FR.contentFormat.apply(FR, arguments);
},
/** /**
* 对字符串进行加密 {@link #decrypt} * 对字符串进行加密 {@link #decrypt}
* @static * @static
@ -13848,23 +13919,23 @@ if (!window.BI) {
//浏览器相关方法 //浏览器相关方法
_.extend(BI, { _.extend(BI, {
isIE: function () { isIE: function () {
return $.browser.msie; return /(msie|trident)/i.test(navigator.userAgent.toLowerCase());
}, },
isChrome: function () { isChrome: function () {
return $.browser.chrome; return /chrome/i.test(navigator.userAgent.toLowerCase());
}, },
isFireFox: function () { isFireFox: function () {
return $.browser.mozilla; return /firefox/i.test(navigator.userAgent.toLowerCase());
}, },
isOpera: function () { isOpera: function () {
return $.browser.opera; return /opera/i.test(navigator.userAgent.toLowerCase());
}, },
isSafari: function () { isSafari: function () {
return $.browser.safari; return /safari/i.test(navigator.userAgent.toLowerCase());
}, },
isKhtml: function () { isKhtml: function () {
@ -13898,6 +13969,124 @@ if (!window.BI) {
//BI请求 //BI请求
_.extend(BI, { _.extend(BI, {
ajax: (function () {
var loading, timeoutToast;
return function (option) {
option || (option = {});
option.data = BI.extend({}, Data.SharingPool.cat("urlParameters"), option.data);
//encode
encodeBIParam(option.data);
var async = true;
if (BI.isNotNull(option.async)) {
async = option.async;
}
if (BI.isNull(loading)) {
loading = BI.createWidget({
type: "bi.request_loading"
});
}
if (BI.isNull(timeoutToast)) {
timeoutToast = BI.createWidget({
type: "bi.timeout_toast"
});
timeoutToast.setCallback(function (op) {
decodeBIParam(op.data);
BI.ajax(op);
});
}
timeoutToast.addReq(option);
FR.ajax({
url: option.url,
type: "POST",
data: option.data,
async: async,
error: function () {
if (!timeoutToast.hasReq(option)) {
return;
}
timeoutToast.removeReq(option);
//失败 取消、重新加载
loading.setCallback(function () {
decodeBIParam(option.data);
BI.ajax(option);
});
loading.showError();
},
complete: function (res, status) {
if (!timeoutToast.hasReq(option)) {
return;
}
timeoutToast.removeReq(option);
//登录超时
if (BI.isNotNull(res.responseText) &&
res.responseText.indexOf("fs-login-content") > -1 &&
res.responseText.indexOf("fs-login-input-password-confirm") === -1) {
if (BI.Popovers.isVisible(BI.LoginTimeOut.POPOVER_ID)) {
return;
}
if (BI.isNotNull(BI.Popovers.get(BI.LoginTimeOut.POPOVER_ID))) {
BI.Popovers.open(BI.LoginTimeOut.POPOVER_ID);
return;
}
var loginTimeout = BI.createWidget({
type: "bi.login_timeout"
});
loginTimeout.on(BI.LoginTimeOut.EVENT_LOGIN, function () {
decodeBIParam(option.data);
BI.ajax(option);
BI.Popovers.remove(BI.LoginTimeOut.POPOVER_ID);
});
BI.Popovers.create(BI.LoginTimeOut.POPOVER_ID, loginTimeout, {
width: 600,
height: 400
}).open(BI.LoginTimeOut.POPOVER_ID);
} else if (BI.isNotNull(res.responseText) &&
res.responseText.indexOf("script") > -1 &&
res.responseText.indexOf("Session Timeout...") > -1) {
//登录失效
loading.setCallback(function () {
location.reload();
});
loading.showError();
} else if (status === "success" && BI.isFunction(option.success)) {
option.success(FR.jsonDecode(res.responseText));
}
if (BI.isFunction(option.complete)) {
option.complete(FR.jsonDecode(res.responseText), status);
}
}
});
return function cancel() {
timeoutToast.removeReq(option);
};
function encodeBIParam(data) {
for (var key in data) {
if (_.isObject(data[key])) {
data[key] = window.encodeURIComponent(FR.jsonEncode(data[key]));
} else {
data[key] = window.encodeURIComponent(data[key]);
}
}
}
function decodeBIParam(data) {
for (var key in data) {
data[key] = window.decodeURIComponent(data[key]);
if (_.isObject(data[key])) {
data[key] = FR.jsonDecode(data[key]);
}
}
}
}
})(),
/** /**
* 异步ajax请求 * 异步ajax请求
* @param {String} op op参数 * @param {String} op op参数
@ -13907,38 +14096,29 @@ if (!window.BI) {
* @param {Function} complete 回调 * @param {Function} complete 回调
*/ */
requestAsync: function (op, cmd, data, callback, complete) { requestAsync: function (op, cmd, data, callback, complete) {
// if (BI.isNull(BI.REQUEST_LOADING)) {
// BI.REQUEST_LOADING = BI.createWidget({
// type: "bi.request_loading"
// });
// }
data = data || {}; data = data || {};
if (!BI.isKey(op)) { if (!BI.isKey(op)) {
op = 'fr_bi_dezi'; op = 'fr_bi_dezi';
} }
if (op === "fr_bi_dezi") { if (op === "fr_bi_dezi" || op === "fr_bi_configure") {
data.sessionID = Data.SharingPool.get("sessionID"); data.sessionID = Data.SharingPool.get("sessionID");
} }
var url = FR.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random(); var url = FR.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random();
(BI.ajax || FR.ajax)({ return (BI.ajax)({
url: url, url: url,
type: 'POST', type: 'POST',
data: data, data: data,
error: function () { error: function () {
// BI.Msg.toast(BI.i18nText("BI-Ajax_Error")); // BI.Msg.toast(BI.i18nText("BI-Ajax_Error"));
//失败 取消、重新加载
// BI.REQUEST_LOADING.setCallback(function () {
// BI.requestAsync(op, cmd, data, callback, complete);
// });
// BI.REQUEST_LOADING.showError();
}, },
complete: function (res, status) { success: function (res) {
if (BI.isFunction(callback) && status === 'success') { if (BI.isFunction(callback)) {
callback(BI.jsonDecode(res.responseText)); callback(res);
BI.Maskers.hide(BI.RequstLoading.MASK_ID);
} }
},
complete: function (res, status) {
if (BI.isFunction(complete)) { if (BI.isFunction(complete)) {
complete(); complete(res);
} }
} }
}); });
@ -13961,7 +14141,7 @@ if (!window.BI) {
} }
var url = FR.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random(); var url = FR.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random();
var result = {}; var result = {};
(BI.ajax || FR.ajax)({ (BI.ajax)({
url: url, url: url,
type: 'POST', type: 'POST',
async: false, async: false,
@ -13971,7 +14151,7 @@ if (!window.BI) {
}, },
complete: function (res, status) { complete: function (res, status) {
if (status === 'success') { if (status === 'success') {
result = BI.jsonDecode(res.responseText); result = res;
} }
} }
}); });

8
src/core/base.js

@ -33,7 +33,7 @@ if (!window.BI) {
//Utility //Utility
_.extend(BI, { _.extend(BI, {
i18nText: function (key) { i18nText: function (key) {
var localeText = FR.i18n[key]; var localeText = "";
if (!localeText) { if (!localeText) {
localeText = key; localeText = key;
} }
@ -485,7 +485,11 @@ if (!window.BI) {
}, },
isWidthOrHeight: function (w) { isWidthOrHeight: function (w) {
return FR.isWidthOrHeight(w); if (typeof w == 'number') {
return w >= 0;
} else if (typeof w == 'string') {
return /^\d{1,3}%$/.exec(w) || w == 'auto' || /^\d+px$/.exec(w);
}
}, },
isNotNull: function (obj) { isNotNull: function (obj) {

14
src/css/base/pager/pager.all.css

@ -1,14 +0,0 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-all-pager .pager-editor {
background-color: #ffffff;
}
.bi-all-pager .all-pager-prev {
font-size: 16px;
background: #f4f4f4;
}
.bi-all-pager .all-pager-next {
font-size: 16px;
background: #f4f4f4;
}

11
src/css/base/pager/pager.number.css

@ -1,11 +0,0 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-number-pager .number-pager-prev {
font-size: 16px;
background: #f4f4f4;
}
.bi-number-pager .number-pager-next {
font-size: 16px;
background: #f4f4f4;
}

11
src/css/base/pager/pager.skip.css

@ -1,11 +0,0 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
.bi-skip-pager .skip-pager-prev {
font-size: 16px;
background: #f4f4f4;
}
.bi-skip-pager .skip-pager-next {
font-size: 16px;
background: #f4f4f4;
}

1481
src/css/base/third/jquery.mCustomScrollbar.css

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save