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
_.extend(BI, {
i18nText: function (key) {
var localeText = key;
var localeText = "";
if (!localeText) {
localeText = key;
}
@ -12923,7 +12923,7 @@ if (!window.BI) {
assert: function (v, is) {
if (this.isFunction(is)) {
if (!is(v)) {
throw new Error(v + "值不合法");
throw new Error(v + " error");
} else {
return true;
}
@ -12932,7 +12932,7 @@ if (!window.BI) {
is = [is];
}
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);
},
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) {
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.createWidget(item, BI.deepClone(options));
@ -13127,7 +13151,9 @@ if (!window.BI) {
backAny: function (obj, predicate, context) {
predicate = BI.iteratee(predicate, context);
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;
},
@ -13135,7 +13161,9 @@ if (!window.BI) {
backEvery: function (obj, predicate, context) {
predicate = BI.iteratee(predicate, context);
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;
},
@ -13261,7 +13289,9 @@ if (!window.BI) {
},
uniq: function (array, isSorted, iteratee, context) {
if (array == null) return [];
if (array == null) {
return [];
}
if (!_.isBoolean(isSorted)) {
context = iteratee;
iteratee = isSorted;
@ -13423,11 +13453,15 @@ if (!window.BI) {
isDeepMatch: function (object, attrs) {
var keys = BI.keys(attrs), length = keys.length;
if (object == null) return !length;
if (object == null) {
return !length;
}
var obj = Object(object);
for (var i = 0; i < length; 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;
},
@ -13453,20 +13487,24 @@ if (!window.BI) {
},
deepRemove: function (obj, target) {
var done = false;
var i;
if (BI.isArray(obj)) {
for (i = 0; i < obj.length; i++) {
if (BI.isEqual(target, obj[i])) {
obj.splice(i--, 1);
done = true;
}
}
} else {
BI.each(obj, function (i, v) {
if (BI.isEqual(target, obj[i])) {
delete obj[i];
done = true;
}
});
}
return done;
},
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值
@ -13541,31 +13585,54 @@ if (!window.BI) {
var copies = callbacks.slice(0);
callbacks = [];
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 */
if (typeof MutationObserver !== 'undefined') {
var counter = 1;
var observer = new MutationObserver(nextTickHandler);
var textNode = document.createTextNode(counter);
var textNode = document.createTextNode(counter + "");
observer.observe(textNode, {
characterData: true
});
timerFunc = function () {
counter = (counter + 1) % 2;
textNode.data = counter;
textNode.data = counter + "";
}
} else {
timerFunc = setTimeout
timerFunc = function () {
setTimeout(nextTickHandler, 0)
}
}
return function (cb) {
return function queueNextTick(cb) {
var _resolve;
var args = [].slice.call(arguments, 1);
callbacks.push({func: cb, args: args});
if (pending) return;
callbacks.push(function () {
if (cb) {
cb.apply(null, args);
}
if (_resolve) {
_resolve.apply(null, args);
}
});
if (!pending) {
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 {
return parseInt(number, radix);
} catch (e) {
throw new Error("转成int类型失败");
throw new Error(number + "parse int error");
return NaN;
}
},
@ -13608,7 +13675,7 @@ if (!window.BI) {
try {
return parseFloat(number);
} catch (e) {
throw new Error("转成float类型失败");
throw new Error(number + "parse float error");
return NaN;
}
},
@ -13670,9 +13737,9 @@ if (!window.BI) {
var sum = 0;
BI.each(array, function (i, item) {
if (iteratee) {
sum += new Number(iteratee.apply(context, [i, item]));
sum += Number(iteratee.apply(context, [i, item]));
} else {
sum += new Number(item);
sum += Number(item);
}
});
return sum;
@ -13735,6 +13802,10 @@ if (!window.BI) {
return BI.isString(str) && BI.isEmpty(str);
},
contentFormat: function () {
return FR.contentFormat.apply(FR, arguments);
},
/**
* 对字符串进行加密 {@link #decrypt}
* @static
@ -13848,23 +13919,23 @@ if (!window.BI) {
//浏览器相关方法
_.extend(BI, {
isIE: function () {
return $.browser.msie;
return /(msie|trident)/i.test(navigator.userAgent.toLowerCase());
},
isChrome: function () {
return $.browser.chrome;
return /chrome/i.test(navigator.userAgent.toLowerCase());
},
isFireFox: function () {
return $.browser.mozilla;
return /firefox/i.test(navigator.userAgent.toLowerCase());
},
isOpera: function () {
return $.browser.opera;
return /opera/i.test(navigator.userAgent.toLowerCase());
},
isSafari: function () {
return $.browser.safari;
return /safari/i.test(navigator.userAgent.toLowerCase());
},
isKhtml: function () {
@ -13898,6 +13969,124 @@ if (!window.BI) {
//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请求
* @param {String} op op参数
@ -13907,38 +14096,29 @@ if (!window.BI) {
* @param {Function} 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 || {};
if (!BI.isKey(op)) {
op = 'fr_bi_dezi';
}
if (op === "fr_bi_dezi") {
if (op === "fr_bi_dezi" || op === "fr_bi_configure") {
data.sessionID = Data.SharingPool.get("sessionID");
}
var url = FR.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random();
(BI.ajax || FR.ajax)({
return (BI.ajax)({
url: url,
type: 'POST',
data: data,
error: function () {
// 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) {
if (BI.isFunction(callback) && status === 'success') {
callback(BI.jsonDecode(res.responseText));
BI.Maskers.hide(BI.RequstLoading.MASK_ID);
success: function (res) {
if (BI.isFunction(callback)) {
callback(res);
}
},
complete: function (res, status) {
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 result = {};
(BI.ajax || FR.ajax)({
(BI.ajax)({
url: url,
type: 'POST',
async: false,
@ -13971,7 +14151,7 @@ if (!window.BI) {
},
complete: function (res, status) {
if (status === 'success') {
result = BI.jsonDecode(res.responseText);
result = res;
}
}
});

8
src/core/base.js

@ -33,7 +33,7 @@ if (!window.BI) {
//Utility
_.extend(BI, {
i18nText: function (key) {
var localeText = FR.i18n[key];
var localeText = "";
if (!localeText) {
localeText = key;
}
@ -485,7 +485,11 @@ if (!window.BI) {
},
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) {

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