Browse Source

Pull request #1344: 无JIRA任务 新增before和after方法

Merge in VISUAL/fineui from ~DAILER/fineui:master to master

* commit '18d9974226892fb2d958372847be190e553b5f6e':
  无JIRA任务 新增before和after方法
es6
parent
commit
5184b5a7c3
  1. 1
      changelog.md
  2. 2
      lodash.md
  3. 4
      src/core/base.js
  4. 39
      src/core/lodash.js

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志 # 更新日志
2.0(2020-05) 2.0(2020-05)
- 新增BI.after和BI.before方法
- 修复bi.button设置宽度并配置iconCls后,文本很长的情况下显示截断的问题 - 修复bi.button设置宽度并配置iconCls后,文本很长的情况下显示截断的问题
- 填加bi-user-select-enable和bi-user-select-disable通用类名 - 填加bi-user-select-enable和bi-user-select-disable通用类名
- 修复树系列多层半选状态下,勾选祖先节点,后代节点不受影响的问题 - 修复树系列多层半选状态下,勾选祖先节点,后代节点不受影响的问题

2
lodash.md

@ -1 +1 @@
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" 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"

4
src/core/base.js

@ -109,7 +109,7 @@ if (!_global.BI) {
} }
if (item.el instanceof BI.Widget || (BI.View && item.el instanceof BI.View)) { if (item.el instanceof BI.Widget || (BI.View && item.el instanceof BI.View)) {
innerAttr.shift(); innerAttr.shift();
return BI.extend({}, outerAttr.shift(), {type: null}, item); return BI.extend({}, outerAttr.shift(), { type: null }, item);
} }
if (item.el) { if (item.el) {
return BI.extend({}, outerAttr.shift(), item, { return BI.extend({}, outerAttr.shift(), item, {
@ -660,7 +660,7 @@ if (!_global.BI) {
}); });
// 通用方法 // 通用方法
_.each(["uniqueId", "result", "chain", "iteratee", "escape", "unescape"], function (name) { _.each(["uniqueId", "result", "chain", "iteratee", "escape", "unescape", "before", "after"], function (name) {
BI[name] = function () { BI[name] = function () {
return _[name].apply(_, arguments); return _[name].apply(_, arguments);
}; };

39
src/core/lodash.js

@ -1,7 +1,7 @@
/** /**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* 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"` * 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"`
* Copyright JS Foundation and other contributors <https://js.foundation/> * Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license> * Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -6994,6 +6994,42 @@
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/**
* The opposite of `_.before`; this method creates a function that invokes
* `func` once it's called `n` or more times.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {number} n The number of calls before `func` is invoked.
* @param {Function} func The function to restrict.
* @returns {Function} Returns the new restricted function.
* @example
*
* var saves = ['profile', 'settings'];
*
* var done = _.after(saves.length, function() {
* console.log('done saving!');
* });
*
* _.forEach(saves, function(type) {
* asyncSave({ 'type': type, 'complete': done });
* });
* // => Logs 'done saving!' after the two async saves have completed.
*/
function after(n, func) {
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
n = toInteger(n);
return function() {
if (--n < 1) {
return func.apply(this, arguments);
}
};
}
/** /**
* Creates a function that invokes `func`, with the `this` binding and arguments * Creates a function that invokes `func`, with the `this` binding and arguments
* of the created function, while it's called less than `n` times. Subsequent * of the created function, while it's called less than `n` times. Subsequent
@ -9824,6 +9860,7 @@
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
// Add methods that return wrapped values in chain sequences. // Add methods that return wrapped values in chain sequences.
lodash.after = after;
lodash.assignIn = assignIn; lodash.assignIn = assignIn;
lodash.before = before; lodash.before = before;
lodash.bind = bind; lodash.bind = bind;

Loading…
Cancel
Save