fineui是帆软报表和BI产品线所使用的前端框架。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5892 lines
527 KiB

/*! time: 2021-9-8 11:50:18 */
4 years ago
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1264);
4 years ago
/******/ })
/************************************************************************/
/******/ ({
/***/ 1121:
/***/ (function(module, exports) {
BI.i18n = {
"BI-Multi_Date_Quarter_End": "季度末",
"BI-Multi_Date_Month_Begin": "月初",
"BI-Multi_Date_YMD": "年月日",
"BI-Custom_Color": "自定义颜色",
"BI-Numerical_Interval_Input_Data": "请输入数值",
"BI-Please_Input_Natural_Number": "请输入非负整数",
"BI-No_More_Data": "无更多数据",
"BI-Basic_Altogether": "共",
"BI-Basic_Sunday": "星期日",
"BI-Widget_Background_Colour": "组件背景",
"BI-Color_Picker_Error_Text": "请输入0-255的正整数",
"BI-Multi_Date_Month": "月",
"BI-No_Selected_Item": "没有可选项",
"BI-Multi_Date_Year_Begin": "年初",
"BI-Quarter_1": "第1季度",
"BI-Quarter_2": "第2季度",
"BI-Quarter_3": "第3季度",
"BI-Quarter_4": "第4季度",
"BI-Multi_Date_Year_Next": "年后",
"BI-Multi_Date_Month_Prev": "个月前",
"BI-Month_Trigger_Error_Text": "请输入1~12的正整数",
"BI-Less_And_Equal": "小于等于",
"BI-Year_Trigger_Invalid_Text": "请输入有效时间",
"BI-Multi_Date_Week_Next": "周后",
"BI-Font_Size": "字号",
"BI-Basic_Total": "共",
"BI-Already_Selected": "已选择",
"BI-Formula_Insert": "插入",
"BI-Select_All": "全选",
"BI-Basic_Tuesday": "星期二",
"BI-Multi_Date_Month_End": "月末",
"BI-Load_More": "点击加载更多数据",
"BI-Basic_September": "九月",
"BI-Current_Is_Last_Page": "当前已是最后一页",
"BI-Basic_Auto": "自动",
"BI-Basic_Count": "个",
"BI-Basic_Value": "值",
"BI-Basic_Unrestricted": "无限制",
"BI-Quarter_Trigger_Error_Text": "请输入1~4的正整数",
"BI-Basic_More": "更多",
"BI-Basic_Wednesday": "星期三",
"BI-Basic_Bold": "加粗",
"BI-Basic_Simple_Saturday": "六",
"BI-Multi_Date_Month_Next": "个月后",
"BI-Basic_March": "三月",
"BI-Current_Is_First_Page": "当前已是第一页",
"BI-Basic_Thursday": "星期四",
"BI-Basic_Prompt": "提示",
"BI-Multi_Date_Today": "今天",
"BI-Multi_Date_Quarter_Prev": "个季度前",
"BI-Row_Header": "行表头",
"BI-Date_Trigger_Error_Text": "日期格式示例:2015-3-11",
"BI-Basic_Cancel": "取消",
"BI-Basic_January": "一月",
"BI-Basic_June": "六月",
"BI-Basic_July": "七月",
"BI-Basic_April": "四月",
"BI-Multi_Date_Quarter_Begin": "季度初",
"BI-Multi_Date_Week": "周",
"BI-Click_Blank_To_Select": "点击\"空格键\"选中完全匹配项",
"BI-Basic_August": "八月",
"BI-Word_Align_Left": "文字居左",
"BI-Basic_November": "十一月",
"BI-Font_Colour": "字体颜色",
"BI-Multi_Date_Day_Prev": "天前",
"BI-Select_Part": "部分选择",
"BI-Multi_Date_Day_Next": "天后",
"BI-Less_Than": "小于",
"BI-Basic_February": "二月",
"BI-Multi_Date_Year": "年",
"BI-Number_Index": "序号",
"BI-Multi_Date_Week_Prev": "周前",
"BI-Next_Page": "下一页",
"BI-Right_Page": "向右翻页",
"BI-Numerical_Interval_Signal_Value": "前后值相等,请将操作符改为“≤”",
"BI-Basic_December": "十二月",
"BI-Basic_Saturday": "星期六",
"BI-Basic_Simple_Wednesday": "三",
"BI-Multi_Date_Quarter_Next": "个季度后",
"BI-Basic_October": "十月",
"BI-Basic_Simple_Friday": "五",
"BI-Basic_Save": "保存",
"BI-Numerical_Interval_Number_Value": "请保证前面的数值小于/等于后面的数值",
"BI-Previous_Page": "上一页",
"BI-No_Select": "搜索结果为空",
"BI-Basic_Clears": "清空",
"BI-Created_By_Me": "我创建的",
"BI-Basic_Simple_Tuesday": "二",
"BI-Word_Align_Right": "文字居右",
"BI-Summary_Values": "汇总",
"BI-Basic_Clear": "清除",
"BI-Upload_File_Size_Error": "文件大小不支持",
"BI-Upload_File_Count_Error": "超出上传数量上限{R1},请重新上传",
"BI-Up_Page": "向上翻页",
"BI-Basic_Simple_Sunday": "日",
"BI-Multi_Date_Relative_Current_Time": "相对当前时间",
"BI-Selected_Data": "已选数据:",
"BI-Multi_Date_Quarter": "季度",
"BI-Check_Selected": "查看已选",
"BI-Basic_Search": "搜索",
"BI-Basic_May": "五月",
"BI-Continue_Select": "继续选择",
"BI-Please_Input_Positive_Integer": "请输入正整数",
"BI-Upload_File_Type_Error": "文件类型不支持",
"BI-Upload_File_Error": "文件上传失败",
"BI-Basic_Friday": "星期五",
"BI-Down_Page": "向下翻页",
"BI-Basic_Monday": "星期一",
"BI-Left_Page": "向左翻页",
"BI-Transparent_Color": "透明",
"BI-Basic_Simple_Monday": "一",
"BI-Multi_Date_Year_End": "年末",
"BI-Time_Interval_Error_Text": "请保证开始时间早于/等于结束时间",
"BI-Basic_Time": "时间",
"BI-Basic_OK": "确定",
"BI-Basic_Sure": "确定",
"BI-Basic_Simple_Thursday": "四",
"BI-Multi_Date_Year_Prev": "年前",
"BI-Tiao_Data": "条数据",
"BI-Basic_Italic": "斜体",
"BI-Basic_Dynamic_Title": "动态时间",
"BI-Basic_Year": "年",
"BI-Basic_Single_Quarter": "季",
"BI-Basic_Month": "月",
"BI-Basic_Week": "周",
"BI-Basic_Day": "天",
"BI-Basic_Work_Day": "工作日",
"BI-Basic_Front": "前",
"BI-Basic_Behind": "后",
"BI-Basic_Empty": "空",
"BI-Basic_Month_End": "月末",
"BI-Basic_Month_Begin": "月初",
"BI-Basic_Year_End": "年末",
"BI-Basic_Year_Begin": "年初",
"BI-Basic_Quarter_End": "季末",
"BI-Basic_Quarter_Begin": "季初",
"BI-Basic_Week_End": "周末",
"BI-Basic_Week_Begin": "周初",
"BI-Basic_Current_Day": "当天",
"BI-Basic_Begin_Start": "初",
"BI-Basic_End_Stop": "末",
"BI-Basic_Current_Year": "今年",
"BI-Basic_Year_Fen": "年份",
"BI-Basic_Current_Month": "本月",
"BI-Basic_Current_Quarter": "本季度",
"BI-Basic_Year_Month": "年月",
"BI-Basic_Year_Quarter": "年季度",
"BI-Basic_Input_Can_Not_Null": "输入框不能为空",
"BI-Basic_Date_Time_Error_Text": "日期格式示例:2015-3-11 00:00:00",
"BI-Basic_Input_From_To_Number": "请输入{R1}的数值",
"BI-Basic_Or": "或",
"BI-Basic_And": "且",
"BI-Conf_Add_Formula": "添加公式",
"BI-Conf_Add_Condition": "添加条件",
"BI-Conf_Formula_And": "且公式条件",
"BI-Conf_Formula_Or": "或公式条件",
"BI-Conf_Condition_And": "且条件",
"BI-Conf_Condition_Or": "或条件",
"BI-Microsoft_YaHei": "微软雅黑",
"BI-Apple_Light": "苹方-light",
"BI-Font_Family": "字体",
"BI-Basic_Please_Input_Content": "请输入内容",
"BI-Word_Align_Center": "文字居中",
"BI-Basic_Please_Enter_Number_Between": "请输入{R1}-{R2}的值",
"BI-More_Than": "大于",
"BI-More_And_Equal": "大于等于",
"BI-Please_Enter_SQL": "请输入SQL",
"BI-Basic_Click_To_Add_Text": "点按回车键添加\"{R1}\"",
"BI-Basic_Please_Select": "请选择",
"BI-Basic_Font_Color": "文字颜色",
"BI-Basic_Background_Color": "背景色",
"BI-Basic_Underline": "下划线",
"BI-Basic_Param_Month": "{R1}月",
"BI-Basic_Param_Day": "{R1}日",
"BI-Basic_Param_Quarter": "{R1}季度",
"BI-Basic_Param_Week_Count": "第{R1}周",
"BI-Basic_Param_Hour": "{R1}时",
"BI-Basic_Param_Minute": "{R1}分",
"BI-Basic_Param_Second": "{R1}秒",
"BI-Basic_Param_Year": "{R1}年",
"BI-Basic_Date_Day": "日",
"BI-Basic_Hour_Sin": "时",
"BI-Basic_Seconds": "秒",
"BI-Basic_Minute": "分",
"BI-Basic_Thousand": "千",
"BI-Basic_Wan": "万",
"BI-Basic_Million": "百万",
"BI-Basic_Billion": "亿",
"BI-Basic_Quarter": "季度",
"BI-Basic_No_Select": "不选",
"BI-Basic_Now": "此刻",
"BI-Color_Picker_Error_Text_Hex": "请输入6位16进制颜色编号",
"BI-Basic_Date_Range_Error": "请选择{R1}年{R2}月{R3}日-{R4}年{R5}月{R6}日的日期",
"BI-Basic_Year_Range_Error": "请选择{R1}年-{R2}年的日期",
"BI-Basic_Year_Month_Range_Error": "请选择{R1}年{R2}月-{R3}年{R4}月的日期",
"BI-Basic_Year_Quarter_Range_Error": "请选择{R1}年{R2}季度-{R3}年{R4}季度的日期",
"BI-Basic_Search_And_Patch_Paste": "搜索,支持批量粘贴、粘贴值通过换行识别",
"BI-Basic_Recommend_Color": "推荐色"
};
/***/ }),
/***/ 1264:
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(136);
__webpack_require__(155);
__webpack_require__(162);
__webpack_require__(163);
__webpack_require__(164);
__webpack_require__(165);
__webpack_require__(166);
__webpack_require__(167);
__webpack_require__(168);
__webpack_require__(169);
__webpack_require__(170);
__webpack_require__(158);
__webpack_require__(160);
__webpack_require__(161);
__webpack_require__(171);
__webpack_require__(172);
__webpack_require__(1121);
__webpack_require__(1265);
__webpack_require__(173);
__webpack_require__(174);
module.exports = __webpack_require__(175);
4 years ago
/***/ }),
/***/ 1265:
/***/ (function(module, exports) {
/**
* Created by astronaut007 on 2018/8/8
*/
// 牵扯到国际化这些常量在页面加载后再生效
// full day names
BI.Date = BI.Date || {};
BI.Date._DN = ["星期日",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六",
"星期日"];
// short day names
BI.Date._SDN = ["日",
"一",
"二",
"三",
"四",
"五",
"六",
"日"];
// Monday first, etc.
BI.Date._FD = 1;
// full month namesdat
BI.Date._MN = [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月"];
// short month names
BI.Date._SMN = [0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11];
BI.Date._QN = ["", "第1季度",
"第2季度",
"第3季度",
"第4季度"];
/** Adds the number of days array to the Date object. */
BI.Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// 实际上无论周几作为一周的第一天,周初周末都是在-6-0间做偏移,用一个数组就可以
BI.Date._OFFSET = [0, -1, -2, -3, -4, -5, -6];
/***/ }),
/***/ 136:
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {/**
* Created by richie on 15/7/8.
*/
/**
* 初始化BI对象
*/
_global = undefined;
if (typeof window !== "undefined") {
_global = window;
} else if (typeof global !== "undefined") {
_global = global;
} else if (typeof self !== "undefined") {
_global = self;
} else {
_global = this;
}
if (_global.BI == null) {
_global.BI = {prepares: []};
}
if(_global.BI.prepares == null) {
_global.BI.prepares = [];
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(15)))
/***/ }),
/***/ 15:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var g; // This works in non-strict mode
g = function () {
return this;
}();
try {
// This works if eval is allowed (see CSP)
g = g || new Function("return this")();
} catch (e) {
// This works if the window reference is available
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window;
} // g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;
/***/ }),
/***/ 155:
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(156)(__webpack_require__(157))
/***/ }),
/***/ 156:
/***/ (function(module, exports) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
module.exports = function(src) {
function log(error) {
(typeof console !== "undefined")
&& (console.error || console.log)("[Script Loader]", error);
}
// Check for IE =< 8
function isIE() {
return typeof attachEvent !== "undefined" && typeof addEventListener === "undefined";
}
try {
if (typeof execScript !== "undefined" && isIE()) {
execScript(src);
} else if (typeof eval !== "undefined") {
eval.call(null, src);
} else {
log("EvalError: No eval function available");
}
} catch (error) {
log(error);
}
}
/***/ }),
/***/ 157:
/***/ (function(module, exports) {
module.exports = "/**\r\n * @license\r\n * Lodash (Custom Build) <https://lodash.com/>\r\n * Build: `lodash core plus=\"debounce,throttle,get,set,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy,uniqBy,before,after,unescape\"`\r\n * Copyright JS Foundation and other contributors <https://js.foundation/>\r\n * Released under MIT license <https://lodash.com/license>\r\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\r\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\r\n */\r\n;(function() {\r\n\r\n /** Used as a safe reference for `undefined` in pre-ES5 environments. */\r\n var undefined;\r\n\r\n /** Used as the semantic version number. */\r\n var VERSION = '4.17.5';\r\n\r\n /** Used as the size to enable large array optimizations. */\r\n var LARGE_ARRAY_SIZE = 200;\r\n\r\n /** Error message constants. */\r\n var FUNC_ERROR_TEXT = 'Expected a function';\r\n\r\n /** Used to stand-in for `undefined` hash values. */\r\n var HASH_UNDEFINED = '__lodash_hash_undefined__';\r\n\r\n /** Used as the maximum memoize cache size. */\r\n var MAX_MEMOIZE_SIZE = 500;\r\n\r\n /** Used as the internal argument placeholder. */\r\n var PLACEHOLDER = '__lodash_placeholder__';\r\n\r\n /** Used to compose bitmasks for cloning. */\r\n var CLONE_DEEP_FLAG = 1,\r\n CLONE_FLAT_FLAG = 2,\r\n CLONE_SYMBOLS_FLAG = 4;\r\n\r\n /** Used to compose bitmasks for value comparisons. */\r\n var COMPARE_PARTIAL_FLAG = 1,\r\n COMPARE_UNORDERED_FLAG = 2;\r\n\r\n /** Used to compose bitmasks for function metadata. */\r\n var WRAP_BIND_FLAG = 1,\r\n WRAP_BIND_KEY_FLAG = 2,\r\n WRAP_CURRY_BOUND_FLAG = 4,\r\n WRAP_CURRY_FLAG = 8,\r\n WRAP_CURRY_RIGHT_FLAG = 16,\r\n WRAP_PARTIAL_FLAG = 32,\r\n WRAP_PARTIAL_RIGHT_FLAG = 64,\r\n WRAP_ARY_FLAG = 128,\r\n WRAP_REARG_FLAG = 256,\r\n WRAP_FLIP_FLAG = 512;\r\n\r\n /** Used to detect hot functions by number of calls within a span of milliseconds. */\r\n var HOT_COUNT = 800,\r\n HOT_SPAN = 16;\r\n\r\n /** Used to indicate the type of lazy iteratees. */\r\n var LAZY_FILTER_FLAG = 1,\r\n LAZY_MAP_FLAG = 2,\r\n LAZY_WHILE_FLAG = 3;\r\n\r\n /** Used as references for various `Number` constants. */\r\n var INFINITY = 1 / 0,\r\n MAX_SAFE_INTEGER = 9007199254740991,\r\n MAX_INTEGER = 1.7976931348623157e+308,\r\n NAN = 0 / 0;\r\n\r\n /** Used as references for the maximum length and index of an array. */\r\n var MAX_ARRAY_LENGTH = 4294967295;\r\n\r\n /** Used to associate wrap methods with their bit flags. */\r\n var wrapFlags = [\r\n ['ary', WRAP_ARY_FLAG],\r\n ['bind', WRAP_BIND_FLAG],\r\n ['bindKey', WRAP_BIND_KEY_FLAG],\r\n ['curry', WRAP_CURRY_FLAG],\r\n ['curryRight', WRAP_CURRY_RIGHT_FLAG],\r\n ['flip', WRAP_FLIP_FLAG],\r\n ['partial', WRAP_PARTIAL_FLAG],\r\n ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],\r\n ['rearg', WRAP_REARG_FLAG]\r\n ];\r\n\r\n /** `Object#toString` result references. */\r\n var argsTag = '[object Arguments]',\r\n arrayTag = '[object Array]',\r\n asyncTag = '[object AsyncFunction]',\r\n boolTag = '[object Boolean]',\r\n dateTag = '[object Date]',\r\n errorTag = '[object Error]',\r\n funcTag = '[object Function]',\r\n genTag = '[object GeneratorFunction]',\r\n mapTag = '[object Map]',\r\n numberTag = '[object Number]',\r\n nullTag = '[object Null]',\r\n objectTag = '[object Object]',\r\n promiseTag = '[object Promise]',\r\n proxyTag = '[object Proxy]',\r\n regexpTag = '[object RegExp]',\r\n setTag = '[object Set]',\r\n stringTag = '[object String]',\r\n symbolTag = '[object Symbol]',\r\n undefinedTag = '[object Undefined]',\r\n weakMapTag = '[object WeakMap]';\r\n\r\n var arrayBufferTag = '[ob
/***/ }),
/***/ 158:
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global, setImmediate) {/**
* 基本函数
* Create By GUY 2014\11\17
*
*/
_global = undefined;
if (typeof window !== "undefined") {
_global = window;
} else if (typeof global !== "undefined") {
_global = global;
} else if (typeof self !== "undefined") {
_global = self;
} else {
_global = this;
}
if (!_global.BI) {
_global.BI = {};
}
!(function (undefined) {
var traverse = function (func, context) {
return function (value, key, obj) {
return func.call(context, key, value, obj);
};
};
var _apply = function (name) {
return function () {
return _[name].apply(_, arguments);
};
};
var _applyFunc = function (name) {
return function () {
var args = Array.prototype.slice.call(arguments, 0);
args[1] = _.isFunction(args[1]) ? traverse(args[1], args[2]) : args[1];
return _[name].apply(_, args);
};
};
// Utility
_.extend(BI, {
assert: function (v, is) {
if (this.isFunction(is)) {
if (!is(v)) {
throw new Error(v + " error");
} else {
return true;
}
}
if (!this.isArray(is)) {
is = [is];
}
if (!this.deepContains(is, v)) {
throw new Error(v + " error");
}
return true;
},
warn: function (message) {
console.warn(message);
},
UUID: function () {
var f = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
var str = "";
for (var i = 0; i < 16; i++) {
var r = parseInt(f.length * Math.random(), 10);
str += f[r];
}
return str;
},
isWidget: function (widget) {
return widget instanceof BI.Widget;
},
createWidgets: function (items, options, context) {
if (!BI.isArray(items)) {
throw new Error("items必须是数组", items);
}
if (BI.isWidget(options)) {
context = options;
options = {};
} else {
options || (options = {});
}
return BI.map(BI.flatten(items), function (i, item) {
return BI.createWidget(item, BI.deepClone(options), context);
});
},
createItems: function (data, innerAttr, outerAttr) {
innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr || {});
outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr || {});
return BI.map(data, function (i, item) {
if (BI.isArray(item)) {
return BI.createItems(item, innerAttr, outerAttr);
}
if (item instanceof BI.Widget) {
return BI.extend({}, innerAttr.shift(), outerAttr.shift(), {
type: null,
el: item
});
}
if (innerAttr[0] instanceof BI.Widget) {
outerAttr.shift();
return BI.extend({}, item, {
el: innerAttr.shift()
});
}
if (item.el instanceof BI.Widget) {
innerAttr.shift();
return BI.extend({}, outerAttr.shift(), { type: null }, item);
}
if (item.el) {
return BI.extend({}, outerAttr.shift(), item, {
el: BI.extend({}, innerAttr.shift(), item.el)
});
}
return BI.extend({}, outerAttr.shift(), {
el: BI.extend({}, innerAttr.shift(), item)
});
});
},
// 用容器包装items
packageItems: function (items, layouts) {
for (var i = layouts.length - 1; i >= 0; i--) {
items = BI.map(items, function (k, it) {
return BI.extend({}, layouts[i], {
items: [
BI.extend({}, layouts[i].el, {
el: it
})
]
});
});
}
return items;
},
formatEL: function (obj) {
if (obj && !obj.type && obj.el) {
return obj;
}
return {
el: obj
};
},
// 剥开EL
stripEL: function (obj) {
return obj.type && obj || obj.el || obj;
},
trans2Element: function (widgets) {
return BI.map(widgets, function (i, wi) {
return wi.element;
});
}
});
// 集合相关方法
_.each(["where", "findWhere", "invoke", "pluck", "shuffle", "sample", "toArray", "size"], function (name) {
BI[name] = _apply(name);
});
_.each(["get", "set", "each", "map", "reduce", "reduceRight", "find", "filter", "reject", "every", "all", "some", "any", "max", "min",
"sortBy", "groupBy", "indexBy", "countBy", "partition", "clamp"], function (name) {
if (name === "any") {
BI[name] = _applyFunc("some");
} else {
BI[name] = _applyFunc(name);
}
});
_.extend(BI, {
// 数数
count: function (from, to, predicate) {
var t;
if (predicate) {
for (t = from; t < to; t++) {
predicate(t);
}
}
return to - from;
},
// 倒数
inverse: function (from, to, predicate) {
return BI.count(to, from, predicate);
},
firstKey: function (obj) {
var res = undefined;
BI.any(obj, function (key, value) {
res = key;
return true;
});
return res;
},
lastKey: function (obj) {
var res = undefined;
BI.each(obj, function (key, value) {
res = key;
return true;
});
return res;
},
firstObject: function (obj) {
var res = undefined;
BI.any(obj, function (key, value) {
res = value;
return true;
});
return res;
},
lastObject: function (obj) {
var res = undefined;
BI.each(obj, function (key, value) {
res = value;
return true;
});
return res;
},
concat: function (obj1, obj2) {
if (BI.isKey(obj1)) {
return BI.map([].slice.apply(arguments), function (idx, v) {
return v;
}).join("");
}
if (BI.isArray(obj1)) {
return _.concat.apply([], arguments);
}
if (BI.isObject(obj1)) {
return _.extend.apply({}, arguments);
}
},
backEach: function (obj, predicate, context) {
predicate = BI.iteratee(predicate, context);
for (var index = obj.length - 1; index >= 0; index--) {
predicate(index, obj[index], obj);
}
return false;
},
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;
}
}
return false;
},
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;
}
}
return true;
},
backFindKey: function (obj, predicate, context) {
predicate = BI.iteratee(predicate, context);
var keys = _.keys(obj), key;
for (var i = keys.length - 1; i >= 0; i--) {
key = keys[i];
if (predicate(obj[key], key, obj)) {
return key;
}
}
},
backFind: function (obj, predicate, context) {
var key;
if (BI.isArray(obj)) {
key = BI.findLastIndex(obj, predicate, context);
} else {
key = BI.backFindKey(obj, predicate, context);
}
if (key !== void 0 && key !== -1) {
return obj[key];
}
},
remove: function (obj, target, context) {
var isFunction = BI.isFunction(target);
target = isFunction || BI.isArray(target) ? target : [target];
var i;
if (BI.isArray(obj)) {
for (i = 0; i < obj.length; i++) {
if ((isFunction && target.apply(context, [i, obj[i]]) === true) || (!isFunction && BI.contains(target, obj[i]))) {
obj.splice(i--, 1);
}
}
} else {
BI.each(obj, function (i, v) {
if ((isFunction && target.apply(context, [i, obj[i]]) === true) || (!isFunction && BI.contains(target, obj[i]))) {
delete obj[i];
}
});
}
},
removeAt: function (obj, index) {
index = BI.isArray(index) ? index : [index];
var isArray = BI.isArray(obj), i;
for (i = 0; i < index.length; i++) {
if (isArray) {
obj[index[i]] = "$deleteIndex";
} else {
delete obj[index[i]];
}
}
if (isArray) {
BI.remove(obj, "$deleteIndex");
}
},
string2Array: function (str) {
return str.split("&-&");
},
array2String: function (array) {
return array.join("&-&");
},
abc2Int: function (str) {
var idx = 0, start = "A", str = str.toUpperCase();
for (var i = 0, len = str.length; i < len; ++i) {
idx = str.charAt(i).charCodeAt(0) - start.charCodeAt(0) + 26 * idx + 1;
if (idx > (2147483646 - str.charAt(i).charCodeAt(0) + start.charCodeAt(0)) / 26) {
return 0;
}
}
return idx;
},
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 idx = num, str = "";
if (num === 0) {
return "";
}
while (idx !== 0) {
var t = idx % 26;
if (t === 0) {
t = 26;
}
str = DIGITS[t - 1] + str;
idx = (idx - t) / 26;
}
return str;
}
});
// 数组相关的方法
_.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection",
"difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) {
BI[name] = _apply(name);
});
_.each(["findIndex", "findLastIndex"], function (name) {
BI[name] = _applyFunc(name);
});
_.extend(BI, {
// 构建一个长度为length的数组
makeArray: function (length, value) {
var res = [];
for (var i = 0; i < length; i++) {
if (BI.isNull(value)) {
res.push(i);
} else {
res.push(BI.deepClone(value));
}
}
return res;
},
makeObject: function (array, value) {
var map = {};
for (var i = 0; i < array.length; i++) {
if (BI.isNull(value)) {
map[array[i]] = array[i];
} else if (BI.isFunction(value)) {
map[array[i]] = value(i, array[i]);
} else {
map[array[i]] = BI.deepClone(value);
}
}
return map;
},
makeArrayByArray: function (array, value) {
var res = [];
if (!array) {
return res;
}
for (var i = 0, len = array.length; i < len; i++) {
if (BI.isArray(array[i])) {
res.push(arguments.callee(array[i], value));
} else {
res.push(BI.deepClone(value));
}
}
return res;
},
uniq: function (array, isSorted, iteratee, context) {
if (array == null) {
return [];
}
if (!_.isBoolean(isSorted)) {
context = iteratee;
iteratee = isSorted;
isSorted = false;
}
iteratee && (iteratee = traverse(iteratee, context));
return _.uniq.call(_, array, isSorted, iteratee, context);
}
});
// 对象相关方法
_.each(["keys", "allKeys", "values", "pairs", "invert", "create", "functions", "extend", "extendOwn",
"defaults", "clone", "property", "propertyOf", "matcher", "isEqual", "isMatch", "isEmpty",
"isElement", "isNumber", "isString", "isArray", "isObject", "isPlainObject", "isArguments", "isFunction", "isFinite",
"isBoolean", "isDate", "isRegExp", "isError", "isNaN", "isUndefined", "zipObject", "cloneDeep"], function (name) {
BI[name] = _apply(name);
});
_.each(["mapObject", "findKey", "pick", "omit", "tap"], function (name) {
BI[name] = _applyFunc(name);
});
_.extend(BI, {
inherit: function (sp, overrides) {
var sb = function () {
return sp.apply(this, arguments);
};
var F = function () {
}, spp = sp.prototype;
F.prototype = spp;
sb.prototype = new F();
sb.superclass = spp;
_.extend(sb.prototype, overrides, {
superclass: sp
});
return sb;
},
init: function () {
// 先把准备环境准备好
while (BI.prepares && BI.prepares.length > 0) {
BI.prepares.shift()();
}
while (_global.___fineuiExposedFunction && _global.___fineuiExposedFunction.length > 0) {
_global.___fineuiExposedFunction.shift()();
}
BI.initialized = true;
},
has: function (obj, keys) {
if (BI.isArray(keys)) {
if (keys.length === 0) {
return false;
}
return BI.every(keys, function (i, key) {
return _.has(obj, key);
});
}
return _.has.apply(_, arguments);
},
freeze: function (value) {
// 在ES5中,如果这个方法的参数不是一个对象(一个原始值),那么它会导致 TypeError
// 在ES2015中,非对象参数将被视为要被冻结的普通对象,并被简单地返回
if (Object.freeze && BI.isObject(value)) {
return Object.freeze(value);
}
return value;
},
// 数字和字符串可以作为key
isKey: function (key) {
return BI.isNumber(key) || (BI.isString(key) && key.length > 0);
},
// 忽略大小写的等于
isCapitalEqual: function (a, b) {
a = BI.isNull(a) ? a : ("" + a).toLowerCase();
b = BI.isNull(b) ? b : ("" + b).toLowerCase();
return BI.isEqual(a, b);
},
isWidthOrHeight: function (w) {
if (typeof w === "number") {
return w >= 0;
} else if (typeof w === "string") {
return /^\d{1,3}(\.\d)?%$/.test(w) || w === "auto" || /^\d+px$/.test(w) || /^calc/.test(w);
4 years ago
}
},
isNotNull: function (obj) {
return !BI.isNull(obj);
},
isNull: function (obj) {
return typeof obj === "undefined" || obj === null;
},
isEmptyArray: function (arr) {
return BI.isArray(arr) && BI.isEmpty(arr);
},
isNotEmptyArray: function (arr) {
return BI.isArray(arr) && !BI.isEmpty(arr);
},
isEmptyObject: function (obj) {
return BI.isEqual(obj, {});
},
isNotEmptyObject: function (obj) {
return BI.isPlainObject(obj) && !BI.isEmptyObject(obj);
},
isEmptyString: function (obj) {
return BI.isString(obj) && obj.length === 0;
},
isNotEmptyString: function (obj) {
return BI.isString(obj) && !BI.isEmptyString(obj);
},
isWindow: function (obj) {
return obj != null && obj == obj.window;
}
});
// deep方法
_.extend(BI, {
deepClone: _.cloneDeep,
deepExtend: _.merge,
isDeepMatch: function (object, attrs) {
var keys = BI.keys(attrs), length = keys.length;
if (object == null) {
return !length;
4 years ago
}
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;
4 years ago
}
}
return true;
},
contains: function (obj, target, fromIndex) {
if (!_.isArrayLike(obj)) obj = _.values(obj);
return _.indexOf(obj, target, typeof fromIndex === "number" && fromIndex) >= 0;
},
deepContains: function (obj, copy) {
if (BI.isObject(copy)) {
return BI.any(obj, function (i, v) {
if (BI.isEqual(v, copy)) {
return true;
}
});
}
return BI.contains(obj, copy);
},
deepIndexOf: function (obj, target) {
for (var i = 0; i < obj.length; i++) {
if (BI.isEqual(target, obj[i])) {
return i;
}
}
return -1;
},
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) {
if (BI.isArray(obj)) {
var result = [];
for (var i = 0; i < obj.length; i++) {
if (!BI.isEqual(target, obj[i])) {
result.push(obj[i]);
}
}
return result;
}
var result = {};
BI.each(obj, function (i, v) {
if (!BI.isEqual(target, obj[i])) {
result[i] = v;
}
});
return result;
},
deepUnique: function (array) {
var result = [];
BI.each(array, function (i, item) {
if (!BI.deepContains(result, item)) {
result.push(item);
}
});
return result;
},
// 比较两个对象得出不一样的key值
deepDiff: function (object, other) {
object || (object = {});
other || (other = {});
var result = [];
var used = [];
for (var b in object) {
if (this.has(object, b)) {
if (!this.isEqual(object[b], other[b])) {
result.push(b);
}
used.push(b);
}
}
for (var b in other) {
if (this.has(other, b) && !BI.contains(used, b)) {
result.push(b);
}
4 years ago
}
return result;
}
});
7 years ago
// 通用方法
_.each(["uniqueId", "result", "chain", "iteratee", "escape", "unescape", "before", "after"], function (name) {
BI[name] = function () {
return _[name].apply(_, arguments);
};
});
// 事件相关方法
_.each(["bind", "once", "partial", "debounce", "throttle", "delay", "defer", "wrap"], function (name) {
BI[name] = function () {
return _[name].apply(_, arguments);
};
});
_.extend(BI, {
nextTick: (function () {
var callbacks = [];
var pending = false;
var timerFunc = void 0;
function nextTickHandler() {
pending = false;
var copies = callbacks.slice(0);
callbacks.length = 0;
for (var i = 0; i < copies.length; i++) {
copies[i]();
}
4 years ago
}
if (typeof Promise !== "undefined") {
var p = Promise.resolve();
timerFunc = function timerFunc() {
p.then(nextTickHandler);
};
} else if (typeof MutationObserver !== "undefined") {
var counter = 1;
var observer = new MutationObserver(nextTickHandler);
var textNode = document.createTextNode(String(counter));
observer.observe(textNode, {
characterData: true
});
timerFunc = function timerFunc() {
counter = (counter + 1) % 2;
textNode.data = String(counter);
};
} else if (typeof setImmediate !== "undefined") {
timerFunc = function timerFunc() {
setImmediate(nextTickHandler);
};
} else {
// Fallback to setTimeout.
timerFunc = function timerFunc() {
setTimeout(nextTickHandler, 0);
};
4 years ago
}
return function queueNextTick(cb) {
var _resolve = void 0;
var args = [].slice.call(arguments, 1);
callbacks.push(function () {
if (cb) {
try {
cb.apply(null, args);
} catch (e) {
console.error(e);
}
} else if (_resolve) {
_resolve.apply(null, args);
}
});
if (!pending) {
pending = true;
timerFunc();
}
// $flow-disable-line
if (!cb && typeof Promise !== 'undefined') {
return new Promise(function (resolve, reject) {
_resolve = resolve;
});
}
};
})()
});
// 数字相关方法
_.each(["random"], function (name) {
BI[name] = _apply(name);
});
_.extend(BI, {
getTime: function () {
if (_global.performance && _global.performance.now) {
return _global.performance.now();
}
if (_global.performance && _global.performance.webkitNow) {
return _global.performance.webkitNow();
}
if (Date.now) {
return Date.now();
}
return BI.getDate().getTime();
},
parseInt: function (number) {
var radix = 10;
if (/^0x/g.test(number)) {
radix = 16;
4 years ago
}
try {
return parseInt(number, radix);
} catch (e) {
throw new Error(number + "parse int error");
return NaN;
4 years ago
}
},
parseSafeInt: function (value) {
var MAX_SAFE_INTEGER = 9007199254740991;
return value
? this.clamp(this.parseInt(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
: (value === 0 ? value : 0);
},
parseFloat: function (number) {
try {
return parseFloat(number);
} catch (e) {
throw new Error(number + "parse float error");
return NaN;
}
},
isNaturalNumber: function (number) {
if (/^\d+$/.test(number)) {
return true;
}
return false;
},
4 years ago
isPositiveInteger: function (number) {
if (/^\+?[1-9][0-9]*$/.test(number)) {
return true;
}
return false;
},
4 years ago
isNegativeInteger: function (number) {
if (/^\-[1-9][0-9]*$/.test(number)) {
return true;
}
return false;
},
isInteger: function (number) {
if (/^\-?\d+$/.test(number)) {
return true;
}
return false;
},
isNumeric: function (number) {
return !isNaN(parseFloat(number)) && isFinite(number);
},
isFloat: function (number) {
if (/^([+-]?)\d*\.\d+$/.test(number)) {
return true;
}
return false;
},
isOdd: function (number) {
if (!BI.isInteger(number)) {
return false;
}
return (number & 1) === 1;
},
isEven: function (number) {
if (!BI.isInteger(number)) {
return false;
}
return (number & 1) === 0;
},
sum: function (array, iteratee, context) {
var sum = 0;
BI.each(array, function (i, item) {
if (iteratee) {
sum += Number(iteratee.apply(context, [i, item]));
} else {
sum += Number(item);
}
});
return sum;
},
average: function (array, iteratee, context) {
var sum = BI.sum(array, iteratee, context);
return sum / array.length;
}
});
// 字符串相关方法
_.extend(BI, {
trim: function () {
return _.trim.apply(_, arguments);
},
toUpperCase: function (string) {
return (string + "").toLocaleUpperCase();
},
toLowerCase: function (string) {
return (string + "").toLocaleLowerCase();
},
isEndWithBlank: function (string) {
return /(\s|\u00A0)$/.test(string);
},
isLiteral: function (exp) {
var literalValueRE = /^\s?(true|false|-?[\d\.]+|'[^']*'|"[^"]*")\s?$/;
return literalValueRE.test(exp);
},
stripQuotes: function (str) {
var a = str.charCodeAt(0);
var b = str.charCodeAt(str.length - 1);
return a === b && (a === 0x22 || a === 0x27)
? str.slice(1, -1)
: str;
},
// background-color => backgroundColor
camelize: function (str) {
return str.replace(/-(.)/g, function (_, character) {
return character.toUpperCase();
});
},
// backgroundColor => background-color
hyphenate: function (str) {
return str.replace(/([A-Z])/g, "-$1").toLowerCase();
},
isNotEmptyString: function (str) {
return BI.isString(str) && !BI.isEmpty(str);
},
isEmptyString: function (str) {
return BI.isString(str) && BI.isEmpty(str);
},
/**
* 通用加密方法
*/
encrypt: function (type, text, key) {
switch (type) {
case BI.CRYPT_TYPE.AES:
default:
return BI.aesEncrypt(text, key);
4 years ago
}
},
/**
* 通用解密方法
* @param type 解密方式
* @param text 文本
* @param key 种子
* @return {*}
*/
decrypt: function (type, text, key) {
switch (type) {
case BI.CRYPT_TYPE.AES:
default:
return BI.aesDecrypt(text, key);
4 years ago
}
},
/**
* 对字符串中的'\做编码处理
* @static
* @param {String} string 要做编码处理的字符串
* @return {String} 编码后的字符串
*/
escape: function (string) {
return string.replace(/('|\\)/g, "\\$1");
},
/**
* 让字符串通过指定字符做补齐的函数
*
* var s = BI.leftPad('123', 5, '0');//s的值为:'00123'
*
* @static
* @param {String} val 原始值
* @param {Number} size 总共需要的位数
* @param {String} ch 用于补齐的字符
* @return {String} 补齐后的字符串
*/
leftPad: function (val, size, ch) {
var result = String(val);
if (!ch) {
ch = " ";
4 years ago
}
while (result.length < size) {
result = ch + result;
}
return result.toString();
},
/**
* 对字符串做替换的函数
*
* var cls = 'my-class', text = 'Some text';
* var res = BI.format('<div class="{0}">{1}</div>', cls, text);
* //res的值为:'<div class="my-class">Some text</div>';
*
* @static
* @param {String} format 要做替换的字符串替换字符串1替换字符串2...
* @return {String} 做了替换后的字符串
*/
format: function (format) {
var args = Array.prototype.slice.call(arguments, 1);
return format.replace(/\{(\d+)\}/g, function (m, i) {
return args[i];
});
}
});
// 日期相关方法
_.extend(BI, {
/**
* 是否是闰年
* @param year
* @returns {boolean}
*/
isLeapYear: function (year) {
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
},
/**
* 检测是否在有效期
*
* @param YY
* @param MM
* @param DD
* @param minDate '1900-01-01'
* @param maxDate '2099-12-31'
* @returns {Array} 若无效返回无效状态
*/
checkDateVoid: function (YY, MM, DD, minDate, maxDate) {
var back = [];
YY = YY | 0;
MM = MM | 0;
DD = DD | 0;
minDate = BI.isString(minDate) ? minDate.match(/\d+/g) : minDate;
maxDate = BI.isString(maxDate) ? maxDate.match(/\d+/g) : maxDate;
if (YY < minDate[0]) {
back = ["y"];
} else if (YY > maxDate[0]) {
back = ["y", 1];
} else if (YY >= minDate[0] && YY <= maxDate[0]) {
if (YY == minDate[0]) {
if (MM < minDate[1]) {
back = ["m"];
} else if (MM == minDate[1]) {
if (DD < minDate[2]) {
back = ["d"];
}
}
}
if (YY == maxDate[0]) {
if (MM > maxDate[1]) {
back = ["m", 1];
} else if (MM == maxDate[1]) {
if (DD > maxDate[2]) {
back = ["d", 1];
}
}
}
}
return back;
},
checkDateLegal: function (str) {
var ar = str.match(/\d+/g);
var YY = ar[0] | 0, MM = ar[1] | 0, DD = ar[2] | 0;
if (ar.length <= 1) {
return true;
}
if (ar.length <= 2) {
return MM >= 1 && MM <= 12;
}
var MD = BI.Date._MD.slice(0);
MD[1] = BI.isLeapYear(YY) ? 29 : 28;
return MM >= 1 && MM <= 12 && DD <= MD[MM - 1];
},
parseDateTime: function (str, fmt) {
var today = BI.getDate();
var y = 0;
var m = 0;
var d = 1;
// wei : 对于fmt为‘YYYYMM’或者‘YYYYMMdd’的格式,str的值为类似'201111'的形式,因为年月之间没有分隔符,所以正则表达式分割无效,导致bug7376。
var a = str.split(/\W+/);
if (fmt.toLowerCase() == "%y%x" || fmt.toLowerCase() == "%y%x%d") {
var yearlength = 4;
var otherlength = 2;
a[0] = str.substring(0, yearlength);
a[1] = str.substring(yearlength, yearlength + otherlength);
a[2] = str.substring(yearlength + otherlength, yearlength + otherlength * 2);
}
var b = fmt.match(/%./g);
var i = 0, j = 0;
var hr = 0;
var min = 0;
var sec = 0;
for (i = 0; i < a.length; ++i) {
switch (b[i]) {
case "%d":
case "%e":
d = parseInt(a[i], 10);
break;
case "%X":
m = parseInt(a[i], 10) - 1;
break;
case "%x":
m = parseInt(a[i], 10) - 1;
break;
case "%Y":
case "%y":
y = parseInt(a[i], 10);
(y < 100) && (y += (y > 29) ? 1900 : 2000);
break;
case "%b":
case "%B":
for (j = 0; j < 12; ++j) {
if (BI.Date._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) {
m = j;
break;
}
}
break;
case "%H":
case "%I":
case "%k":
case "%l":
hr = parseInt(a[i], 10);
break;
case "%P":
case "%p":
if (/pm/i.test(a[i]) && hr < 12) {
hr += 12;
} else if (/am/i.test(a[i]) && hr >= 12) {
hr -= 12;
}
break;
case "%Q":
case "%q":
m = (parseInt(a[i], 10) - 1) * 3;
break;
case "%M":
min = parseInt(a[i], 10);
break;
case "%S":
sec = parseInt(a[i], 10);
break;
}
}
// if (!a[i]) {
// continue;
// }
if (isNaN(y)) {
y = today.getFullYear();
}
if (isNaN(m)) {
m = today.getMonth();
}
if (isNaN(d)) {
d = today.getDate();
}
if (isNaN(hr)) {
hr = today.getHours();
}
if (isNaN(min)) {
min = today.getMinutes();
}
if (isNaN(sec)) {
sec = today.getSeconds();
}
if (y != 0) {
return BI.getDate(y, m, d, hr, min, sec);
}
y = 0;
m = -1;
d = 0;
for (i = 0; i < a.length; ++i) {
if (a[i].search(/[a-zA-Z]+/) != -1) {
var t = -1;
for (j = 0; j < 12; ++j) {
if (BI.Date._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) {
t = j;
break;
}
}
if (t != -1) {
if (m != -1) {
d = m + 1;
}
m = t;
}
} else if (parseInt(a[i], 10) <= 12 && m == -1) {
m = a[i] - 1;
} else if (parseInt(a[i], 10) > 31 && y == 0) {
y = parseInt(a[i], 10);
(y < 100) && (y += (y > 29) ? 1900 : 2000);
} else if (d == 0) {
d = a[i];
}
}
if (y == 0) {
y = today.getFullYear();
}
if (m === -1) {
m = today.getMonth();
}
if (m != -1 && d != 0) {
return BI.getDate(y, m, d, hr, min, sec);
}
return today;
},
getDate: function () {
var length = arguments.length;
var args = arguments;
var dt;
switch (length) {
// new Date()
case 0:
dt = new Date();
break;
// new Date(long)
case 1:
dt = new Date(args[0]);
break;
// new Date(year, month)
case 2:
dt = new Date(args[0], args[1]);
break;
// new Date(year, month, day)
case 3:
dt = new Date(args[0], args[1], args[2]);
break;
// new Date(year, month, day, hour)
case 4:
dt = new Date(args[0], args[1], args[2], args[3]);
break;
// new Date(year, month, day, hour, minute)
case 5:
dt = new Date(args[0], args[1], args[2], args[3], args[4]);
break;
// new Date(year, month, day, hour, minute, second)
case 6:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
// new Date(year, month, day, hour, minute, second, millisecond)
case 7:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
break;
default:
dt = new Date();
break;
}
if (BI.isNotNull(BI.timeZone) && (arguments.length === 0 || (arguments.length === 1 && BI.isNumber(arguments[0])))) {
var localTime = dt.getTime();
// BI-33791 1901年以前的东8区标准是GMT+0805, 统一无论是什么时间,都以整的0800这样的为基准
var localOffset = dt.getTimezoneOffset() * 60000; // 获得当地时间偏移的毫秒数
var utc = localTime + localOffset; // utc即GMT时间标准时区
return new Date(utc + BI.timeZone);// + Pool.timeZone.offset);
}
return dt;
},
getTime: function () {
var length = arguments.length;
var args = arguments;
var dt;
switch (length) {
// new Date()
case 0:
dt = new Date();
break;
// new Date(long)
case 1:
dt = new Date(args[0]);
break;
// new Date(year, month)
case 2:
dt = new Date(args[0], args[1]);
break;
// new Date(year, month, day)
case 3:
dt = new Date(args[0], args[1], args[2]);
break;
// new Date(year, month, day, hour)
case 4:
dt = new Date(args[0], args[1], args[2], args[3]);
break;
// new Date(year, month, day, hour, minute)
case 5:
dt = new Date(args[0], args[1], args[2], args[3], args[4]);
break;
// new Date(year, month, day, hour, minute, second)
case 6:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
// new Date(year, month, day, hour, minute, second, millisecond)
case 7:
dt = new Date(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
break;
default:
dt = new Date();
break;
}
if (BI.isNotNull(BI.timeZone)) {
// BI-33791 1901年以前的东8区标准是GMT+0805, 统一无论是什么时间,都以整的0800这样的为基准
return dt.getTime() - BI.timeZone - new Date().getTimezoneOffset() * 60000;
}
return dt.getTime();
}
});
})();
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(15), __webpack_require__(61).setImmediate))
/***/ }),
/***/ 159:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global, process) {
(function (global, undefined) {
"use strict";
if (global.setImmediate) {
return;
}
var nextHandle = 1; // Spec says greater than zero
var tasksByHandle = {};
var currentlyRunningATask = false;
var doc = global.document;
var registerImmediate;
function setImmediate(callback) {
// Callback can either be a function or a string
if (typeof callback !== "function") {
callback = new Function("" + callback);
} // Copy function arguments
4 years ago
var args = new Array(arguments.length - 1);
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i + 1];
} // Store and register the task
var task = {
callback: callback,
args: args
};
tasksByHandle[nextHandle] = task;
registerImmediate(nextHandle);
return nextHandle++;
}
function clearImmediate(handle) {
delete tasksByHandle[handle];
}
function run(task) {
var callback = task.callback;
var args = task.args;
switch (args.length) {
case 0:
callback();
break;
case 1:
callback(args[0]);
break;
case 2:
callback(args[0], args[1]);
break;
case 3:
callback(args[0], args[1], args[2]);
break;
default:
callback.apply(undefined, args);
break;
}
}
function runIfPresent(handle) {
// From the spec: "Wait until any invocations of this algorithm started before this one have completed."
// So if we're currently running a task, we'll need to delay this invocation.
if (currentlyRunningATask) {
// Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
// "too much recursion" error.
setTimeout(runIfPresent, 0, handle);
} else {
var task = tasksByHandle[handle];
if (task) {
currentlyRunningATask = true;
try {
run(task);
} finally {
clearImmediate(handle);
currentlyRunningATask = false;
}
}
}
}
function installNextTickImplementation() {
registerImmediate = function registerImmediate(handle) {
process.nextTick(function () {
runIfPresent(handle);
});
};
}
function canUsePostMessage() {
// The test against `importScripts` prevents this implementation from being installed inside a web worker,
// where `global.postMessage` means something completely different and can't be used for this purpose.
if (global.postMessage && !global.importScripts) {
var postMessageIsAsynchronous = true;
var oldOnMessage = global.onmessage;
global.onmessage = function () {
postMessageIsAsynchronous = false;
};
global.postMessage("", "*");
global.onmessage = oldOnMessage;
return postMessageIsAsynchronous;
}
}
function installPostMessageImplementation() {
// Installs an event handler on `global` for the `message` event: see
// * https://developer.mozilla.org/en/DOM/window.postMessage
// * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
var messagePrefix = "setImmediate$" + Math.random() + "$";
var onGlobalMessage = function onGlobalMessage(event) {
if (event.source === global && typeof event.data === "string" && event.data.indexOf(messagePrefix) === 0) {
runIfPresent(+event.data.slice(messagePrefix.length));
}
};
if (global.addEventListener) {
global.addEventListener("message", onGlobalMessage, false);
} else {
global.attachEvent("onmessage", onGlobalMessage);
}
registerImmediate = function registerImmediate(handle) {
global.postMessage(messagePrefix + handle, "*");
};
}
function installMessageChannelImplementation() {
var channel = new MessageChannel();
channel.port1.onmessage = function (event) {
var handle = event.data;
runIfPresent(handle);
};
registerImmediate = function registerImmediate(handle) {
channel.port2.postMessage(handle);
};
}
function installReadyStateChangeImplementation() {
var html = doc.documentElement;
registerImmediate = function registerImmediate(handle) {
// Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
// into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
var script = doc.createElement("script");
script.onreadystatechange = function () {
runIfPresent(handle);
script.onreadystatechange = null;
html.removeChild(script);
script = null;
};
html.appendChild(script);
};
}
function installSetTimeoutImplementation() {
registerImmediate = function registerImmediate(handle) {
setTimeout(runIfPresent, 0, handle);
};
} // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
attachTo = attachTo && attachTo.setTimeout ? attachTo : global; // Don't get fooled by e.g. browserify environments.
if ({}.toString.call(global.process) === "[object process]") {
// For Node.js before 0.9
installNextTickImplementation();
} else if (canUsePostMessage()) {
// For non-IE10 modern browsers
installPostMessageImplementation();
} else if (global.MessageChannel) {
// For web workers, where supported
installMessageChannelImplementation();
} else if (doc && "onreadystatechange" in doc.createElement("script")) {
// For IE 6–8
installReadyStateChangeImplementation();
} else {
// For older browsers
installSetTimeoutImplementation();
}
attachTo.setImmediate = setImmediate;
attachTo.clearImmediate = clearImmediate;
})(typeof self === "undefined" ? typeof global === "undefined" ? void 0 : global : self);
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(15), __webpack_require__(75)))
/***/ }),
/***/ 160:
/***/ (function(module, exports) {
!(function () {
function extend () {
var target = arguments[0] || {}, length = arguments.length, i = 1, options, name, src, copy;
for (; i < length; i++) {
// Only deal with non-null/undefined values
if ((options = arguments[i]) != null) {
// Extend the base object
for (name in options) {
src = target[name];
copy = options[name];
// Prevent never-ending loop
if (target === copy) {
continue;
}
if (copy !== undefined) {
target[name] = copy;
}
}
}
}
return target;
}
/**
* 客户端观察者主要处理事件的添加删除执行等
* @class BI.OB
* @abstract
*/
var OB = function (config) {
this._constructor(config);
};
_.extend(OB.prototype, {
props: {},
init: null,
destroyed: null,
_constructor: function (config) {
this._initProps(config);
this._init();
this._initRef();
},
_defaultConfig: function (config) {
return {};
},
_initProps: function (config) {
var props = this.props;
if (BI.isFunction(this.props)) {
props = this.props(config);
}
this.options = extend(this._defaultConfig(config), props, config);
},
7 years ago
_init: function () {
this._initListeners();
this.init && this.init();
},
_initListeners: function () {
var self = this;
if (this.options.listeners != null) {
_.each(this.options.listeners, function (lis) {
(lis.target ? lis.target : self)[lis.once ? "once" : "on"]
(lis.eventName, _.bind(lis.action, self));
});
delete this.options.listeners;
}
},
// 获得一个当前对象的引用
_initRef: function () {
if (this.options.__ref) {
this.options.__ref.call(this, this);
}
if (this.options.ref) {
this.options.ref.call(this, this);
}
},
//释放当前对象
_purgeRef: function () {
if (this.options.__ref) {
this.options.__ref.call(null);
this.options.__ref = null;
}
if (this.options.ref) {
this.options.ref.call(null);
this.options.ref = null;
}
},
_getEvents: function () {
if (!_.isObject(this.events)) {
this.events = {};
}
return this.events;
},
4 years ago
/**
* 给观察者绑定一个事件
* @param {String} eventName 事件的名字
* @param {Function} fn 事件对应的执行函数
4 years ago
*/
on: function (eventName, fn) {
var self = this;
eventName = eventName.toLowerCase();
var fns = this._getEvents()[eventName];
if (!_.isArray(fns)) {
fns = [];
this._getEvents()[eventName] = fns;
}
fns.push(fn);
return function () {
self.un(eventName, fn);
};
},
4 years ago
/**
* 给观察者绑定一个只执行一次的事件
* @param {String} eventName 事件的名字
* @param {Function} fn 事件对应的执行函数
4 years ago
*/
once: function (eventName, fn) {
var proxy = function () {
fn.apply(this, arguments);
this.un(eventName, proxy);
};
this.on(eventName, proxy);
},
/**
* 解除观察者绑定的指定事件
* @param {String} eventName 要解除绑定事件的名字
* @param {Function} fn 事件对应的执行函数该参数是可选的没有该参数时将解除绑定所有同名字的事件
*/
un: function (eventName, fn) {
eventName = eventName.toLowerCase();
/* alex:如果fn是null,就是把eventName上面所有方法都un掉*/
if (fn == null) {
delete this._getEvents()[eventName];
} else {
var fns = this._getEvents()[eventName];
if (_.isArray(fns)) {
var newFns = [];
_.each(fns, function (ifn) {
if (ifn != fn) {
newFns.push(ifn);
}
});
this._getEvents()[eventName] = newFns;
}
}
},
/**
* 清除观察者的所有事件绑定
*/
purgeListeners: function () {
/* alex:清空events*/
this.events = {};
},
/**
* 触发绑定过的事件
*
* @param {String} eventName 要触发的事件的名字
* @returns {Boolean} 如果事件函数返回false则返回false并中断其他同名事件的执行否则执行所有的同名事件并返回true
*/
fireEvent: function () {
var eventName = arguments[0].toLowerCase();
var fns = this._getEvents()[eventName];
if (BI.isArray(fns)) {
if (BI.isArguments(arguments[1])) {
for (var i = 0; i < fns.length; i++) {
if (fns[i].apply(this, arguments[1]) === false) {
return false;
}
}
} else {
var args = Array.prototype.slice.call(arguments, 1);
for (var i = 0; i < fns.length; i++) {
if (fns[i].apply(this, args) === false) {
return false;
}
}
}
}
return true;
},
destroy: function () {
this.destroyed && this.destroyed();
this._purgeRef();
this.purgeListeners();
}
});
BI.OB = BI.OB || OB;
})();
7 years ago
/***/ }),
7 years ago
/***/ 161:
/***/ (function(module, exports) {
7 years ago
(function () {
var moduleInjection = {}, moduleInjectionMap = {
components: {},
constants: {},
stores: {},
services: {},
models: {},
providers: {}
};
BI.module = BI.module || function (xtype, cls) {
if (moduleInjection[xtype] != null) {
_global.console && console.error("module: [" + xtype + "] 已经注册过了");
}
if (BI.isFunction(cls)) {
cls = cls();
}
for (var k in moduleInjectionMap) {
if (cls[k]) {
for (var key in cls[k]) {
if (!moduleInjectionMap[k]) {
continue;
}
if (!moduleInjectionMap[k][key]) {
moduleInjectionMap[k][key] = [];
}
moduleInjectionMap[k][key].push({
version: cls[k][key],
moduleId: xtype
});
}
}
}
moduleInjection[xtype] = cls;
};
7 years ago
var constantInjection = {};
BI.constant = BI.constant || function (xtype, cls) {
if (constantInjection[xtype] != null) {
_global.console && console.error("constant: [" + xtype + "]已经注册过了");
}
constantInjection[xtype] = cls;
};
7 years ago
var modelInjection = {};
BI.model = BI.model || function (xtype, cls) {
if (modelInjection[xtype] != null) {
_global.console && console.error("model: [" + xtype + "] 已经注册过了");
}
modelInjection[xtype] = cls;
};
var storeInjection = {};
BI.store = BI.store || function (xtype, cls) {
if (storeInjection[xtype] != null) {
_global.console && console.error("store: [" + xtype + "] 已经注册过了");
}
storeInjection[xtype] = cls;
};
var serviceInjection = {};
BI.service = BI.service || function (xtype, cls) {
if (serviceInjection[xtype] != null) {
_global.console && console.error("service: [" + xtype + "] 已经注册过了");
}
serviceInjection[xtype] = cls;
};
var providerInjection = {};
BI.provider = BI.provider || function (xtype, cls) {
if (providerInjection[xtype] != null) {
_global.console && console.error("provider: [" + xtype + "] 已经注册过了");
}
providerInjection[xtype] = cls;
};
var configFunctions = {};
var runConfigFunction = BI.runConfigFunction = function (type) {
if (!type || !configFunctions[type]) {
return false;
}
var queue = configFunctions[type];
delete configFunctions[type];
var dependencies = BI.Providers.getProvider("bi.provider.system").getDependencies();
var modules = moduleInjectionMap.components[type]
|| moduleInjectionMap.constants[type]
|| moduleInjectionMap.services[type]
|| moduleInjectionMap.stores[type]
|| moduleInjectionMap.models[type]
|| moduleInjectionMap.providers[type];
for (var i = 0; i < queue.length; i++) {
var conf = queue[i];
var version = conf.opt.version;
var fn = conf.fn;
if (modules && version) {
var findVersion = false;
for (var j = 0; j < modules.length; j++) {
var module = modules[j];
if (module && dependencies[module.moduleId] && module.version === version) {
var minVersion = dependencies[module.moduleId].minVersion,
maxVersion = dependencies[module.moduleId].maxVersion;
if (minVersion && (moduleInjection[module.moduleId].version || version) < minVersion) {
findVersion = true;
break;
}
if (maxVersion && (moduleInjection[module.moduleId].version || version) > maxVersion) {
findVersion = true;
break;
}
}
}
if (findVersion === true) {
_global.console && console.error("moduleId: [" + module.moduleId + "] 接口: [" + type + "] 接口版本: [" + version + "] 已过期,版本要求为:", dependencies[module.moduleId], "=>", moduleInjection[module.moduleId]);
continue;
}
}
if (constantInjection[type]) {
constantInjection[type] = fn(constantInjection[type]);
continue;
}
if (providerInjection[type]) {
if (!providers[type]) {
providers[type] = new providerInjection[type]();
}
if (providerInstance[type]) {
delete providerInstance[type];
}
fn(providers[type]);
continue;
}
BI.Plugin.configWidget(type, fn);
}
};
BI.config = BI.config || function (type, configFn, opt) {
opt = opt || {};
// 系统配置直接执行
if ("bi.provider.system" === type) {
if (!providers[type]) {
providers[type] = new providerInjection[type]();
}
// 如果config被重新配置的话,需要删除掉之前的实例
if (providerInstance[type]) {
delete providerInstance[type];
}
return configFn(providers[type]);
}
if (!configFunctions[type]) {
configFunctions[type] = [];
}
configFunctions[type].push({
fn: configFn,
opt: opt
});
// // 初始化过或者系统配置需要立刻执行
// if (BI.initialized || "bi.provider.system" === type) {
// if (constantInjection[type]) {
// return (constantInjection[type] = configFn(constantInjection[type]));
// }
// if (providerInjection[type]) {
// if (!providers[type]) {
// providers[type] = new providerInjection[type]();
// }
// // 如果config被重新配置的话,需要删除掉之前的实例
// if (providerInstance[type]) {
// delete providerInstance[type];
// }
// return configFn(providers[type]);
// }
// return BI.Plugin.configWidget(type, configFn, opt);
// }
// if (!configFunctions[type]) {
// configFunctions[type] = [];
// BI.prepares.push(function () {
// var queue = configFunctions[type];
// var dependencies = BI.Providers.getProvider("bi.provider.system").getDependencies();
// var modules = moduleInjectionMap.components[type]
// || moduleInjectionMap.constants[type]
// || moduleInjectionMap.services[type]
// || moduleInjectionMap.stores[type]
// || moduleInjectionMap.models[type]
// || moduleInjectionMap.providers[type];
// for (var i = 0; i < queue.length; i++) {
// var conf = queue[i];
// var version = conf.opt.version;
// var fn = conf.fn;
// if (modules && version) {
// var findVersion = false;
// for (var j = 0; j < modules.length; j++) {
// var module = modules[i];
// if (module && dependencies[module.moduleId] && module.version === version) {
// var minVersion = dependencies[module.moduleId].minVersion,
// maxVersion = dependencies[module.moduleId].maxVersion;
// if (minVersion && (moduleInjection[module.moduleId].version || version) < minVersion) {
// findVersion = true;
// break;
// }
// if (maxVersion && (moduleInjection[module.moduleId].version || version) > maxVersion) {
// findVersion = true;
// break;
// }
// }
// }
// if (findVersion === true) {
// _global.console && console.error("moduleId: [" + module.moduleId + "] 接口: [" + type + "] 接口版本: [" + version + "] 已过期,版本要求为:", dependencies[module.moduleId], "=>", moduleInjection[module.moduleId]);
// continue;
// }
// }
// if (constantInjection[type]) {
// constantInjection[type] = fn(constantInjection[type]);
// continue;
// }
// if (providerInjection[type]) {
// if (!providers[type]) {
// providers[type] = new providerInjection[type]();
// }
// if (providerInstance[type]) {
// delete providerInstance[type];
// }
// fn(providers[type]);
// continue;
// }
// BI.Plugin.configWidget(type, fn);
// }
// configFunctions[type] = null;
// });
// }
// configFunctions[type].push({
// fn: configFn,
// opt: opt
// });
};
BI.getReference = BI.getReference || function (type, fn) {
return BI.Plugin.registerObject(type, fn);
};
var actions = {};
var globalAction = [];
BI.action = BI.action || function (type, actionFn) {
if (BI.isFunction(type)) {
globalAction.push(type);
return function () {
BI.remove(globalAction, function (idx) {
return globalAction.indexOf(actionFn) === idx;
});
};
}
if (!actions[type]) {
actions[type] = [];
}
actions[type].push(actionFn);
return function () {
BI.remove(actions[type], function (idx) {
return actions[type].indexOf(actionFn) === idx;
});
if (actions[type].length === 0) {
delete actions[type];
}
};
};
var points = {};
BI.point = BI.point || function (type, action, pointFn, after) {
if (!points[type]) {
points[type] = {};
}
if (!points[type][action]) {
points[type][action] = {};
}
if (!points[type][action][after ? "after" : "before"]) {
points[type][action][after ? "after" : "before"] = [];
}
points[type][action][after ? "after" : "before"].push(pointFn);
};
7 years ago
BI.Modules = BI.Modules || {
getModule: function (type) {
if (!moduleInjection[type]) {
_global.console && console.error("module: [" + type + "] 未定义");
}
return moduleInjection[type];
},
getAllModules: function () {
return moduleInjection;
}
};
7 years ago
BI.Constants = BI.Constants || {
getConstant: function (type) {
if (BI.isNull(constantInjection[type])) {
_global.console && console.error("constant: [" + type + "] 未定义");
}
runConfigFunction(type);
return constantInjection[type];
}
};
var callPoint = function (inst, types) {
types = BI.isArray(types) ? types : [types];
BI.each(types, function (idx, type) {
if (points[type]) {
for (var action in points[type]) {
var bfns = points[type][action].before;
if (bfns) {
BI.aspect.before(inst, action, function (bfns) {
return function () {
for (var i = 0, len = bfns.length; i < len; i++) {
try {
bfns[i].apply(inst, arguments);
} catch (e) {
_global.console && console.error(e);
}
}
};
}(bfns));
}
var afns = points[type][action].after;
if (afns) {
BI.aspect.after(inst, action, function (afns) {
return function () {
for (var i = 0, len = afns.length; i < len; i++) {
try {
afns[i].apply(inst, arguments);
} catch (e) {
_global.console && console.error(e);
}
}
};
}(afns));
}
}
}
});
};
BI.Models = BI.Models || {
getModel: function (type, config) {
if (!modelInjection[type]) {
_global.console && console.error("model: [" + type + "] 未定义");
}
runConfigFunction(type);
var inst = new modelInjection[type](config);
inst._constructor && inst._constructor(config);
inst.mixins && callPoint(inst, inst.mixins);
callPoint(inst, type);
return inst;
}
};
var stores = {};
BI.Stores = BI.Stores || {
getStore: function (type, config) {
if (!storeInjection[type]) {
_global.console && console.error("store: [" + type + "] 未定义");
}
if (stores[type]) {
return stores[type];
}
var inst = stores[type] = new storeInjection[type](config);
inst._constructor && inst._constructor(config, function () {
delete stores[type];
});
callPoint(inst, type);
return inst;
}
};
var services = {};
BI.Services = BI.Services || {
getService: function (type, config) {
if (!serviceInjection[type]) {
_global.console && console.error("service: [" + type + "] 未定义");
}
if (services[type]) {
return services[type];
}
services[type] = new serviceInjection[type](config);
callPoint(services[type], type);
return services[type];
}
};
var providers = {},
providerInstance = {};
BI.Providers = BI.Providers || {
getProvider: function (type, config) {
if (!providerInjection[type]) {
_global.console && console.error("provider: [" + type + "] 未定义");
}
runConfigFunction(type);
if (!providers[type]) {
providers[type] = new providerInjection[type]();
}
if (!providerInstance[type]) {
providerInstance[type] = new (providers[type].$get())(config);
}
return providerInstance[type];
}
};
BI.Actions = BI.Actions || {
runAction: function (type, event, config) {
BI.each(actions[type], function (i, act) {
try {
act(event, config);
} catch (e) {
_global.console && console.error(e);
}
});
},
runGlobalAction: function () {
var args = [].slice.call(arguments);
BI.each(globalAction, function (i, act) {
try {
act.apply(null, args);
} catch (e) {
_global.console && console.error(e);
}
});
}
};
BI.getResource = BI.getResource || function (type, config) {
if (BI.isNotNull(constantInjection[type])) {
return BI.Constants.getConstant(type);
}
if (modelInjection[type]) {
return BI.Models.getModel(type, config);
}
if (storeInjection[type]) {
return BI.Stores.getStore(type, config);
}
if (serviceInjection[type]) {
return BI.Services.getService(type, config);
}
if (providerInjection[type]) {
return BI.Providers.getProvider(type, config);
}
throw new Error("未知类型: [" + type + "] 未定义");
};
})();
/***/ }),
/***/ 162:
/***/ (function(module, exports) {
BI.prepares.push(function () {
BI.Date = BI.Date || {};
// 牵扯到国际化这些常量在页面加载后再生效
// full day names
BI.Date._DN = [BI.i18nText("BI-Basic_Sunday"),
BI.i18nText("BI-Basic_Monday"),
BI.i18nText("BI-Basic_Tuesday"),
BI.i18nText("BI-Basic_Wednesday"),
BI.i18nText("BI-Basic_Thursday"),
BI.i18nText("BI-Basic_Friday"),
BI.i18nText("BI-Basic_Saturday"),
BI.i18nText("BI-Basic_Sunday")];
// short day names
BI.Date._SDN = [BI.i18nText("BI-Basic_Simple_Sunday"),
BI.i18nText("BI-Basic_Simple_Monday"),
BI.i18nText("BI-Basic_Simple_Tuesday"),
BI.i18nText("BI-Basic_Simple_Wednesday"),
BI.i18nText("BI-Basic_Simple_Thursday"),
BI.i18nText("BI-Basic_Simple_Friday"),
BI.i18nText("BI-Basic_Simple_Saturday"),
BI.i18nText("BI-Basic_Simple_Sunday")];
// Monday first, etc.
BI.Date._FD = 1;
// full month namesdat
BI.Date._MN = [
BI.i18nText("BI-Basic_January"),
BI.i18nText("BI-Basic_February"),
BI.i18nText("BI-Basic_March"),
BI.i18nText("BI-Basic_April"),
BI.i18nText("BI-Basic_May"),
BI.i18nText("BI-Basic_June"),
BI.i18nText("BI-Basic_July"),
BI.i18nText("BI-Basic_August"),
BI.i18nText("BI-Basic_September"),
BI.i18nText("BI-Basic_October"),
BI.i18nText("BI-Basic_November"),
BI.i18nText("BI-Basic_December")];
// short month names
BI.Date._SMN = [0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11];
BI.Date._QN = ["", BI.i18nText("BI-Quarter_1"),
BI.i18nText("BI-Quarter_2"),
BI.i18nText("BI-Quarter_3"),
BI.i18nText("BI-Quarter_4")];
/** Adds the number of days array to the Date object. */
BI.Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// 实际上无论周几作为一周的第一天,周初周末都是在-6-0间做偏移,用一个数组就可以
BI.Date._OFFSET = [0, -1, -2, -3, -4, -5, -6];
});
/***/ }),
/***/ 163:
/***/ (function(module, exports) {
/**
* 事件集合
* @class BI.Events
*/
_.extend(BI, {
Events: {
/**
* @static
* @property keydown事件
*/
KEYDOWN: "_KEYDOWN",
/**
* @static
* @property 回撤事件
*/
BACKSPACE: "_BACKSPACE",
/**
* @static
* @property 空格事件
*/
SPACE: "_SPACE",
/**
* @static
* @property 回车事件
*/
ENTER: "_ENTER",
/**
* @static
* @property 确定事件
*/
CONFIRM: "_CONFIRM",
/**
* @static
* @property 错误事件
*/
ERROR: "_ERROR",
/**
* @static
* @property 暂停事件
*/
PAUSE: "_PAUSE",
/**
* @static
* @property destroy事件
*/
DESTROY: "_DESTROY",
/**
* @static
* @property 挂载事件
*/
MOUNT: "_MOUNT",
/**
* @static
* @property 取消挂载事件
*/
UNMOUNT: "_UNMOUNT",
/**
* @static
* @property 清除选择
*/
CLEAR: "_CLEAR",
/**
* @static
* @property 添加数据
*/
ADD: "_ADD",
/**
* @static
* @property 正在编辑状态事件
*/
EDITING: "_EDITING",
/**
* @static
* @property 空状态事件
*/
EMPTY: "_EMPTY",
/**
* @static
* @property 显示隐藏事件
*/
VIEW: "_VIEW",
/**
* @static
* @property 窗体改变大小
*/
RESIZE: "_RESIZE",
/**
* @static
* @property 编辑前事件
*/
BEFOREEDIT: "_BEFOREEDIT",
/**
* @static
* @property 编辑后事件
*/
AFTEREDIT: "_AFTEREDIT",
/**
* @static
* @property 开始编辑事件
*/
STARTEDIT: "_STARTEDIT",
/**
* @static
* @property 停止编辑事件
*/
STOPEDIT: "_STOPEDIT",
/**
* @static
* @property 值改变事件
*/
CHANGE: "_CHANGE",
/**
* @static
* @property 下拉弹出菜单事件
*/
EXPAND: "_EXPAND",
/**
* @static
* @property 关闭下拉菜单事件
*/
COLLAPSE: "_COLLAPSE",
/**
* @static
* @property 回调事件
*/
CALLBACK: "_CALLBACK",
/**
* @static
* @property 点击事件
*/
CLICK: "_CLICK",
/**
* @static
* @property 状态改变事件一般是用在复选按钮和单选按钮
*/
STATECHANGE: "_STATECHANGE",
/**
* @static
* @property 状态改变前事件
*/
BEFORESTATECHANGE: "_BEFORESTATECHANGE",
/**
* @static
* @property 初始化事件
*/
INIT: "_INIT",
/**
* @static
* @property 初始化后事件
*/
AFTERINIT: "_AFTERINIT",
/**
* @static
* @property 滚动条滚动事件
*/
SCROLL: "_SCROLL",
/**
* @static
* @property 开始加载事件
*/
STARTLOAD: "_STARTLOAD",
/**
* @static
* @property 加载后事件
*/
AFTERLOAD: "_AFTERLOAD",
/**
* @static
* @property 提交前事件
*/
BS: "beforesubmit",
/**
* @static
* @property 提交后事件
*/
AS: "aftersubmit",
/**
* @static
* @property 提交完成事件
*/
SC: "submitcomplete",
/**
* @static
* @property 提交失败事件
*/
SF: "submitfailure",
/**
* @static
* @property 提交成功事件
*/
SS: "submitsuccess",
/**
* @static
* @property 校验提交前事件
*/
BVW: "beforeverifywrite",
/**
* @static
* @property 校验提交后事件
*/
AVW: "afterverifywrite",
/**
* @static
* @property 校验后事件
*/
AV: "afterverify",
/**
* @static
* @property 填报前事件
*/
BW: "beforewrite",
/**
* @static
* @property 填报后事件
*/
AW: "afterwrite",
/**
* @static
* @property 填报成功事件
*/
WS: "writesuccess",
/**
* @static
* @property 填报失败事件
*/
WF: "writefailure",
/**
* @static
* @property 添加行前事件
*/
BA: "beforeappend",
/**
* @static
* @property 添加行后事件
*/
AA: "afterappend",
/**
* @static
* @property 删除行前事件
*/
BD: "beforedelete",
/**
* @static
* @property 删除行后事件
*/
AD: "beforedelete",
/**
* @static
* @property 未提交离开事件
*/
UC: "unloadcheck",
/**
* @static
* @property PDF导出前事件
*/
BTOPDF: "beforetopdf",
/**
* @static
* @property PDF导出后事件
*/
ATOPDF: "aftertopdf",
/**
* @static
* @property Excel导出前事件
*/
BTOEXCEL: "beforetoexcel",
/**
* @static
* @property Excel导出后事件
*/
ATOEXCEL: "aftertoexcel",
/**
* @static
* @property Word导出前事件
*/
BTOWORD: "beforetoword",
/**
* @static
* @property Word导出后事件
*/
ATOWORD: "aftertoword",
/**
* @static
* @property 图片导出前事件
*/
BTOIMAGE: "beforetoimage",
/**
* @static
* @property 图片导出后事件
*/
ATOIMAGE: "aftertoimage",
/**
* @static
* @property HTML导出前事件
*/
BTOHTML: "beforetohtml",
/**
* @static
* @property HTML导出后事件
*/
ATOHTML: "aftertohtml",
/**
* @static
* @property Excel导入前事件
*/
BIMEXCEL: "beforeimportexcel",
/**
* @static
* @property Excel导出后事件
*/
AIMEXCEL: "afterimportexcel",
/**
* @static
* @property PDF打印前事件
*/
BPDFPRINT: "beforepdfprint",
/**
* @static
* @property PDF打印后事件
*/
APDFPRINT: "afterpdfprint",
/**
* @static
* @property Flash打印前事件
*/
BFLASHPRINT: "beforeflashprint",
/**
* @static
* @property Flash打印后事件
*/
AFLASHPRINT: "afterflashprint",
/**
* @static
* @property Applet打印前事件
*/
BAPPLETPRINT: "beforeappletprint",
/**
* @static
* @property Applet打印后事件
*/
AAPPLETPRINT: "afterappletprint",
/**
* @static
* @property 服务器打印前事件
*/
BSEVERPRINT: "beforeserverprint",
/**
* @static
* @property 服务器打印后事件
*/
ASERVERPRINT: "afterserverprint",
/**
* @static
* @property 邮件发送前事件
*/
BEMAIL: "beforeemail",
/**
* @static
* @property 邮件发送后事件
*/
AEMAIL: "afteremail"
}
});
/***/ }),
/***/ 164:
/***/ (function(module, exports) {
/**
* 常量
*/
_.extend(BI, {
MAX: 0xfffffffffffffff,
MIN: -0xfffffffffffffff,
EVENT_RESPONSE_TIME: 200,
zIndex_layer: 1e5,
zIndex_popover: 1e6,
zIndex_popup: 1e7,
zIndex_masker: 1e8,
zIndex_tip: 1e9,
emptyStr: "",
pixUnit: "px",
pixRatio: 1,
emptyFn: function () {
},
empty: null,
Key: {
48: "0",
49: "1",
50: "2",
51: "3",
52: "4",
53: "5",
54: "6",
55: "7",
56: "8",
57: "9",
65: "a",
66: "b",
67: "c",
68: "d",
69: "e",
70: "f",
71: "g",
72: "h",
73: "i",
74: "j",
75: "k",
76: "l",
77: "m",
78: "n",
79: "o",
80: "p",
81: "q",
82: "r",
83: "s",
84: "t",
85: "u",
86: "v",
87: "w",
88: "x",
89: "y",
90: "z",
96: "0",
97: "1",
98: "2",
99: "3",
100: "4",
101: "5",
102: "6",
103: "7",
104: "8",
105: "9",
106: "*",
107: "+",
109: "-",
110: ".",
111: "/"
},
KeyCode: {
BACKSPACE: 8,
COMMA: 188,
DELETE: 46,
DOWN: 40,
END: 35,
ENTER: 13,
ESCAPE: 27,
HOME: 36,
LEFT: 37,
NUMPAD_ADD: 107,
NUMPAD_DECIMAL: 110,
NUMPAD_DIVIDE: 111,
NUMPAD_ENTER: 108,
NUMPAD_MULTIPLY: 106,
NUMPAD_SUBTRACT: 109,
PAGE_DOWN: 34,
PAGE_UP: 33,
PERIOD: 190,
RIGHT: 39,
SPACE: 32,
TAB: 9,
UP: 38
},
Status: {
SUCCESS: 1,
WRONG: 2,
START: 3,
END: 4,
WAITING: 5,
READY: 6,
RUNNING: 7,
OUTOFBOUNDS: 8,
NULL: -1
},
Direction: {
Top: "top",
Bottom: "bottom",
Left: "left",
Right: "right",
Custom: "custom"
},
Axis: {
Vertical: "vertical",
Horizontal: "horizontal"
},
Selection: {
Default: -2,
None: -1,
Single: 0,
Multi: 1,
All: 2
},
HorizontalAlign: {
Left: "left",
Right: "right",
Center: "center",
Stretch: "stretch"
},
VerticalAlign: {
Middle: "middle",
Top: "top",
Bottom: "bottom",
Stretch: "stretch"
},
StartOfWeek: 1,
BlankSplitChar: "\u200b \u200b",
});
/***/ }),
/***/ 165:
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {(function () {
var _global;
if (typeof window !== "undefined") {
_global = window;
} else if (typeof global !== "undefined") {
_global = global;
} else if (typeof self !== "undefined") {
_global = self;
} else {
_global = this;
}
if (!_global.BI) {
_global.BI = {};
}
function isEmpty (value) {
// 判断是否为空值
var result = value === "" || value === null || value === undefined;
return result;
}
// 判断是否是无效的日期
function isInvalidDate (date) {
return date == "Invalid Date" || date == "NaN";
}
/**
* CHART-1400
* 使用数值计算的方式来获取任意数值的科学技术表示值
* 科学计数格式
*/
function _eFormat (text, fmt) {
text = +text;
return eFormat(text, fmt);
/**
* 科学计数格式具体计算过程
* @param num
* @param format {String}有两种形式
* 1"0.00E00"这样的字符串表示正常的科学计数表示只不过规定了数值精确到百分位
* 而数量级的绝对值如果是10以下的时候在前面补零
* 2 "##0.0E0"这样的字符串则规定用科学计数法表示之后的数值的整数部分是三位精确到十分位
* 数量级没有规定因为没见过实数里有用科学计数法表示之后E的后面会小于一位的情况0无所谓
* @returns {*}
*/
function eFormat (num, format) {
var neg = num < 0 ? (num *= -1, "-") : "",
magnitudeNeg = "";
var funcName = num > 0 && num < 1 ? "floor" : "ceil"; // -0.9999->-1
// 数量级
var magnitude = Math[funcName](Math.log(num) / Math.log(10));
if (!isFinite(magnitude)) {
return format.replace(/#/ig, "").replace(/\.e/ig, "E");
}
num = num / Math.pow(10, magnitude);
// 让num转化成[1, 10)区间上的数
if (num > 0 && num < 1) {
num *= 10;
magnitude -= 1;
}
// 计算出format中需要显示的整数部分的位数,然后更新这个数值,也更新数量级
var integerLen = getInteger(magnitude, format);
integerLen > 1 && (magnitude -= integerLen - 1, num *= Math.pow(10, integerLen - 1));
magnitude < 0 && (magnitudeNeg = "-", magnitude *= -1);
// 获取科学计数法精确到的位数
var precision = getPrecision(format);
// 判断num经过四舍五入之后是否有进位
var isValueCarry = isValueCarried(num);
num *= Math.pow(10, precision);
num = Math.round(num);
// 如果出现进位的情况,将num除以10
isValueCarry && (num /= 10, magnitude += magnitudeNeg === "-" ? -1 : 1);
num /= Math.pow(10, precision);
// 小数部分保留precision位
num = num.toFixed(precision);
// 格式化指数的部分
magnitude = formatExponential(format, magnitude, magnitudeNeg);
return neg + num + "E" + magnitude;
}
// 获取format格式规定的数量级的形式
function formatExponential (format, num, magnitudeNeg) {
num += "";
if (!/e/ig.test(format)) {
return num;
}
format = format.split(/e/ig)[1];
while (num.length < format.length) {
num = "0" + num;
}
// 如果magnitudeNeg是一个"-",而且num正好全是0,那么就别显示负号了
var isAllZero = true;
for (var i = 0, len = num.length; i < len; i++) {
if (!isAllZero) {
continue;
}
isAllZero = num.charAt(i) === "0";
}
magnitudeNeg = isAllZero ? "" : magnitudeNeg;
return magnitudeNeg + num;
}
// 获取format规定的科学计数法精确到的位数
function getPrecision (format) {
if (!/e/ig.test(format)) {
return 0;
}
var arr = format.split(/e/ig)[0].split(".");
return arr.length > 1 ? arr[1].length : 0;
}
// 获取数值科学计数法表示之后整数的位数
// 这边我们还需要考虑#和0的问题
function getInteger (magnitude, format) {
if (!/e/ig.test(format)) {
return 0;
}
// return format.split(/e/ig)[0].split(".")[0].length;
var formatLeft = format.split(/e/ig)[0].split(".")[0], i, f, len = formatLeft.length;
var valueLeftLen = 0;
for (i = 0; i < len; i++) {
f = formatLeft.charAt(i);
// "#"所在的位置到末尾长度小于等于值的整数部分长度,那么这个#才可以占位
if (f == 0 || (f == "#" && (len - i <= magnitude + 1))) {
valueLeftLen++;
}
}
return valueLeftLen;
}
// 判断num通过round函数之后是否有进位
function isValueCarried (num) {
var roundNum = Math.round(num);
num = (num + "").split(".")[0];
roundNum = (roundNum + "").split(".")[0];
return num.length !== roundNum.length;
}
}
//'#.##'之类的格式处理 1.324e-18 这种的科学数字
function _dealNumberPrecision (text, fright) {
if (/[eE]/.test(text)) {
var precision = 0, i = 0, ch;
if (/[%‰]$/.test(fright)) {
precision = /[%]$/.test(fright) ? 2 : 3;
}
for (var len = fright.length; i < len; i++) {
if ((ch = fright.charAt(i)) == "0" || ch == "#") {
precision++;
}
}
return Number(text).toFixed(precision);
}
return text;
}
/**
* 数字格式
*/
function _numberFormat (text, format) {
var text = text + "";
//在调用数字格式的时候如果text里没有任何数字则不处理
if (!(/[0-9]/.test(text)) || !format) {
return text;
}
// 数字格式,区分正负数
var numMod = format.indexOf(";");
if (numMod > -1) {
if (text >= 0) {
return _numberFormat(text + "", format.substring(0, numMod));
}
return _numberFormat((-text) + "", format.substr(numMod + 1));
} else {
// 兼容格式处理负数的情况(copy:fr-jquery.format.js)
if (+text < 0 && format.charAt(0) !== "-") {
return _numberFormat((-text) + "", "-" + format);
}
}
var fp = format.split("."), fleft = fp[0] || "", fright = fp[1] || "";
text = _dealNumberPrecision(text, fright);
var tp = text.split("."), tleft = tp[0] || "", tright = tp[1] || "";
// 百分比,千分比的小数点移位处理
if (/[%‰]$/.test(format)) {
var paddingZero = /[%]$/.test(format) ? "00" : "000";
tright += paddingZero;
tleft += tright.substr(0, paddingZero.length);
tleft = tleft.replace(/^0+/gi, "");
tright = tright.substr(paddingZero.length).replace(/0+$/gi, "");
}
var right = _dealWithRight(tright, fright);
if (right.leftPlus) {
// 小数点后有进位
tleft = parseInt(tleft) + 1 + "";
tleft = isNaN(tleft) ? "1" : tleft;
}
right = right.num;
var left = _dealWithLeft(tleft, fleft);
if (!(/[0-9]/.test(left))) {
left = left + "0";
}
if (!(/[0-9]/.test(right))) {
return left + right;
} else {
return left + "." + right;
}
}
/**
* 处理小数点右边小数部分
* @param tright 右边内容
* @param fright 右边格式
* @returns {JSON} 返回处理结果和整数部分是否需要进位
* @private
*/
function _dealWithRight (tright, fright) {
var right = "", j = 0, i = 0;
for (var len = fright.length; i < len; i++) {
var ch = fright.charAt(i);
var c = tright.charAt(j);
switch (ch) {
case "0":
if (isEmpty(c)) {
c = "0";
}
right += c;
j++;
break;
case "#":
right += c;
j++;
break;
default :
right += ch;
break;
}
}
var rll = tright.substr(j);
var result = {};
if (!isEmpty(rll) && rll.charAt(0) > 4) {
// 有多余字符,需要四舍五入
result.leftPlus = true;
var numReg = right.match(/^[0-9]+/);
if (numReg) {
var num = numReg[0];
var orilen = num.length;
var newnum = parseInt(num) + 1 + "";
// 进位到整数部分
if (newnum.length > orilen) {
newnum = newnum.substr(1);
} else {
newnum = BI.leftPad(newnum, orilen, "0");
result.leftPlus = false;
}
right = right.replace(/^[0-9]+/, newnum);
}
}
result.num = right;
return result;
}
/**
* 处理小数点左边整数部分
* @param tleft 左边内容
* @param fleft 左边格式
* @returns {string} 返回处理结果
* @private
*/
function _dealWithLeft (tleft, fleft) {
var left = "";
var j = tleft.length - 1;
var combo = -1, last = -1;
var i = fleft.length - 1;
for (; i >= 0; i--) {
var ch = fleft.charAt(i);
var c = tleft.charAt(j);
switch (ch) {
case "0":
if (isEmpty(c)) {
c = "0";
}
last = -1;
left = c + left;
j--;
break;
case "#":
last = i;
left = c + left;
j--;
break;
case ",":
if (!isEmpty(c)) {
// 计算一个,分隔区间的长度
var com = fleft.match(/,[#0]+/);
if (com) {
combo = com[0].length - 1;
}
left = "," + left;
}
break;
default :
left = ch + left;
break;
}
}
if (last > -1) {
// 处理剩余字符
var tll = tleft.substr(0, j + 1);
left = left.substr(0, last) + tll + left.substr(last);
}
if (combo > 0) {
// 处理,分隔区间
var res = left.match(/[0-9]+,/);
if (res) {
res = res[0];
var newstr = "", n = res.length - 1 - combo;
for (; n >= 0; n = n - combo) {
newstr = res.substr(n, combo) + "," + newstr;
}
var lres = res.substr(0, n + combo);
if (!isEmpty(lres)) {
newstr = lres + "," + newstr;
}
}
left = left.replace(/[0-9]+,/, newstr);
}
return left;
}
BI.cjkEncode = function (text) {
// alex:如果非字符串,返回其本身(cjkEncode(234) 返回 ""是不对的)
if (typeof text !== "string") {
return text;
}
var newText = "";
for (var i = 0; i < text.length; i++) {
var code = text.charCodeAt(i);
if (code >= 128 || code === 91 || code === 93) {// 91 is "[", 93 is "]".
newText += "[" + code.toString(16) + "]";
} else {
newText += text.charAt(i);
}
}
return newText;
};
/**
* 将cjkEncode处理过的字符串转化为原始字符串
*
* @static
* @param text 需要做解码的字符串
* @return {String} 解码后的字符串
*/
BI.cjkDecode = function (text) {
if (text == null) {
return "";
}
// 查找没有 "[", 直接返回. kunsnat:数字的时候, 不支持indexOf方法, 也是直接返回.
if (!isNaN(text) || text.indexOf("[") == -1) {
return text;
}
var newText = "";
for (var i = 0; i < text.length; i++) {
var ch = text.charAt(i);
if (ch == "[") {
var rightIdx = text.indexOf("]", i + 1);
if (rightIdx > i + 1) {
var subText = text.substring(i + 1, rightIdx);
// james:主要是考虑[CDATA[]]这样的值的出现
if (subText.length > 0) {
ch = String.fromCharCode(eval("0x" + subText));
}
i = rightIdx;
}
}
newText += ch;
}
return newText;
};
// replace the html special tags
var SPECIAL_TAGS = {
"&": "&amp;",
"\"": "&quot;",
"<": "&lt;",
">": "&gt;",
" ": "&nbsp;"
};
BI.htmlEncode = function (text) {
return BI.isNull(text) ? "" : BI.replaceAll(text + "", "&|\"|<|>|\\s", function (v) {
return SPECIAL_TAGS[v] ? SPECIAL_TAGS[v] : "&nbsp;";
});
};
// html decode
BI.htmlDecode = function (text) {
return BI.isNull(text) ? "" : BI.replaceAll(text + "", "&amp;|&quot;|&lt;|&gt;|&nbsp;", function (v) {
switch (v) {
case "&amp;":
return "&";
case "&quot;":
return "\"";
case "&lt;":
return "<";
case "&gt;":
return ">";
case "&nbsp;":
default:
return " ";
}
});
};
BI.cjkEncodeDO = function (o) {
if (BI.isPlainObject(o)) {
var result = {};
_.each(o, function (v, k) {
if (!(typeof v === "string")) {
v = BI.jsonEncode(v);
}
// wei:bug 43338,如果key是中文,cjkencode后o的长度就加了1,ie9以下版本死循环,所以新建对象result。
k = BI.cjkEncode(k);
result[k] = BI.cjkEncode(v);
});
return result;
}
return o;
};
BI.jsonEncode = function (o) {
// james:这个Encode是抄的EXT的
var useHasOwn = !!{}.hasOwnProperty;
// crashes Safari in some instances
// var validRE = /^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/;
var m = {
"\b": "\\b",
"\t": "\\t",
"\n": "\\n",
"\f": "\\f",
"\r": "\\r",
"\"": "\\\"",
"\\": "\\\\"
};
var encodeString = function (s) {
if (/["\\\x00-\x1f]/.test(s)) {
return "\"" + s.replace(/([\x00-\x1f\\"])/g, function (a, b) {
var c = m[b];
if (c) {
return c;
}
c = b.charCodeAt();
return "\\u00" +
Math.floor(c / 16).toString(16) +
(c % 16).toString(16);
}) + "\"";
}
return "\"" + s + "\"";
};
var encodeArray = function (o) {
var a = ["["], b, i, l = o.length, v;
for (i = 0; i < l; i += 1) {
v = o[i];
switch (typeof v) {
case "undefined":
case "function":
case "unknown":
break;
default:
if (b) {
a.push(",");
}
a.push(v === null ? "null" : BI.jsonEncode(v));
b = true;
}
}
a.push("]");
return a.join("");
};
if (typeof o === "undefined" || o === null) {
return "null";
} else if (BI.isArray(o)) {
return encodeArray(o);
} else if (o instanceof Date) {
/*
* alex:原来只是把年月日时分秒简单地拼成一个String,无法decode
* 现在这么处理就可以decode了,但是JS.jsonDecode和Java.JSONObject也要跟着改一下
*/
return BI.jsonEncode({
__time__: o.getTime()
});
} else if (typeof o === "string") {
return encodeString(o);
} else if (typeof o === "number") {
return isFinite(o) ? String(o) : "null";
} else if (typeof o === "boolean") {
return String(o);
} else if (BI.isFunction(o)) {
return String(o);
}
var a = ["{"], b, i, v;
for (i in o) {
if (!useHasOwn || o.hasOwnProperty(i)) {
v = o[i];
switch (typeof v) {
case "undefined":
case "unknown":
break;
default:
if (b) {
a.push(",");
}
a.push(BI.jsonEncode(i), ":",
v === null ? "null" : BI.jsonEncode(v));
b = true;
}
}
}
a.push("}");
return a.join("");
};
BI.jsonDecode = function (text) {
try {
// 注意0啊
// var jo = $.parseJSON(text) || {};
var jo = BI.$ ? BI.$.parseJSON(text) : _global.JSON.parse(text);
if (jo == null) {
jo = {};
}
} catch (e) {
/*
* richie:浏览器只支持标准的JSON字符串转换而jQuery会默认调用浏览器的window.JSON.parse()函数进行解析
* 比如var str = "{'a':'b'}",这种形式的字符串转换为JSON就会抛异常
*/
try {
jo = new Function("return " + text)() || {};
} catch (e) {
// do nothing
}
if (jo == null) {
jo = [];
}
}
if (!_hasDateInJson(text)) {
return jo;
}
function _hasDateInJson (json) {
if (!json || typeof json !== "string") {
return false;
}
return json.indexOf("__time__") != -1;
}
return (function (o) {
if (typeof o === "string") {
return o;
}
if (o && o.__time__ != null) {
return new Date(o.__time__);
}
for (var a in o) {
if (o[a] == o || typeof o[a] === "object" || _.isFunction(o[a])) {
break;
}
o[a] = arguments.callee(o[a]);
}
return o;
})(jo);
};
/**
* 获取编码后的url
* @param urlTemplate url模板
* @param param 参数
* @returns {*|String}
* @example
* BI.getEncodeURL("design/{tableName}/{fieldName}",{tableName: "A", fieldName: "a"}) // design/A/a
*/
BI.getEncodeURL = function (urlTemplate, param) {
return BI.replaceAll(urlTemplate, "\\{(.*?)\\}", function (ori, str) {
return BI.encodeURIComponent(BI.isObject(param) ? param[str] : param);
});
};
BI.encodeURIComponent = function (url) {
BI.specialCharsMap = BI.specialCharsMap || {};
url = url || "";
url = BI.replaceAll(url + "", BI.keys(BI.specialCharsMap || []).join("|"), function (str) {
switch (str) {
case "\\":
return BI.specialCharsMap["\\\\"] || str;
default:
return BI.specialCharsMap[str] || str;
}
});
return _global.encodeURIComponent(url);
};
BI.decodeURIComponent = function (url) {
var reserveSpecialCharsMap = {};
BI.each(BI.specialCharsMap, function (initialChar, encodeChar) {
reserveSpecialCharsMap[encodeChar] = initialChar === "\\\\" ? "\\" : initialChar;
});
url = url || "";
url = BI.replaceAll(url + "", BI.keys(reserveSpecialCharsMap || []).join("|"), function (str) {
return reserveSpecialCharsMap[str] || str;
});
return _global.decodeURIComponent(url);
};
BI.contentFormat = function (cv, fmt) {
if (isEmpty(cv)) {
// 原值为空,返回空字符
return "";
}
var text = cv.toString();
if (isEmpty(fmt)) {
// 格式为空,返回原字符
return text;
}
if (fmt.match(/^T/)) {
// T - 文本格式
return text;
} else if (fmt.match(/^D/)) {
// D - 日期(时间)格式
if (!(cv instanceof Date)) {
if (typeof cv === "number") {
// 毫秒数类型
cv = new Date(cv);
} else {
//字符串类型转化为date类型
cv = new Date(Date.parse(("" + cv).replace(/-|\./g, "/")));
}
}
if (!isInvalidDate(cv) && !BI.isNull(cv)) {
var needTrim = fmt.match(/^DT/);
text = BI.date2Str(cv, fmt.substring(needTrim ? 2 : 1));
}
} else if (fmt.match(/E/)) {
// 科学计数格式
text = _eFormat(text, fmt);
} else {
// 数字格式
text = _numberFormat(text, fmt);
}
// ¤ - 货币格式
text = text.replace(/¤/g, "¥");
return text;
};
/**
* 将Java提供的日期格式字符串装换为JS识别的日期格式字符串
* @class FR.parseFmt
* @param fmt 日期格式
* @returns {String}
*/
BI.parseFmt = function (fmt) {
if (!fmt) {
return "";
}
//日期
fmt = String(fmt)
//年
.replace(/y{4,}/g, "%Y")//yyyy的时候替换为Y
.replace(/y{2}/g, "%y")//yy的时候替换为y
//月
.replace(/M{4,}/g, "%b")//MMMM的时候替换为b,八
.replace(/M{3}/g, "%B")//MMM的时候替换为M,八月
.replace(/M{2}/g, "%X")//MM的时候替换为X,08
.replace(/M{1}/g, "%x")//M的时候替换为x,8
.replace(/a{1}/g, "%p");
//天
if (new RegExp("d{2,}", "g").test(fmt)) {
fmt = fmt.replace(/d{2,}/g, "%d");//dd的时候替换为d
} else {
fmt = fmt.replace(/d{1}/g, "%e");//d的时候替换为j
}
//时
if (new RegExp("h{2,}", "g").test(fmt)) {//12小时制
fmt = fmt.replace(/h{2,}/g, "%I");
} else {
fmt = fmt.replace(/h{1}/g, "%I");
}
if (new RegExp("H{2,}", "g").test(fmt)) {//24小时制
fmt = fmt.replace(/H{2,}/g, "%H");
} else {
fmt = fmt.replace(/H{1}/g, "%H");
}
fmt = fmt.replace(/m{2,}/g, "%M")//分
//秒
.replace(/s{2,}/g, "%S");
return fmt;
};
/**
* 把字符串按照对应的格式转化成日期对象
*
* @example
* var result = BI.str2Date('2013-12-12', 'yyyy-MM-dd');//Thu Dec 12 2013 00:00:00 GMT+0800
*
* @class BI.str2Date
* @param str 字符串
* @param format 日期格式
* @returns {*}
*/
BI.str2Date = function (str, format) {
if (typeof str != "string" || typeof format != "string") {
return null;
}
var fmt = BI.parseFmt(format);
return BI.parseDateTime(str, fmt);
};
/**
* 把日期对象按照指定格式转化成字符串
*
* @example
* var date = new Date('Thu Dec 12 2013 00:00:00 GMT+0800');
* var result = BI.date2Str(date, 'yyyy-MM-dd');//2013-12-12
*
* @class BI.date2Str
* @param date 日期
* @param format 日期格式
* @returns {String}
*/
BI.date2Str = function (date, format) {
if (!date) {
return "";
}
// O(len(format))
var len = format.length, result = "";
if (len > 0) {
var flagch = format.charAt(0), start = 0, str = flagch;
for (var i = 1; i < len; i++) {
var ch = format.charAt(i);
if (flagch !== ch) {
result += compileJFmt({
char: flagch,
str: str,
len: i - start
}, date);
flagch = ch;
start = i;
str = flagch;
} else {
str += ch;
}
}
result += compileJFmt({
char: flagch,
str: str,
len: len - start
}, date);
}
return result;
function compileJFmt (jfmt, date) {
var str = jfmt.str, len = jfmt.len, ch = jfmt["char"];
switch (ch) {
case "E": // 星期
str = BI.Date._DN[date.getDay()];
break;
case "y": // 年
if (len <= 3) {
str = (date.getFullYear() + "").slice(2, 4);
} else {
str = date.getFullYear();
}
break;
case "M": // 月
if (len > 2) {
str = BI.Date._MN[date.getMonth()];
} else if (len < 2) {
str = date.getMonth() + 1;
} else {
str = BI.leftPad(date.getMonth() + 1 + "", 2, "0");
}
break;
case "d": // 日
if (len > 1) {
str = BI.leftPad(date.getDate() + "", 2, "0");
} else {
str = date.getDate();
}
break;
case "h": // 时(12)
var hour = date.getHours() % 12;
if (hour === 0) {
hour = 12;
}
if (len > 1) {
str = BI.leftPad(hour + "", 2, "0");
} else {
str = hour;
}
break;
case "H": // 时(24)
if (len > 1) {
str = BI.leftPad(date.getHours() + "", 2, "0");
} else {
str = date.getHours();
}
break;
case "m":
if (len > 1) {
str = BI.leftPad(date.getMinutes() + "", 2, "0");
} else {
str = date.getMinutes();
}
break;
case "s":
if (len > 1) {
str = BI.leftPad(date.getSeconds() + "", 2, "0");
} else {
str = date.getSeconds();
}
break;
case "a":
str = date.getHours() < 12 ? "am" : "pm";
break;
case "z":
str = BI.getTimezone(date);
break;
default:
str = jfmt.str;
break;
}
return str;
}
};
BI.object2Number = function (value) {
if (value == null) {
return 0;
}
if (typeof value === "number") {
return value;
}
var str = value + "";
if (str.indexOf(".") === -1) {
return parseInt(str);
}
return parseFloat(str);
};
BI.object2Date = function (obj) {
if (obj == null) {
return new Date();
}
if (obj instanceof Date) {
return obj;
} else if (typeof obj === "number") {
return new Date(obj);
}
var str = obj + "";
str = str.replace(/-/g, "/");
var dt = new Date(str);
if (!isInvalidDate(dt)) {
return dt;
}
return new Date();
};
BI.object2Time = function (obj) {
if (obj == null) {
return new Date();
}
if (obj instanceof Date) {
return obj;
}
var str = obj + "";
str = str.replace(/-/g, "/");
var dt = new Date(str);
if (!isInvalidDate(dt)) {
return dt;
}
if (str.indexOf("/") === -1 && str.indexOf(":") !== -1) {
dt = new Date("1970/01/01 " + str);
if (!isInvalidDate(dt)) {
return dt;
}
}
dt = BI.parseDateTime(str, "HH:mm:ss");
if (!isInvalidDate(dt)) {
return dt;
}
return new Date();
};
})();
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(15)))
/***/ }),
/***/ 166:
/***/ (function(module, exports) {
/**
* 对数组对象的扩展
* @class Array
*/
_.extend(BI, {
pushArray: function (sArray, array) {
for (var i = 0; i < array.length; i++) {
sArray.push(array[i]);
}
},
pushDistinct: function (sArray, obj) {
if (!BI.contains(sArray, obj)) {
sArray.push(obj);
}
},
pushDistinctArray: function (sArray, array) {
for (var i = 0, len = array.length; i < len; i++) {
BI.pushDistinct(sArray, array[i]);
}
}
});
/***/ }),
/***/ 167:
/***/ (function(module, exports) {
/** Constants used for time computations */
BI.Date = BI.Date || {};
BI.Date.SECOND = 1000;
BI.Date.MINUTE = 60 * BI.Date.SECOND;
BI.Date.HOUR = 60 * BI.Date.MINUTE;
BI.Date.DAY = 24 * BI.Date.HOUR;
BI.Date.WEEK = 7 * BI.Date.DAY;
_.extend(BI, {
/**
* 获取时区
* @returns {String}
*/
getTimezone: function (date) {
return date.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, "");
},
/** Returns the number of days in the current month */
getMonthDays: function (date, month) {
var year = date.getFullYear();
if (typeof month === "undefined") {
month = date.getMonth();
}
if (((0 == (year % 4)) && ((0 != (year % 100)) || (0 == (year % 400)))) && month == 1) {
return 29;
}
return BI.Date._MD[month];
},
/**
* 获取每月的最后一天
* @returns {Date}
*/
getLastDateOfMonth: function (date) {
return BI.getDate(date.getFullYear(), date.getMonth(), BI.getMonthDays(date));
},
/** Returns the number of day in the year. */
getDayOfYear: function (date) {
var now = BI.getDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
var then = BI.getDate(date.getFullYear(), 0, 0, 0, 0, 0);
var time = now - then;
return Math.floor(time / BI.Date.DAY);
},
/** Returns the number of the week in year, as defined in ISO 8601. */
getWeekNumber: function (date) {
var d = BI.getDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
var week = d.getDay();
var startOfWeek = BI.StartOfWeek % 7;
var middleDay = (startOfWeek + 3) % 7;
middleDay = middleDay || 7;
// 偏移到周周首之前需要多少天
var offsetWeekStartCount = week < startOfWeek ? (7 + week - startOfWeek) : (week - startOfWeek);
var offsetWeekMiddleCount = middleDay < startOfWeek ? (7 + middleDay - startOfWeek) : (middleDay - startOfWeek);
d.setDate(d.getDate() - offsetWeekStartCount + offsetWeekMiddleCount);
var ms = d.valueOf();
d.setMonth(0);
d.setDate(1);
return Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1;
},
getQuarter: function (date) {
return Math.floor(date.getMonth() / 3) + 1;
},
7 years ago
// 离当前时间多少天的时间
getOffsetDate: function (date, offset) {
return BI.getDate(BI.getTime(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()) + offset * 864e5);
},
getOffsetQuarter: function (date, n) {
var dt = BI.getDate(BI.getTime(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()));
var day = dt.getDate();
var monthDay = BI.getMonthDays(BI.getDate(dt.getFullYear(), dt.getMonth() + BI.parseInt(n) * 3, 1));
if (day > monthDay) {
day = monthDay;
}
dt.setDate(day);
dt.setMonth(dt.getMonth() + parseInt(n) * 3);
return dt;
},
// 得到本季度的起始月份
getQuarterStartMonth: function (date) {
var quarterStartMonth = 0;
var nowMonth = date.getMonth();
if (nowMonth < 3) {
quarterStartMonth = 0;
}
if (2 < nowMonth && nowMonth < 6) {
quarterStartMonth = 3;
}
if (5 < nowMonth && nowMonth < 9) {
quarterStartMonth = 6;
}
if (nowMonth > 8) {
quarterStartMonth = 9;
}
return quarterStartMonth;
},
// 获得本季度的起始日期
getQuarterStartDate: function (date) {
return BI.getDate(date.getFullYear(), BI.getQuarterStartMonth(date), 1);
},
// 得到本季度的结束日期
getQuarterEndDate: function (date) {
var quarterEndMonth = BI.getQuarterStartMonth(date) + 2;
return BI.getDate(date.getFullYear(), quarterEndMonth, BI.getMonthDays(date, quarterEndMonth));
},
// 指定日期n个月之前或之后的日期
getOffsetMonth: function (date, n) {
var dt = BI.getDate(BI.getTime(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()));
var day = dt.getDate();
var monthDay = BI.getMonthDays(BI.getDate(dt.getFullYear(), dt.getMonth() + parseInt(n), 1));
if (day > monthDay) {
day = monthDay;
}
dt.setDate(day);
dt.setMonth(dt.getMonth() + parseInt(n));
return dt;
},
7 years ago
// 获得本周的起始日期
getWeekStartDate: function (date) {
var w = date.getDay();
var startOfWeek = BI.StartOfWeek % 7;
return BI.getOffsetDate(date, BI.Date._OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)]);
},
// 得到本周的结束日期
getWeekEndDate: function (date) {
var w = date.getDay();
var startOfWeek = BI.StartOfWeek % 7;
return BI.getOffsetDate(date, BI.Date._OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)] + 6);
},
// 格式化打印日期
print: function (date, str) {
var m = date.getMonth();
var d = date.getDate();
var y = date.getFullYear();
var yWith4number = y + "";
while (yWith4number.length < 4) {
yWith4number = "0" + yWith4number;
}
var wn = BI.getWeekNumber(date);
var qr = BI.getQuarter(date);
var w = date.getDay();
var s = {};
var hr = date.getHours();
var pm = (hr >= 12);
var ir = (pm) ? (hr - 12) : hr;
var dy = BI.getDayOfYear(date);
if (ir == 0) {
ir = 12;
}
var min = date.getMinutes();
var sec = date.getSeconds();
s["%a"] = BI.Date._SDN[w]; // abbreviated weekday name [FIXME: I18N]
s["%A"] = BI.Date._DN[w]; // full weekday name
s["%b"] = BI.Date._SMN[m]; // abbreviated month name [FIXME: I18N]
s["%B"] = BI.Date._MN[m]; // full month name
// FIXME: %c : preferred date and time representation for the current locale
s["%C"] = 1 + Math.floor(y / 100); // the century number
s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31)
s["%e"] = d; // the day of the month (range 1 to 31)
// FIXME: %D : american date style: %m/%d/%y
// FIXME: %E, %F, %G, %g, %h (man strftime)
s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format)
s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format)
s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366)
s["%k"] = hr + ""; // hour, range 0 to 23 (24h 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 + 1; // month, range 1 to 12
s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59
s["%n"] = "\n"; // a newline character
s["%p"] = pm ? "PM" : "AM";
s["%P"] = pm ? "pm" : "am";
// FIXME: %r : the time in am/pm notation %I:%M:%S %p
// FIXME: %R : the time in 24-hour notation %H:%M
s["%s"] = Math.floor(date.getTime() / 1000);
s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59
s["%t"] = "\t"; // a tab character
// FIXME: %T : the time in 24-hour notation (%H:%M:%S)
s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn;
s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON)
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 time representation for the current locale without the date
s["%y"] = yWith4number.substr(2, 2); // year without the century (range 00 to 99)
s["%Y"] = yWith4number; // year with the century
s["%%"] = "%"; // a literal '%' character
s["%q"] = "0" + qr;
s["%Q"] = qr;
var re = /%./g;
BI.isKhtml = BI.isKhtml || function () {
if(!_global.navigator) {
return false;
}
return /Konqueror|Safari|KHTML/i.test(navigator.userAgent);
};
// 包含年周的格式化,ISO8601标准周的计数会影响年
if ((str.indexOf("%Y") !== -1 || str.indexOf("%y") !== -1) && (str.indexOf("%W") !== -1 || str.indexOf("%U") !== -1 || str.indexOf("%V") !== -1)) {
switch (wn) {
// 如果周数是1,但是当前却在12月,表示此周数为下一年的
case 1:
if (m === 11) {
s["%y"] = parseInt(s["%y"]) + 1;
s["%Y"] = parseInt(s["%Y"]) + 1;
}
break;
// 如果周数是53,但是当前却在1月,表示此周数为上一年的
case 53:
if (m === 0) {
s["%y"] = parseInt(s["%y"]) - 1;
s["%Y"] = parseInt(s["%Y"]) - 1;
}
break;
default:
break;
}
}
if (!BI.isKhtml()) {
return str.replace(re, function (par) {
return s[par] || par;
});
}
var a = str.match(re);
for (var i = 0; i < a.length; i++) {
var tmp = s[a[i]];
if (tmp) {
re = new RegExp(a[i], "g");
str = str.replace(re, tmp);
}
7 years ago
}
return str;
}
});
4 years ago
/***/ }),
7 years ago
/***/ 168:
/***/ (function(module, exports) {
7 years ago
/**
* 基本的函数
* Created by GUY on 2015/6/24.
*/
BI.Func = BI.Func || {};
_.extend(BI.Func, {
/**
* 创建唯一的名字
* @param array
* @param name
* @returns {*}
*/
createDistinctName: function (array, name) {
var src = name, idx = 1;
name = name || "";
while (true) {
if (BI.every(array, function (i, item) {
return BI.isKey(item) ? item !== name : item.name !== name;
})) {
break;
}
name = src + (idx++);
}
return name;
},
/**
* 获取字符宽度
* @param str
* @return {number}
*/
getGBWidth: function (str) {
str = str + "";
str = str.replace(/[^\x00-\xff]/g, "xx");
return Math.ceil(str.length / 2);
},
7 years ago
/**
* 获取搜索结果
* @param items
* @param keyword
* @param param 搜索哪个属性
* @param clone 是否需要deepClone
*/
getSearchResult: function (items, keyword, param, clone) {
var isArray = BI.isArray(items);
items = isArray ? BI.flatten(items) : items;
param || (param = "text");
BI.isNull(clone) && (clone = true);
if (!BI.isKey(keyword)) {
return {
find: clone ? BI.deepClone(items) : items,
match: isArray ? [] : {}
};
}
var t, text, py;
keyword = BI.toUpperCase(keyword);
var matched = isArray ? [] : {}, find = isArray ? [] : {};
BI.each(items, function (i, item) {
// 兼容item为null的处理
if (BI.isNull(item)) {
return;
}
clone && (item = BI.deepClone(item));
t = BI.stripEL(item);
text = BI.find([t[param], t.text, t.value, t.name, t], function (index, val) {
return BI.isNotNull(val);
});
7 years ago
if (BI.isNull(text) || BI.isObject(text)) return;
7 years ago
py = BI.makeFirstPY(text, {
splitChar: "\u200b"
});
text = BI.toUpperCase(text);
py = BI.toUpperCase(py);
var pidx;
if (text.indexOf(keyword) > -1) {
if (text === keyword) {
isArray ? matched.push(item) : (matched[i] = item);
} else {
isArray ? find.push(item) : (find[i] = item);
}
// BI-56386 这边两个pid / text.length是为了防止截取的首字符串不是完整的,但光这样做还不够,即时错位了,也不能说明就不符合条件
} else if (pidx = py.indexOf(keyword), (pidx > -1)) {
if (text === keyword || keyword.length === text.length) {
isArray ? matched.push(item) : (matched[i] = item);
} else {
isArray ? find.push(item) : (find[i] = item);
}
}
});
return {
match: matched,
find: find
};
},
4 years ago
/**
* 获取按GB2312排序的结果
* @param items
* @param key
* @return {any[]}
*/
getSortedResult: function (items, key) {
var getTextOfItem = BI.isFunction(key) ? key :
function (item, key) {
if (BI.isNotNull(key)) {
return item[key];
}
if (BI.isNotNull(item.text)) {
return item.text;
}
if (BI.isNotNull(item.value)) {
return item.value;
}
return item;
};
7 years ago
return items.sort(function (item1, item2) {
var str1 = getTextOfItem(item1, key);
var str2 = getTextOfItem(item2, key);
if (BI.isNull(str1) && BI.isNull(str2)) {
return 0;
}
if (BI.isNull(str1)) {
return -1;
}
if (BI.isNull(str2)) {
return 1;
}
if (str1 === str2) {
return 0;
}
var len1 = str1.length, len2 = str2.length;
for (var i = 0; i < len1 && i < len2; i++) {
var char1 = str1[i];
var char2 = str2[i];
if (char1 !== char2) {
// 找不到的字符都往后面放
return (BI.isNull(BI.CODE_INDEX[char1]) ? BI.MAX : BI.CODE_INDEX[char1]) - (BI.isNull(BI.CODE_INDEX[char2]) ? BI.MAX : BI.CODE_INDEX[char2]);
}
}
return len1 - len2;
});
}
});
_.extend(BI, {
beforeFunc: function (sFunc, func) {
var __self = sFunc;
return function () {
if (func.apply(sFunc, arguments) === false) {
return false;
}
return __self.apply(sFunc, arguments);
};
},
afterFunc: function (sFunc, func) {
var __self = sFunc;
return function () {
var ret = __self.apply(sFunc, arguments);
if (ret === false) {
return false;
}
func.apply(sFunc, arguments);
return ret;
};
}
});
/***/ }),
7 years ago
/***/ 169:
/***/ (function(module, exports) {
7 years ago
_.extend(BI, {
// 给Number类型增加一个add方法,调用起来更加方便。
add: function (num, arg) {
return accAdd(arg, num);
7 years ago
/**
** 加法函数用来得到精确的加法结果
** 说明javascript的加法结果会有误差在两个浮点数相加的时候会比较明显这个函数返回较为精确的加法结果
** 调用accAdd(arg1,arg2)
** 返回值arg1加上arg2的精确结果
**/
function accAdd (arg1, arg2) {
var r1, r2, m, c;
try {
r1 = arg1.toString().split(".")[1].length;
} catch (e) {
r1 = 0;
}
try {
r2 = arg2.toString().split(".")[1].length;
} catch (e) {
r2 = 0;
}
c = Math.abs(r1 - r2);
m = Math.pow(10, Math.max(r1, r2));
if (c > 0) {
var cm = Math.pow(10, c);
if (r1 > r2) {
arg1 = Number(arg1.toString().replace(".", ""));
arg2 = Number(arg2.toString().replace(".", "")) * cm;
} else {
arg1 = Number(arg1.toString().replace(".", "")) * cm;
arg2 = Number(arg2.toString().replace(".", ""));
}
} else {
arg1 = Number(arg1.toString().replace(".", ""));
arg2 = Number(arg2.toString().replace(".", ""));
}
return (arg1 + arg2) / m;
}
},
7 years ago
// 给Number类型增加一个sub方法,调用起来更加方便。
sub: function (num, arg) {
return accSub(num, arg);
7 years ago
/**
** 减法函数用来得到精确的减法结果
** 说明javascript的减法结果会有误差在两个浮点数相减的时候会比较明显这个函数返回较为精确的减法结果
** 调用accSub(arg1,arg2)
** 返回值arg1加上arg2的精确结果
**/
function accSub (arg1, arg2) {
var r1, r2, m, n;
try {
r1 = arg1.toString().split(".")[1].length;
} catch (e) {
r1 = 0;
}
try {
r2 = arg2.toString().split(".")[1].length;
} catch (e) {
r2 = 0;
}
m = Math.pow(10, Math.max(r1, r2)); // last modify by deeka //动态控制精度长度
n = (r1 >= r2) ? r1 : r2;
return ((arg1 * m - arg2 * m) / m).toFixed(n);
}
},
7 years ago
// 给Number类型增加一个mul方法,调用起来更加方便。
mul: function (num, arg) {
return accMul(arg, num);
7 years ago
/**
** 乘法函数用来得到精确的乘法结果
** 说明javascript的乘法结果会有误差在两个浮点数相乘的时候会比较明显这个函数返回较为精确的乘法结果
** 调用accMul(arg1,arg2)
** 返回值arg1乘以 arg2的精确结果
**/
function accMul (arg1, arg2) {
var m = 0, s1 = arg1.toString(), s2 = arg2.toString();
try {
m += s1.split(".")[1].length;
} catch (e) {
}
try {
m += s2.split(".")[1].length;
} catch (e) {
}
return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
}
},
// 给Number类型增加一个div方法,调用起来更加方便。
div: function (num, arg) {
return accDivide(num, arg);
/**
* Return digits length of a number
* @param {*number} num Input number
*/
function digitLength (num) {
// Get digit length of e
var eSplit = num.toString().split(/[eE]/);
var len = (eSplit[0].split(".")[1] || "").length - (+(eSplit[1] || 0));
return len > 0 ? len : 0;
}
/**
* 把小数转成整数支持科学计数法如果是小数则放大成整数
* @param {*number} num 输入数
*/
function float2Fixed (num) {
if (num.toString().indexOf("e") === -1) {
return Number(num.toString().replace(".", ""));
}
var dLen = digitLength(num);
return dLen > 0 ? num * Math.pow(10, dLen) : num;
}
/**
* 精确乘法
*/
function times (num1, num2) {
var others = [];
for (var _i = 2; _i < arguments.length; _i++) {
others[_i - 2] = arguments[_i];
}
if (others.length > 0) {
return times.apply(void 0, [times(num1, num2), others[0]].concat(others.slice(1)));
}
var num1Changed = float2Fixed(num1);
var num2Changed = float2Fixed(num2);
var baseNum = digitLength(num1) + digitLength(num2);
var leftValue = num1Changed * num2Changed;
return leftValue / Math.pow(10, baseNum);
}
/**
* 精确除法
*/
function accDivide (num1, num2) {
var others = [];
for (var _i = 2; _i < arguments.length; _i++) {
others[_i - 2] = arguments[_i];
}
if (others.length > 0) {
return accDivide.apply(void 0, [accDivide(num1, num2), others[0]].concat(others.slice(1)));
}
var num1Changed = float2Fixed(num1);
var num2Changed = float2Fixed(num2);
return times((num1Changed / num2Changed), Math.pow(10, digitLength(num2) - digitLength(num1)));
7 years ago
}
}
7 years ago
});
7 years ago
/***/ }),
7 years ago
/***/ 170:
/***/ (function(module, exports) {
7 years ago
/**
* 对字符串对象的扩展
* @class String
*/
_.extend(BI, {
7 years ago
/**
* 判断字符串是否已指定的字符串开始
* @param str source字符串
* @param {String} startTag 指定的开始字符串
* @return {Boolean} 如果字符串以指定字符串开始则返回true否则返回false
*/
startWith: function (str, startTag) {
str = str || "";
if (startTag == null || startTag == "" || str.length === 0 || startTag.length > str.length) {
return false;
}
return str.substr(0, startTag.length) == startTag;
},
/**
* 判断字符串是否以指定的字符串结束
* @param str source字符串
* @param {String} endTag 指定的字符串
* @return {Boolean} 如果字符串以指定字符串结束则返回true否则返回false
*/
endWith: function (str, endTag) {
if (endTag == null || endTag == "" || str.length === 0 || endTag.length > str.length) {
return false;
}
return str.substring(str.length - endTag.length) == endTag;
},
/**
* 获取url中指定名字的参数
* @param str source字符串
* @param {String} name 参数的名字
* @return {String} 参数的值
*/
getQuery: function (str, name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = str.substr(str.indexOf("?") + 1).match(reg);
if (r) {
return unescape(r[2]);
}
return null;
},
/**
* 给url加上给定的参数
* @param str source字符串
* @param {Object} paras 参数对象是一个键值对对象
* @return {String} 添加了给定参数的url
*/
appendQuery: function (str, paras) {
if (!paras) {
return str;
}
var src = str;
// 没有问号说明还没有参数
if (src.indexOf("?") === -1) {
src += "?";
}
// 如果以问号结尾,说明没有其他参数
if (BI.endWith(src, "?") !== false) {
} else {
src += "&";
}
_.each(paras, function (value, name) {
if (typeof(name) === "string") {
src += name + "=" + value + "&";
}
});
src = src.substr(0, src.length - 1);
return src;
},
/**
* 将所有符合第一个字符串所表示的字符串替换成为第二个字符串
* @param str source字符串
* @param {String} s1 要替换的字符串的正则表达式
* @param {String} s2 替换的结果字符串
* @returns {String} 替换后的字符串
*/
replaceAll: function (str, s1, s2) {
return BI.isString(str) ? str.replace(new RegExp(s1, "gm"), s2) : str;
},
/**
* 总是让字符串以指定的字符开头
* @param str source字符串
* @param {String} start 指定的字符
* @returns {String} 以指定字符开头的字符串
*/
perfectStart: function (str, start) {
if (BI.startWith(str, start)) {
return str;
}
return start + str;
},
/**
* 获取字符串中某字符串的所有项位置数组
* @param str source字符串
* @param {String} sub 子字符串
* @return {Number[]} 子字符串在父字符串中出现的所有位置组成的数组
*/
allIndexOf: function (str, sub) {
if (typeof sub !== "string") {
return [];
}
var location = [];
var offset = 0;
while (str.length > 0) {
var loc = str.indexOf(sub);
if (loc === -1) {
break;
}
location.push(offset + loc);
str = str.substring(loc + sub.length, str.length);
offset += loc + sub.length;
}
return location;
}
});
/***/ }),
/***/ 171:
/***/ (function(module, exports) {
/**
* 汉字拼音索引
*/
!(function () {
var _ChineseFirstPY = "YDYQSXMWZSSXJBYMGCCZQPSSQBYCDSCDQLDYLYBSSJGYZZJJFKCCLZDHWDWZJLJPFYYNWJJTMYHZWZHFLZPPQHGSCYYYNJQYXXGJHHSDSJNKKTMOMLCRXYPSNQSECCQZGGLLYJLMYZZSECYKYYHQWJSSGGYXYZYJWWKDJHYCHMYXJTLXJYQBYXZLDWRDJRWYSRLDZJPCBZJJBRCFTLECZSTZFXXZHTRQHYBDLYCZSSYMMRFMYQZPWWJJYFCRWFDFZQPYDDWYXKYJAWJFFXYPSFTZYHHYZYSWCJYXSCLCXXWZZXNBGNNXBXLZSZSBSGPYSYZDHMDZBQBZCWDZZYYTZHBTSYYBZGNTNXQYWQSKBPHHLXGYBFMJEBJHHGQTJCYSXSTKZHLYCKGLYSMZXYALMELDCCXGZYRJXSDLTYZCQKCNNJWHJTZZCQLJSTSTBNXBTYXCEQXGKWJYFLZQLYHYXSPSFXLMPBYSXXXYDJCZYLLLSJXFHJXPJBTFFYABYXBHZZBJYZLWLCZGGBTSSMDTJZXPTHYQTGLJSCQFZKJZJQNLZWLSLHDZBWJNCJZYZSQQYCQYRZCJJWYBRTWPYFTWEXCSKDZCTBZHYZZYYJXZCFFZZMJYXXSDZZOTTBZLQWFCKSZSXFYRLNYJMBDTHJXSQQCCSBXYYTSYFBXDZTGBCNSLCYZZPSAZYZZSCJCSHZQYDXLBPJLLMQXTYDZXSQJTZPXLCGLQTZWJBHCTSYJSFXYEJJTLBGXSXJMYJQQPFZASYJNTYDJXKJCDJSZCBARTDCLYJQMWNQNCLLLKBYBZZSYHQQLTWLCCXTXLLZNTYLNEWYZYXCZXXGRKRMTCNDNJTSYYSSDQDGHSDBJGHRWRQLYBGLXHLGTGXBQJDZPYJSJYJCTMRNYMGRZJCZGJMZMGXMPRYXKJNYMSGMZJYMKMFXMLDTGFBHCJHKYLPFMDXLQJJSMTQGZSJLQDLDGJYCALCMZCSDJLLNXDJFFFFJCZFMZFFPFKHKGDPSXKTACJDHHZDDCRRCFQYJKQCCWJDXHWJLYLLZGCFCQDSMLZPBJJPLSBCJGGDCKKDEZSQCCKJGCGKDJTJDLZYCXKLQSCGJCLTFPCQCZGWPJDQYZJJBYJHSJDZWGFSJGZKQCCZLLPSPKJGQJHZZLJPLGJGJJTHJJYJZCZMLZLYQBGJWMLJKXZDZNJQSYZMLJLLJKYWXMKJLHSKJGBMCLYYMKXJQLBMLLKMDXXKWYXYSLMLPSJQQJQXYXFJTJDXMXXLLCXQBSYJBGWYMBGGBCYXPJYGPEPFGDJGBHBNSQJYZJKJKHXQFGQZKFHYGKHDKLLSDJQXPQYKYBNQSXQNSZSWHBSXWHXWBZZXDMNSJBSBKBBZKLYLXGWXDRWYQZMYWSJQLCJXXJXKJEQXSCYETLZHLYYYSDZPAQYZCMTLSHTZCFYZYXYLJSDCJQAGYSLCQLYYYSHMRQQKLDXZSCSSSYDYCJYSFSJBFRSSZQSBXXPXJYSDRCKGJLGDKZJZBDKTCSYQPYHSTCLDJDHMXMCGXYZHJDDTMHLTXZXYLYMOHYJCLTYFBQQXPFBDFHHTKSQHZYYWCNXXCRWHOWGYJLEGWDQCWGFJYCSNTMYTOLBYGWQWESJPWNMLRYDZSZTXYQPZGCWXHNGPYXSHMYQJXZTDPPBFYHZHTJYFDZWKGKZBLDNTSXHQEEGZZYLZMMZYJZGXZXKHKSTXNXXWYLYAPSTHXDWHZYMPXAGKYDXBHNHXKDPJNMYHYLPMGOCSLNZHKXXLPZZLBMLSFBHHGYGYYGGBHSCYAQTYWLXTZQCEZYDQDQMMHTKLLSZHLSJZWFYHQSWSCWLQAZYNYTLSXTHAZNKZZSZZLAXXZWWCTGQQTDDYZTCCHYQZFLXPSLZYGPZSZNGLNDQTBDLXGTCTAJDKYWNSYZLJHHZZCWNYYZYWMHYCHHYXHJKZWSXHZYXLYSKQYSPSLYZWMYPPKBYGLKZHTYXAXQSYSHXASMCHKDSCRSWJPWXSGZJLWWSCHSJHSQNHCSEGNDAQTBAALZZMSSTDQJCJKTSCJAXPLGGXHHGXXZCXPDMMHLDGTYBYSJMXHMRCPXXJZCKZXSHMLQXXTTHXWZFKHCCZDYTCJYXQHLXDHYPJQXYLSYYDZOZJNYXQEZYSQYAYXWYPDGXDDXSPPYZNDLTWRHXYDXZZJHTCXMCZLHPYYYYMHZLLHNXMYLLLMDCPPXHMXDKYCYRDLTXJCHHZZXZLCCLYLNZSHZJZZLNNRLWHYQSNJHXYNTTTKYJPYCHHYEGKCTTWLGQRLGGTGTYGYHPYHYLQYQGCWYQKPYYYTTTTLHYHLLTYTTSPLKYZXGZWGPYDSSZZDQXSKCQNMJJZZBXYQMJRTFFBTKHZKBXLJJKDXJTLBWFZPPTKQTZTGPDGNTPJYFALQMKGXBDCLZFHZCLLLLADPMXDJHLCCLGYHDZFGYDDGCYYFGYDXKSSEBDHYKDKDKHNAXXYBPBYYHXZQGAFFQYJXDMLJCSQZLLPCHBSXGJYNDYBYQSPZWJLZKSDDTACTBXZDYZYPJZQSJNKKTKNJDJGYYPGTLFYQKASDNTCYHBLWDZHBBYDWJRYGKZYHEYYFJMSDTYFZJJHGCXPLXHLDWXXJKYTCYKSSSMTWCTTQZLPBSZDZWZXGZAGYKTYWXLHLSPBCLLOQMMZSSLCMBJCSZZKYDCZJGQQDSMCYTZQQLWZQZXSSFPTTFQMDDZDSHDTDWFHTDYZJYQJQKYPBDJYYXTLJHDRQXXXHAYDHRJLKLYTWHLLRLLRCXYLBWSRSZZSYMKZZHHKYHXKSMDSYDYCJPBZBSQLFCXXXNXKXWYWSDZYQOGGQMMYHCDZTTFJYYBGSTTTYBYKJDHKYXBELHTYPJQNFXFDYKZHQKZBYJTZBXHFDXKDASWTAWAJLDYJSFHBLDNNTNQJTJNCHXFJSRFWHZFMDRYJYJWZPDJKZYJYMPCYZNYNXFBYTFYFWYGDBNZZZDNYTXZEMMQBSQEHXFZMBMFLZZSRXYMJGSXWZJSPRYDJSJGXHJJGLJJYNZZJXHGXKYMLPYYYCXYTWQZSWHWLYRJLPXSLSXMFSWWKLCTNXNYNPSJSZHDZEPTXMYYWXYYSYWLXJQZQXZDCLEEELMCPJPCLWBXSQHFWWTFFJTNQJHJQDXHWLBYZNFJLALKYYJLDXHHYCSTYYWNRJYXYWTRMDRQHWQCMFJDYZMHMYYXJWMYZQZXTLMRSPWWCHAQBXYGZYPXYYRRCLMPYMGKSJSZYSRMYJSNXTPLNBAPPYPYLXYYZKYNLDZYJZCZNNLMZHHARQMPGWQTZMXXMLLHGDZXYHXKYXYCJMFFYYHJFSBSSQLXXNDYCANNMTCJCYPRRNYTYQNYYMBMSXNDLYLYSLJRLXYSXQMLLYZLZJJJKYZZCSFBZXXMSTBJGNXYZHLXNMCWSCYZYFZLXBRNNNYLBNRTGZQYSATSWRYHYJZMZDHZGZDWYBSSCSKXSYHYTXXGCQGXZZSHYXJSCRHMKKBXCZJYJYMKQHZJFNBHMQHYSNJNZYBKNQMCLGQHWLZNZSWXKHLJHYYBQLBFCDSXDLDSPFZPSKJYZWZXZDDXJSMMEGJSCSSMGCLXXKYYYLNYPWWWGYDKZJGGGZGGSYCKNJWNJPCXBJJTQTJWDSSPJXZXNZXUMELPXFSXTLLXCLJXJJLJZXCTPSWXLYDHLYQRWHSYCSQYYBYAYWJJJQFWQCQQCJQGXALDBZZYJGKGXPLTZYFXJLTPADKYQHPMATLCPDCKBMTXYBHKLENXDLEEGQDYMSAWHZMLJTWYGXLYQZLJEEYYBQQFFNLYXRDSCTGJGXYYNKLLYQKCCTLHJLQMKKZGCYYGLLLJDZGYDHZWXPYSJBZKDZGYZZHYWYFQYTYZSZYEZZLYMHJJHTSMQWYZLKYYWZCSRKQYTLTDXWCTYJKLWSQZWBDCQYNCJSRSZJLKCDCDTLZZZACQQZZDDXYPLXZBQJYLZLLLQDDZQJYJYJZYXNYYYNYJXKXDAZWYRDLJYYYRJLXLLDYXJCYWYWNQCCLDDNYYYNYCKCZHXXCC
// 此处收录了375个多音字,数据来自于http://www.51windows.net/pages/pinyin.asp
var oMultiDiff = {
19969: "DZ",
19975: "WM",
19988: "QJ",
20048: "YL",
20056: "SC",
20060: "NM",
20094: "QG",
20127: "QJ",
20167: "QC",
20193: "YG",
20250: "KH",
20256: "ZC",
20282: "SC",
20285: "QJG",
20291: "TD",
20314: "YD",
20315: "BF",
20340: "NE",
20375: "TD",
20389: "YJ",
20391: "CZ",
20415: "PB",
20446: "YS",
20447: "SQ",
20504: "TC",
20608: "KG",
20854: "QJ",
20857: "ZC",
20911: "PF",
20985: "AW",
21032: "PB",
21048: "XQ",
21049: "SC",
21089: "YS",
21119: "JC",
21242: "SB",
21273: "SC",
21305: "YP",
21306: "QO",
21330: "ZC",
21333: "SDC",
21345: "QK",
21378: "CA",
21397: "SC",
21414: "XS",
21442: "SC",
21477: "JG",
21480: "TD",
21484: "ZS",
21494: "YX",
21505: "YX",
21512: "HG",
21523: "XH",
21537: "PB",
21542: "PF",
21549: "KH",
21571: "E",
21574: "DA",
21588: "TD",
21589: "O",
21618: "ZC",
21621: "KHA",
21632: "ZJ",
21654: "KG",
21679: "LKG",
21683: "KH",
21710: "A",
21719: "YH",
21734: "WOE",
21769: "A",
21780: "WN",
21804: "XH",
21834: "A",
21899: "ZD",
21903: "RN",
21908: "WO",
21939: "ZC",
21956: "SA",
21964: "YA",
21970: "TD",
22003: "A",
22031: "JG",
22040: "XS",
22060: "ZC",
22066: "ZC",
22079: "MH",
22129: "XJ",
22179: "XA",
22237: "NJ",
22244: "TD",
22280: "JQ",
22300: "YH",
22313: "XW",
22331: "YQ",
22343: "YJ",
22351: "PH",
22395: "DC",
22412: "TD",
22484: "PB",
22500: "PB",
22534: "ZD",
22549: "DH",
22561: "PB",
22612: "TD",
22771: "KQ",
22831: "HB",
22841: "JG",
22855: "QJ",
22865: "XQ",
23013: "ML",
23081: "WM",
23487: "SX",
23558: "QJ",
23561: "YW",
23586: "YW",
23614: "YW",
23615: "SN",
23631: "PB",
23646: "ZS",
23663: "ZT",
23673: "YG",
23762: "TD",
23769: "ZS",
23780: "QJ",
23884: "QK",
24055: "XH",
24113: "DC",
24162: "ZC",
24191: "GA",
24273: "QJ",
24324: "NL",
24377: "TD",
24378: "QJ",
24439: "PF",
24554: "ZS",
24683: "TD",
24694: "WE",
24733: "LK",
24925: "TN",
25094: "ZG",
25100: "XQ",
25103: "XH",
25153: "PB",
25170: "PB",
25179: "KG",
25203: "PB",
25240: "ZS",
25282: "FB",
25303: "NA",
25324: "KG",
25341: "ZY",
25373: "WZ",
25375: "XJ",
25384: "A",
25457: "A",
25528: "SD",
25530: "SC",
25552: "TD",
25774: "ZC",
25874: "ZC",
26044: "YW",
26080: "WM",
26292: "PB",
26333: "PB",
26355: "ZY",
26366: "CZ",
26397: "ZC",
26399: "QJ",
26415: "ZS",
26451: "SB",
26526: "ZC",
26552: "JG",
26561: "TD",
26588: "JG",
26597: "CZ",
26629: "ZS",
26638: "YL",
26646: "XQ",
26653: "KG",
26657: "XJ",
26727: "HG",
26894: "ZC",
26937: "ZS",
26946: "ZC",
26999: "KJ",
27099: "KJ",
27449: "YQ",
27481: "XS",
27542: "ZS",
27663: "ZS",
27748: "TS",
27784: "SC",
27788: "ZD",
27795: "TD",
27812: "O",
27850: "PB",
27852: "MB",
27895: "SL",
27898: "PL",
27973: "QJ",
27981: "KH",
27986: "HX",
27994: "XJ",
28044: "YC",
28065: "WG",
28177: "SM",
28267: "QJ",
28291: "KH",
28337: "ZQ",
28463: "TL",
28548: "DC",
28601: "TD",
28689: "PB",
28805: "JG",
28820: "QG",
28846: "PB",
28952: "TD",
28975: "ZC",
29100: "A",
29325: "QJ",
29575: "SL",
29602: "FB",
30010: "TD",
30044: "CX",
30058: "PF",
30091: "YSP",
30111: "YN",
30229: "XJ",
30427: "SC",
30465: "SX",
30631: "YQ",
30655: "QJ",
30684: "QJG",
30707: "SD",
30729: "XH",
30796: "LG",
30917: "PB",
31074: "NM",
31085: "JZ",
31109: "SC",
31181: "ZC",
31192: "MLB",
31293: "JQ",
31400: "YX",
31584: "YJ",
31896: "ZN",
31909: "ZY",
31995: "XJ",
32321: "PF",
32327: "ZY",
32418: "HG",
32420: "XQ",
32421: "HG",
32438: "LG",
32473: "GJ",
32488: "TD",
32521: "QJ",
32527: "PB",
32562: "ZSQ",
32564: "JZ",
32735: "ZD",
32793: "PB",
33071: "PF",
33098: "XL",
33100: "YA",
33152: "PB",
33261: "CX",
33324: "BP",
33333: "TD",
33406: "YA",
33426: "WM",
33432: "PB",
33445: "JG",
33486: "ZN",
33493: "TS",
33507: "QJ",
33540: "QJ",
33544: "ZC",
33564: "XQ",
33617: "YT",
33632: "QJ",
33636: "XH",
33637: "YX",
33694: "WG",
33705: "PF",
33728: "YW",
33882: "SR",
34067: "WM",
34074: "YW",
34121: "QJ",
34255: "ZC",
34259: "XL",
34425: "JH",
34430: "XH",
34485: "KH",
34503: "YS",
34532: "HG",
34552: "XS",
34558: "YE",
34593: "ZL",
34660: "YQ",
34892: "XH",
34928: "SC",
34999: "QJ",
35048: "PB",
35059: "SC",
35098: "ZC",
35203: "TQ",
35265: "JX",
35299: "JX",
35782: "SZ",
35828: "YS",
35830: "E",
35843: "TD",
35895: "YG",
35977: "MH",
36158: "JG",
36228: "QJ",
36426: "XQ",
36466: "DC",
36710: "CJ",
36711: "ZYG",
36767: "PB",
36866: "SK",
36951: "YW",
37034: "YX",
37063: "XH",
37218: "ZC",
37325: "ZC",
38063: "PB",
38079: "TD",
38085: "QY",
38107: "DC",
38116: "TD",
38123: "YD",
38224: "HG",
38241: "XTC",
38271: "ZC",
38415: "YE",
38426: "KH",
38461: "YD",
38463: "AE",
38466: "PB",
38477: "XJ",
38518: "YT",
38551: "WK",
38585: "ZC",
38704: "XS",
38739: "LJ",
38761: "GJ",
38808: "SQ",
39048: "JG",
39049: "XJ",
39052: "HG",
39076: "CZ",
39271: "XT",
39534: "TD",
39552: "TD",
39584: "PB",
39647: "SB",
39730: "LG",
39748: "TPB",
40109: "ZQ",
40479: "ND",
40516: "HG",
40536: "HG",
40583: "QJ",
40765: "YQ",
40784: "QJ",
40840: "YK",
40863: "QJG"
};
var _checkPYCh = function (ch) {
var uni = ch.charCodeAt(0);
// 如果不在汉字处理范围之内,返回原字符,也可以调用自己的处理函数
if (uni > 40869 || uni < 19968) {return ch;} // dealWithOthers(ch);
return (oMultiDiff[uni] ? oMultiDiff[uni] : (_ChineseFirstPY.charAt(uni - 19968)));
};
var _mkPYRslt = function (arr, options) {
var ignoreMulti = options.ignoreMulti;
var splitChar = options.splitChar;
var arrRslt = [""], k, multiLen = 0;
for (var i = 0, len = arr.length; i < len; i++) {
var str = arr[i];
var strlen = str.length;
// 多音字过多的情况下,指数增长会造成浏览器卡死,超过20完全卡死,18勉强能用,考虑到不同性能最好是16或者14
// 超过14个多音字之后,后面的都用第一个拼音
if (strlen == 1 || multiLen > 14 || ignoreMulti) {
var tmpStr = str.substring(0, 1);
for (k = 0; k < arrRslt.length; k++) {
arrRslt[k] += tmpStr;
}
} else {
var tmpArr = arrRslt.slice(0);
arrRslt = [];
multiLen ++;
for (k = 0; k < strlen; k++) {
// 复制一个相同的arrRslt
var tmp = tmpArr.slice(0);
// 把当前字符str[k]添加到每个元素末尾
for (var j = 0; j < tmp.length; j++) {
tmp[j] += str.charAt(k);
}
// 把复制并修改后的数组连接到arrRslt上
arrRslt = arrRslt.concat(tmp);
}
}
}
// BI-56386 这边直接将所有多音字组合拼接是有风险的,因为丢失了每一组的起始索引信息, 外部使用indexOf等方法会造成错位
// 一旦错位就可能认为不符合条件, 但实际上还是有可能符合条件的,故此处以一个无法搜索的不可见字符作为连接
return arrRslt.join(splitChar || "").toLowerCase();
};
_.extend(BI, {
makeFirstPY: function (str, options) {
options = options || {};
if (typeof (str) !== "string") {return "" + str;}
var arrResult = []; // 保存中间结果的数组
for (var i = 0, len = str.length; i < len; i++) {
// 获得unicode码
var ch = str.charAt(i);
// 检查该unicode码是否在处理范围之内,在则返回该码对映汉字的拼音首字母,不在则调用其它函数处理
arrResult.push(_checkPYCh(ch));
}
// 处理arrResult,返回所有可能的拼音首字母串数组
return _mkPYRslt(arrResult, options);
}
});
})();
/***/ }),
/***/ 172:
/***/ (function(module, exports) {
!(function () {
var i18nStore = {};
_.extend(BI, {
changeI18n: function (i18n) {
if (i18n) {
i18nStore = i18n;
}
},
addI18n: function (i18n) {
BI.extend(i18nStore, i18n);
},
i18nText: function (key) {
var localeText = i18nStore[key] || (BI.i18n && BI.i18n[key]) || "";
if (!localeText) {
localeText = key;
}
var len = arguments.length;
if (len > 1) {
if (localeText.indexOf("{R1}") > -1) {
for (var i = 1; i < len; i++) {
var key = "{R" + i + "}";
localeText = BI.replaceAll(localeText, key, arguments[i] + "");
}
} else {
var args = Array.prototype.slice.call(arguments);
var count = 1;
return BI.replaceAll(localeText, "\\{\\s*\\}", function () {
return args[count++] + "";
});
}
}
return localeText;
}
});
})();
/***/ }),
/***/ 173:
/***/ (function(module, exports) {
/**
* 缓冲池
* @type {{Buffer: {}}}
*/
(function () {
var Buffer = {};
var MODE = false;// 设置缓存模式为关闭
BI.BufferPool = {
put: function (name, cache) {
if (BI.isNotNull(Buffer[name])) {
throw new Error("key值:[" + name + "] 已存在!", Buffer);
}
Buffer[name] = cache;
},
get: function (name) {
return Buffer[name];
}
};
})();
/***/ }),
/***/ 174:
/***/ (function(module, exports) {
/**
* 共享池
* @type {{Shared: {}}}
*/
(function () {
var _Shared = {};
BI.SharingPool = {
_Shared: _Shared,
put: function (name, shared) {
_Shared[name] = shared;
},
cat: function () {
var args = Array.prototype.slice.call(arguments, 0),
copy = _Shared;
for (var i = 0; i < args.length; i++) {
copy = copy && copy[args[i]];
}
return copy;
},
get: function () {
return BI.deepClone(this.cat.apply(this, arguments));
},
remove: function (key) {
delete _Shared[key];
}
};
})();
/***/ }),
/***/ 175:
/***/ (function(module, exports) {
BI.Req = {
};
/***/ }),
/***/ 61:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {
var scope = typeof global !== "undefined" && global || typeof self !== "undefined" && self || window;
var apply = Function.prototype.apply; // DOM APIs, for completeness
exports.setTimeout = function () {
return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
};
exports.setInterval = function () {
return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
};
exports.clearTimeout = exports.clearInterval = function (timeout) {
if (timeout) {
timeout.close();
}
};
function Timeout(id, clearFn) {
this._id = id;
this._clearFn = clearFn;
}
Timeout.prototype.unref = Timeout.prototype.ref = function () {};
Timeout.prototype.close = function () {
this._clearFn.call(scope, this._id);
}; // Does not start the time, just sets up the members needed.
exports.enroll = function (item, msecs) {
clearTimeout(item._idleTimeoutId);
item._idleTimeout = msecs;
};
exports.unenroll = function (item) {
clearTimeout(item._idleTimeoutId);
item._idleTimeout = -1;
};
exports._unrefActive = exports.active = function (item) {
clearTimeout(item._idleTimeoutId);
var msecs = item._idleTimeout;
if (msecs >= 0) {
item._idleTimeoutId = setTimeout(function onTimeout() {
if (item._onTimeout) item._onTimeout();
}, msecs);
}
}; // setimmediate attaches itself to the global object
__webpack_require__(159); // On some exotic environments, it's not clear which object `setimmediate` was
// able to install onto. Search each possibility in the same order as the
// `setimmediate` library.
exports.setImmediate = typeof self !== "undefined" && self.setImmediate || typeof global !== "undefined" && global.setImmediate || void 0 && (void 0).setImmediate;
exports.clearImmediate = typeof self !== "undefined" && self.clearImmediate || typeof global !== "undefined" && global.clearImmediate || void 0 && (void 0).clearImmediate;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(15)))
/***/ }),
/***/ 75:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// shim for using process in browser
var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout() {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
})();
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
} // if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch (e) {
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch (e) {
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
} // if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e) {
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e) {
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while (len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
7 years ago
queue.push(new Item(fun, args));
7 years ago
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
}; // v8 likes predictible objects
7 years ago
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
7 years ago
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
4 years ago
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
4 years ago
process.versions = {};
4 years ago
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;
process.listeners = function (name) {
return [];
};
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () {
return '/';
};
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function () {
return 0;
};
4 years ago
/***/ })
/******/ });