guy 7 years ago
parent
commit
4203eecd6e
  1. 53
      dist/base.js
  2. 320
      dist/bundle.js
  3. 94
      dist/bundle.min.js
  4. 267
      dist/core.js
  5. 320
      dist/fineui.js
  6. 26
      dist/fineui.min.js
  7. 2
      lodash.md
  8. 10
      src/base/combination/combo.js
  9. 5
      src/base/combination/expander.js
  10. 5
      src/base/combination/searcher.js
  11. 5
      src/base/combination/switcher.js
  12. 15
      src/base/single/button/button.basic.js
  13. 13
      src/base/single/input/input.js
  14. 267
      src/core/lodash.js
  15. 267
      utils/utils.js

53
dist/base.js vendored

@ -801,7 +801,10 @@ BI.BasicButton = BI.inherit(BI.Single, {
}); });
// 之后的300ms点击无效 // 之后的300ms点击无效
var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, true); var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
function ev (e) { function ev (e) {
if (o.stopEvent) { if (o.stopEvent) {
@ -817,8 +820,8 @@ BI.BasicButton = BI.inherit(BI.Single, {
if (!self.isEnabled() || (self.isOnce() && self.isSelected())) { if (!self.isEnabled() || (self.isOnce() && self.isSelected())) {
return; return;
} }
if(BI.isKey(o.bubble) || BI.isFunction(o.bubble)) { if (BI.isKey(o.bubble) || BI.isFunction(o.bubble)) {
if(BI.isNull(self.combo)){ if (BI.isNull(self.combo)) {
var popup; var popup;
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
@ -844,7 +847,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
eventName: BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, eventName: BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON,
action: function (v) { action: function (v) {
self.combo.hideView(); self.combo.hideView();
if(v){ if (v) {
onClick.apply(self, arguments); onClick.apply(self, arguments);
} }
} }
@ -874,9 +877,9 @@ BI.BasicButton = BI.inherit(BI.Single, {
onClick.apply(self, arguments); onClick.apply(self, arguments);
} }
function getBubble() { function getBubble () {
var bubble = self.options.bubble; var bubble = self.options.bubble;
if(BI.isFunction(bubble)) { if (BI.isFunction(bubble)) {
return bubble(); return bubble();
} }
return bubble; return bubble;
@ -3162,7 +3165,10 @@ BI.Combo = BI.inherit(BI.Widget, {
} }
} }
} }
}, BI.EVENT_RESPONSE_TIME, true); }, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function (e) { self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function (e) {
debounce(e); debounce(e);
st(e); st(e);
@ -3182,7 +3188,10 @@ BI.Combo = BI.inherit(BI.Widget, {
} }
} }
} }
}, BI.EVENT_RESPONSE_TIME, true); }, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
self.element.off("click." + self.getName()).on("click." + self.getName(), function (e) { self.element.off("click." + self.getName()).on("click." + self.getName(), function (e) {
debounce(e); debounce(e);
st(e); st(e);
@ -3596,7 +3605,10 @@ BI.Expander = BI.inherit(BI.Widget, {
} }
} }
} }
}, BI.EVENT_RESPONSE_TIME, true)); }, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
}));
} }
break; break;
} }
@ -4441,7 +4453,10 @@ BI.Searcher = BI.inherit(BI.Widget, {
}); });
o.isDefaultInit && (this._assertPopupView()); o.isDefaultInit && (this._assertPopupView());
var search = BI.debounce(BI.bind(this._search, this), BI.EVENT_RESPONSE_TIME, true); var search = BI.debounce(BI.bind(this._search, this), BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
this.editor.on(BI.Controller.EVENT_CHANGE, function (type) { this.editor.on(BI.Controller.EVENT_CHANGE, function (type) {
switch (type) { switch (type) {
case BI.Events.STARTEDIT: case BI.Events.STARTEDIT:
@ -4799,7 +4814,10 @@ BI.Switcher = BI.inherit(BI.Widget, {
} }
} }
} }
}, BI.EVENT_RESPONSE_TIME, true)); }, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
}));
} }
break; break;
} }
@ -19553,8 +19571,14 @@ BI.Input = BI.inherit(BI.Single, {
self.onKeyDown(keyCode, ctrlKey); self.onKeyDown(keyCode, ctrlKey);
self._keydown_ = false; self._keydown_ = false;
}, 300); }, 300);
var _clk = BI.debounce(BI.bind(this._click, this), BI.EVENT_RESPONSE_TIME, true); var _clk = BI.debounce(BI.bind(this._click, this), BI.EVENT_RESPONSE_TIME, {
this._blurDebounce = BI.debounce(BI.bind(this._blur, this), BI.EVENT_RESPONSE_TIME, true); "leading": true,
"trailing": false
});
this._blurDebounce = BI.debounce(BI.bind(this._blur, this), BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
this.element this.element
.keydown(function (e) { .keydown(function (e) {
inputEventValid = false; inputEventValid = false;
@ -19569,7 +19593,7 @@ BI.Input = BI.inherit(BI.Single, {
}) })
.on("input propertychange", function (e) { .on("input propertychange", function (e) {
// 这个事件在input的属性发生改变的时候就会触发(class的变化也算) // 这个事件在input的属性发生改变的时候就会触发(class的变化也算)
if(BI.isNotNull(e.keyCode)) { if (BI.isNotNull(e.keyCode)) {
inputEventValid = true; inputEventValid = true;
self._keydown_ = true; self._keydown_ = true;
_keydown(e.keyCode); _keydown(e.keyCode);
@ -19608,6 +19632,7 @@ BI.Input = BI.inherit(BI.Single, {
} else { } else {
blur(); blur();
} }
function blur () { function blur () {
if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) { if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) {
self.element.val(self._lastValidValue ? self._lastValidValue : ""); self.element.val(self._lastValidValue ? self._lastValidValue : "");

320
dist/bundle.js vendored

@ -9599,7 +9599,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
})( window );/** })( window );/**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,zip,unzip"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,range"`
* 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>
@ -10545,6 +10545,9 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
*/ */
var nativeObjectToString = objectProto.toString; var nativeObjectToString = objectProto.toString;
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);
/** Used to restore the original `_` reference in `_.noConflict`. */ /** Used to restore the original `_` reference in `_.noConflict`. */
var oldDash = root._; var oldDash = root._;
@ -10576,7 +10579,8 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
}()); }());
/* Built-in method references for those with the same name as other `lodash` methods. */ /* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols, var nativeCeil = Math.ceil,
nativeGetSymbols = Object.getOwnPropertySymbols,
nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
nativeIsFinite = root.isFinite, nativeIsFinite = root.isFinite,
nativeKeys = overArg(Object.keys, Object), nativeKeys = overArg(Object.keys, Object),
@ -12379,6 +12383,29 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
}; };
} }
/**
* The base implementation of `_.range` and `_.rangeRight` which doesn't
* coerce arguments.
*
* @private
* @param {number} start The start of the range.
* @param {number} end The end of the range.
* @param {number} step The value to increment or decrement by.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Array} Returns the range of numbers.
*/
function baseRange(start, end, step, fromRight) {
var index = -1,
length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
result = Array(length);
while (length--) {
result[fromRight ? length : ++index] = start;
start += step;
}
return result;
}
/** /**
* The base implementation of `_.rest` which doesn't validate or coerce arguments. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
* *
@ -12595,6 +12622,20 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return result; return result;
} }
/**
* The base implementation of `_.unset`.
*
* @private
* @param {Object} object The object to modify.
* @param {Array|string} path The property path to unset.
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
*/
function baseUnset(object, path) {
path = castPath(path, object);
object = parent(object, path);
return object == null || delete object[toKey(last(path))];
}
/** /**
* The base implementation of `wrapperValue` which returns the result of * The base implementation of `wrapperValue` which returns the result of
* performing a sequence of actions on the unwrapped `value`, where each * performing a sequence of actions on the unwrapped `value`, where each
@ -13261,6 +13302,31 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return wrapper; return wrapper;
} }
/**
* Creates a `_.range` or `_.rangeRight` function.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new range function.
*/
function createRange(fromRight) {
return function(start, end, step) {
if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
end = step = undefined;
}
// Ensure the sign of `-0` is preserved.
start = toFinite(start);
if (end === undefined) {
end = start;
start = 0;
} else {
end = toFinite(end);
}
step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
return baseRange(start, end, step, fromRight);
};
}
/** /**
* Creates a function that wraps `func` to continue currying. * Creates a function that wraps `func` to continue currying.
* *
@ -13395,6 +13461,19 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return setWrapToString(setter(result, newData), func, bitmask); return setWrapToString(setter(result, newData), func, bitmask);
} }
/**
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
* objects.
*
* @private
* @param {*} value The value to inspect.
* @param {string} key The key of the property to inspect.
* @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
*/
function customOmitClone(value) {
return isPlainObject(value) ? undefined : value;
}
/** /**
* A specialized version of `baseIsEqualDeep` for arrays with support for * A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons. * partial deep comparisons.
@ -16781,6 +16860,47 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
(isObjectLike(value) && baseGetTag(value) == numberTag); (isObjectLike(value) && baseGetTag(value) == numberTag);
} }
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* @static
* @memberOf _
* @since 0.8.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* _.isPlainObject(new Foo);
* // => false
*
* _.isPlainObject([1, 2, 3]);
* // => false
*
* _.isPlainObject({ 'x': 0, 'y': 0 });
* // => true
*
* _.isPlainObject(Object.create(null));
* // => true
*/
function isPlainObject(value) {
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
return false;
}
var proto = getPrototype(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
funcToString.call(Ctor) == objectCtorString;
}
/** /**
* Checks if `value` is classified as a `RegExp` object. * Checks if `value` is classified as a `RegExp` object.
* *
@ -17501,6 +17621,72 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
} }
/**
* The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable property paths of `object` that are not omitted.
*
* **Note:** This method is considerably slower than `_.pick`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {...(string|string[])} [paths] The property paths to omit.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.omit(object, ['a', 'c']);
* // => { 'b': '2' }
*/
var omit = flatRest(function(object, paths) {
var result = {};
if (object == null) {
return result;
}
var isDeep = false;
paths = arrayMap(paths, function(path) {
path = castPath(path, object);
isDeep || (isDeep = path.length > 1);
return path;
});
copyObject(object, getAllKeysIn(object), result);
if (isDeep) {
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
}
var length = paths.length;
while (length--) {
baseUnset(result, paths[length]);
}
return result;
});
/**
* The opposite of `_.pickBy`; this method creates an object composed of
* the own and inherited enumerable string keyed properties of `object` that
* `predicate` doesn't return truthy for. The predicate is invoked with two
* arguments: (value, key).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
* @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.omitBy(object, _.isNumber);
* // => { 'b': '2' }
*/
function omitBy(object, predicate) {
return pickBy(object, negate(baseIteratee(predicate)));
}
/** /**
* Creates an object composed of the picked `object` properties. * Creates an object composed of the picked `object` properties.
* *
@ -17522,6 +17708,37 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return object == null ? {} : basePick(object, paths); return object == null ? {} : basePick(object, paths);
}); });
/**
* Creates an object composed of the `object` properties `predicate` returns
* truthy for. The predicate is invoked with two arguments: (value, key).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
* @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.pickBy(object, _.isNumber);
* // => { 'a': 1, 'c': 3 }
*/
function pickBy(object, predicate) {
if (object == null) {
return {};
}
var props = arrayMap(getAllKeysIn(object), function(prop) {
return [prop];
});
predicate = baseIteratee(predicate);
return basePickBy(object, props, function(value, path) {
return predicate(value, path[0]);
});
}
/** /**
* This method is like `_.get` except that if the resolved value is a * This method is like `_.get` except that if the resolved value is a
* function it's invoked with the `this` binding of its parent object and * function it's invoked with the `this` binding of its parent object and
@ -17899,6 +18116,49 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
} }
/**
* Creates an array of numbers (positive and/or negative) progressing from
* `start` up to, but not including, `end`. A step of `-1` is used if a negative
* `start` is specified without an `end` or `step`. If `end` is not specified,
* it's set to `start` with `start` then set to `0`.
*
* **Note:** JavaScript follows the IEEE-754 standard for resolving
* floating-point values which can produce unexpected results.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
* @param {number} [step=1] The value to increment or decrement by.
* @returns {Array} Returns the range of numbers.
* @see _.inRange, _.rangeRight
* @example
*
* _.range(4);
* // => [0, 1, 2, 3]
*
* _.range(-4);
* // => [0, -1, -2, -3]
*
* _.range(1, 5);
* // => [1, 2, 3, 4]
*
* _.range(0, 20, 5);
* // => [0, 5, 10, 15]
*
* _.range(0, -4, -1);
* // => [0, -1, -2, -3]
*
* _.range(1, 4, 0);
* // => [1, 1, 1]
*
* _.range(0);
* // => []
*/
var range = createRange();
/** /**
* This method returns a new empty array. * This method returns a new empty array.
* *
@ -18035,8 +18295,11 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
lodash.matches = matches; lodash.matches = matches;
lodash.mixin = mixin; lodash.mixin = mixin;
lodash.negate = negate; lodash.negate = negate;
lodash.omit = omit;
lodash.omitBy = omitBy;
lodash.once = once; lodash.once = once;
lodash.pick = pick; lodash.pick = pick;
lodash.range = range;
lodash.slice = slice; lodash.slice = slice;
lodash.sortBy = sortBy; lodash.sortBy = sortBy;
lodash.tap = tap; lodash.tap = tap;
@ -33712,7 +33975,10 @@ BI.BasicButton = BI.inherit(BI.Single, {
}); });
// 之后的300ms点击无效 // 之后的300ms点击无效
var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, true); var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
function ev (e) { function ev (e) {
if (o.stopEvent) { if (o.stopEvent) {
@ -33728,8 +33994,8 @@ BI.BasicButton = BI.inherit(BI.Single, {
if (!self.isEnabled() || (self.isOnce() && self.isSelected())) { if (!self.isEnabled() || (self.isOnce() && self.isSelected())) {
return; return;
} }
if(BI.isKey(o.bubble) || BI.isFunction(o.bubble)) { if (BI.isKey(o.bubble) || BI.isFunction(o.bubble)) {
if(BI.isNull(self.combo)){ if (BI.isNull(self.combo)) {
var popup; var popup;
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
@ -33755,7 +34021,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
eventName: BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, eventName: BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON,
action: function (v) { action: function (v) {
self.combo.hideView(); self.combo.hideView();
if(v){ if (v) {
onClick.apply(self, arguments); onClick.apply(self, arguments);
} }
} }
@ -33785,9 +34051,9 @@ BI.BasicButton = BI.inherit(BI.Single, {
onClick.apply(self, arguments); onClick.apply(self, arguments);
} }
function getBubble() { function getBubble () {
var bubble = self.options.bubble; var bubble = self.options.bubble;
if(BI.isFunction(bubble)) { if (BI.isFunction(bubble)) {
return bubble(); return bubble();
} }
return bubble; return bubble;
@ -36073,7 +36339,10 @@ BI.Combo = BI.inherit(BI.Widget, {
} }
} }
} }
}, BI.EVENT_RESPONSE_TIME, true); }, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function (e) { self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function (e) {
debounce(e); debounce(e);
st(e); st(e);
@ -36093,7 +36362,10 @@ BI.Combo = BI.inherit(BI.Widget, {
} }
} }
} }
}, BI.EVENT_RESPONSE_TIME, true); }, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
self.element.off("click." + self.getName()).on("click." + self.getName(), function (e) { self.element.off("click." + self.getName()).on("click." + self.getName(), function (e) {
debounce(e); debounce(e);
st(e); st(e);
@ -36507,7 +36779,10 @@ BI.Expander = BI.inherit(BI.Widget, {
} }
} }
} }
}, BI.EVENT_RESPONSE_TIME, true)); }, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
}));
} }
break; break;
} }
@ -37352,7 +37627,10 @@ BI.Searcher = BI.inherit(BI.Widget, {
}); });
o.isDefaultInit && (this._assertPopupView()); o.isDefaultInit && (this._assertPopupView());
var search = BI.debounce(BI.bind(this._search, this), BI.EVENT_RESPONSE_TIME, true); var search = BI.debounce(BI.bind(this._search, this), BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
this.editor.on(BI.Controller.EVENT_CHANGE, function (type) { this.editor.on(BI.Controller.EVENT_CHANGE, function (type) {
switch (type) { switch (type) {
case BI.Events.STARTEDIT: case BI.Events.STARTEDIT:
@ -37710,7 +37988,10 @@ BI.Switcher = BI.inherit(BI.Widget, {
} }
} }
} }
}, BI.EVENT_RESPONSE_TIME, true)); }, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
}));
} }
break; break;
} }
@ -52464,8 +52745,14 @@ BI.Input = BI.inherit(BI.Single, {
self.onKeyDown(keyCode, ctrlKey); self.onKeyDown(keyCode, ctrlKey);
self._keydown_ = false; self._keydown_ = false;
}, 300); }, 300);
var _clk = BI.debounce(BI.bind(this._click, this), BI.EVENT_RESPONSE_TIME, true); var _clk = BI.debounce(BI.bind(this._click, this), BI.EVENT_RESPONSE_TIME, {
this._blurDebounce = BI.debounce(BI.bind(this._blur, this), BI.EVENT_RESPONSE_TIME, true); "leading": true,
"trailing": false
});
this._blurDebounce = BI.debounce(BI.bind(this._blur, this), BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
this.element this.element
.keydown(function (e) { .keydown(function (e) {
inputEventValid = false; inputEventValid = false;
@ -52480,7 +52767,7 @@ BI.Input = BI.inherit(BI.Single, {
}) })
.on("input propertychange", function (e) { .on("input propertychange", function (e) {
// 这个事件在input的属性发生改变的时候就会触发(class的变化也算) // 这个事件在input的属性发生改变的时候就会触发(class的变化也算)
if(BI.isNotNull(e.keyCode)) { if (BI.isNotNull(e.keyCode)) {
inputEventValid = true; inputEventValid = true;
self._keydown_ = true; self._keydown_ = true;
_keydown(e.keyCode); _keydown(e.keyCode);
@ -52519,6 +52806,7 @@ BI.Input = BI.inherit(BI.Single, {
} else { } else {
blur(); blur();
} }
function blur () { function blur () {
if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) { if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) {
self.element.val(self._lastValidValue ? self._lastValidValue : ""); self.element.val(self._lastValidValue ? self._lastValidValue : "");

94
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

267
dist/core.js vendored

@ -9599,7 +9599,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
})( window );/** })( window );/**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,zip,unzip"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,range"`
* 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>
@ -10545,6 +10545,9 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
*/ */
var nativeObjectToString = objectProto.toString; var nativeObjectToString = objectProto.toString;
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);
/** Used to restore the original `_` reference in `_.noConflict`. */ /** Used to restore the original `_` reference in `_.noConflict`. */
var oldDash = root._; var oldDash = root._;
@ -10576,7 +10579,8 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
}()); }());
/* Built-in method references for those with the same name as other `lodash` methods. */ /* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols, var nativeCeil = Math.ceil,
nativeGetSymbols = Object.getOwnPropertySymbols,
nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
nativeIsFinite = root.isFinite, nativeIsFinite = root.isFinite,
nativeKeys = overArg(Object.keys, Object), nativeKeys = overArg(Object.keys, Object),
@ -12379,6 +12383,29 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
}; };
} }
/**
* The base implementation of `_.range` and `_.rangeRight` which doesn't
* coerce arguments.
*
* @private
* @param {number} start The start of the range.
* @param {number} end The end of the range.
* @param {number} step The value to increment or decrement by.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Array} Returns the range of numbers.
*/
function baseRange(start, end, step, fromRight) {
var index = -1,
length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
result = Array(length);
while (length--) {
result[fromRight ? length : ++index] = start;
start += step;
}
return result;
}
/** /**
* The base implementation of `_.rest` which doesn't validate or coerce arguments. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
* *
@ -12595,6 +12622,20 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return result; return result;
} }
/**
* The base implementation of `_.unset`.
*
* @private
* @param {Object} object The object to modify.
* @param {Array|string} path The property path to unset.
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
*/
function baseUnset(object, path) {
path = castPath(path, object);
object = parent(object, path);
return object == null || delete object[toKey(last(path))];
}
/** /**
* The base implementation of `wrapperValue` which returns the result of * The base implementation of `wrapperValue` which returns the result of
* performing a sequence of actions on the unwrapped `value`, where each * performing a sequence of actions on the unwrapped `value`, where each
@ -13261,6 +13302,31 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return wrapper; return wrapper;
} }
/**
* Creates a `_.range` or `_.rangeRight` function.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new range function.
*/
function createRange(fromRight) {
return function(start, end, step) {
if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
end = step = undefined;
}
// Ensure the sign of `-0` is preserved.
start = toFinite(start);
if (end === undefined) {
end = start;
start = 0;
} else {
end = toFinite(end);
}
step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
return baseRange(start, end, step, fromRight);
};
}
/** /**
* Creates a function that wraps `func` to continue currying. * Creates a function that wraps `func` to continue currying.
* *
@ -13395,6 +13461,19 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return setWrapToString(setter(result, newData), func, bitmask); return setWrapToString(setter(result, newData), func, bitmask);
} }
/**
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
* objects.
*
* @private
* @param {*} value The value to inspect.
* @param {string} key The key of the property to inspect.
* @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
*/
function customOmitClone(value) {
return isPlainObject(value) ? undefined : value;
}
/** /**
* A specialized version of `baseIsEqualDeep` for arrays with support for * A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons. * partial deep comparisons.
@ -16781,6 +16860,47 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
(isObjectLike(value) && baseGetTag(value) == numberTag); (isObjectLike(value) && baseGetTag(value) == numberTag);
} }
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* @static
* @memberOf _
* @since 0.8.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* _.isPlainObject(new Foo);
* // => false
*
* _.isPlainObject([1, 2, 3]);
* // => false
*
* _.isPlainObject({ 'x': 0, 'y': 0 });
* // => true
*
* _.isPlainObject(Object.create(null));
* // => true
*/
function isPlainObject(value) {
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
return false;
}
var proto = getPrototype(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
funcToString.call(Ctor) == objectCtorString;
}
/** /**
* Checks if `value` is classified as a `RegExp` object. * Checks if `value` is classified as a `RegExp` object.
* *
@ -17501,6 +17621,72 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
} }
/**
* The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable property paths of `object` that are not omitted.
*
* **Note:** This method is considerably slower than `_.pick`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {...(string|string[])} [paths] The property paths to omit.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.omit(object, ['a', 'c']);
* // => { 'b': '2' }
*/
var omit = flatRest(function(object, paths) {
var result = {};
if (object == null) {
return result;
}
var isDeep = false;
paths = arrayMap(paths, function(path) {
path = castPath(path, object);
isDeep || (isDeep = path.length > 1);
return path;
});
copyObject(object, getAllKeysIn(object), result);
if (isDeep) {
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
}
var length = paths.length;
while (length--) {
baseUnset(result, paths[length]);
}
return result;
});
/**
* The opposite of `_.pickBy`; this method creates an object composed of
* the own and inherited enumerable string keyed properties of `object` that
* `predicate` doesn't return truthy for. The predicate is invoked with two
* arguments: (value, key).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
* @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.omitBy(object, _.isNumber);
* // => { 'b': '2' }
*/
function omitBy(object, predicate) {
return pickBy(object, negate(baseIteratee(predicate)));
}
/** /**
* Creates an object composed of the picked `object` properties. * Creates an object composed of the picked `object` properties.
* *
@ -17522,6 +17708,37 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return object == null ? {} : basePick(object, paths); return object == null ? {} : basePick(object, paths);
}); });
/**
* Creates an object composed of the `object` properties `predicate` returns
* truthy for. The predicate is invoked with two arguments: (value, key).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
* @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.pickBy(object, _.isNumber);
* // => { 'a': 1, 'c': 3 }
*/
function pickBy(object, predicate) {
if (object == null) {
return {};
}
var props = arrayMap(getAllKeysIn(object), function(prop) {
return [prop];
});
predicate = baseIteratee(predicate);
return basePickBy(object, props, function(value, path) {
return predicate(value, path[0]);
});
}
/** /**
* This method is like `_.get` except that if the resolved value is a * This method is like `_.get` except that if the resolved value is a
* function it's invoked with the `this` binding of its parent object and * function it's invoked with the `this` binding of its parent object and
@ -17899,6 +18116,49 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
} }
/**
* Creates an array of numbers (positive and/or negative) progressing from
* `start` up to, but not including, `end`. A step of `-1` is used if a negative
* `start` is specified without an `end` or `step`. If `end` is not specified,
* it's set to `start` with `start` then set to `0`.
*
* **Note:** JavaScript follows the IEEE-754 standard for resolving
* floating-point values which can produce unexpected results.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
* @param {number} [step=1] The value to increment or decrement by.
* @returns {Array} Returns the range of numbers.
* @see _.inRange, _.rangeRight
* @example
*
* _.range(4);
* // => [0, 1, 2, 3]
*
* _.range(-4);
* // => [0, -1, -2, -3]
*
* _.range(1, 5);
* // => [1, 2, 3, 4]
*
* _.range(0, 20, 5);
* // => [0, 5, 10, 15]
*
* _.range(0, -4, -1);
* // => [0, -1, -2, -3]
*
* _.range(1, 4, 0);
* // => [1, 1, 1]
*
* _.range(0);
* // => []
*/
var range = createRange();
/** /**
* This method returns a new empty array. * This method returns a new empty array.
* *
@ -18035,8 +18295,11 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
lodash.matches = matches; lodash.matches = matches;
lodash.mixin = mixin; lodash.mixin = mixin;
lodash.negate = negate; lodash.negate = negate;
lodash.omit = omit;
lodash.omitBy = omitBy;
lodash.once = once; lodash.once = once;
lodash.pick = pick; lodash.pick = pick;
lodash.range = range;
lodash.slice = slice; lodash.slice = slice;
lodash.sortBy = sortBy; lodash.sortBy = sortBy;
lodash.tap = tap; lodash.tap = tap;

320
dist/fineui.js vendored

@ -9800,7 +9800,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
})( window );/** })( window );/**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,zip,unzip"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,range"`
* 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>
@ -10746,6 +10746,9 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
*/ */
var nativeObjectToString = objectProto.toString; var nativeObjectToString = objectProto.toString;
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);
/** Used to restore the original `_` reference in `_.noConflict`. */ /** Used to restore the original `_` reference in `_.noConflict`. */
var oldDash = root._; var oldDash = root._;
@ -10777,7 +10780,8 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
}()); }());
/* Built-in method references for those with the same name as other `lodash` methods. */ /* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols, var nativeCeil = Math.ceil,
nativeGetSymbols = Object.getOwnPropertySymbols,
nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
nativeIsFinite = root.isFinite, nativeIsFinite = root.isFinite,
nativeKeys = overArg(Object.keys, Object), nativeKeys = overArg(Object.keys, Object),
@ -12580,6 +12584,29 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
}; };
} }
/**
* The base implementation of `_.range` and `_.rangeRight` which doesn't
* coerce arguments.
*
* @private
* @param {number} start The start of the range.
* @param {number} end The end of the range.
* @param {number} step The value to increment or decrement by.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Array} Returns the range of numbers.
*/
function baseRange(start, end, step, fromRight) {
var index = -1,
length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
result = Array(length);
while (length--) {
result[fromRight ? length : ++index] = start;
start += step;
}
return result;
}
/** /**
* The base implementation of `_.rest` which doesn't validate or coerce arguments. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
* *
@ -12796,6 +12823,20 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return result; return result;
} }
/**
* The base implementation of `_.unset`.
*
* @private
* @param {Object} object The object to modify.
* @param {Array|string} path The property path to unset.
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
*/
function baseUnset(object, path) {
path = castPath(path, object);
object = parent(object, path);
return object == null || delete object[toKey(last(path))];
}
/** /**
* The base implementation of `wrapperValue` which returns the result of * The base implementation of `wrapperValue` which returns the result of
* performing a sequence of actions on the unwrapped `value`, where each * performing a sequence of actions on the unwrapped `value`, where each
@ -13462,6 +13503,31 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return wrapper; return wrapper;
} }
/**
* Creates a `_.range` or `_.rangeRight` function.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new range function.
*/
function createRange(fromRight) {
return function(start, end, step) {
if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
end = step = undefined;
}
// Ensure the sign of `-0` is preserved.
start = toFinite(start);
if (end === undefined) {
end = start;
start = 0;
} else {
end = toFinite(end);
}
step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
return baseRange(start, end, step, fromRight);
};
}
/** /**
* Creates a function that wraps `func` to continue currying. * Creates a function that wraps `func` to continue currying.
* *
@ -13596,6 +13662,19 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return setWrapToString(setter(result, newData), func, bitmask); return setWrapToString(setter(result, newData), func, bitmask);
} }
/**
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
* objects.
*
* @private
* @param {*} value The value to inspect.
* @param {string} key The key of the property to inspect.
* @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
*/
function customOmitClone(value) {
return isPlainObject(value) ? undefined : value;
}
/** /**
* A specialized version of `baseIsEqualDeep` for arrays with support for * A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons. * partial deep comparisons.
@ -16982,6 +17061,47 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
(isObjectLike(value) && baseGetTag(value) == numberTag); (isObjectLike(value) && baseGetTag(value) == numberTag);
} }
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* @static
* @memberOf _
* @since 0.8.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* _.isPlainObject(new Foo);
* // => false
*
* _.isPlainObject([1, 2, 3]);
* // => false
*
* _.isPlainObject({ 'x': 0, 'y': 0 });
* // => true
*
* _.isPlainObject(Object.create(null));
* // => true
*/
function isPlainObject(value) {
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
return false;
}
var proto = getPrototype(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
funcToString.call(Ctor) == objectCtorString;
}
/** /**
* Checks if `value` is classified as a `RegExp` object. * Checks if `value` is classified as a `RegExp` object.
* *
@ -17702,6 +17822,72 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
} }
/**
* The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable property paths of `object` that are not omitted.
*
* **Note:** This method is considerably slower than `_.pick`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {...(string|string[])} [paths] The property paths to omit.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.omit(object, ['a', 'c']);
* // => { 'b': '2' }
*/
var omit = flatRest(function(object, paths) {
var result = {};
if (object == null) {
return result;
}
var isDeep = false;
paths = arrayMap(paths, function(path) {
path = castPath(path, object);
isDeep || (isDeep = path.length > 1);
return path;
});
copyObject(object, getAllKeysIn(object), result);
if (isDeep) {
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
}
var length = paths.length;
while (length--) {
baseUnset(result, paths[length]);
}
return result;
});
/**
* The opposite of `_.pickBy`; this method creates an object composed of
* the own and inherited enumerable string keyed properties of `object` that
* `predicate` doesn't return truthy for. The predicate is invoked with two
* arguments: (value, key).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
* @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.omitBy(object, _.isNumber);
* // => { 'b': '2' }
*/
function omitBy(object, predicate) {
return pickBy(object, negate(baseIteratee(predicate)));
}
/** /**
* Creates an object composed of the picked `object` properties. * Creates an object composed of the picked `object` properties.
* *
@ -17723,6 +17909,37 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return object == null ? {} : basePick(object, paths); return object == null ? {} : basePick(object, paths);
}); });
/**
* Creates an object composed of the `object` properties `predicate` returns
* truthy for. The predicate is invoked with two arguments: (value, key).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
* @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.pickBy(object, _.isNumber);
* // => { 'a': 1, 'c': 3 }
*/
function pickBy(object, predicate) {
if (object == null) {
return {};
}
var props = arrayMap(getAllKeysIn(object), function(prop) {
return [prop];
});
predicate = baseIteratee(predicate);
return basePickBy(object, props, function(value, path) {
return predicate(value, path[0]);
});
}
/** /**
* This method is like `_.get` except that if the resolved value is a * This method is like `_.get` except that if the resolved value is a
* function it's invoked with the `this` binding of its parent object and * function it's invoked with the `this` binding of its parent object and
@ -18100,6 +18317,49 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
} }
/**
* Creates an array of numbers (positive and/or negative) progressing from
* `start` up to, but not including, `end`. A step of `-1` is used if a negative
* `start` is specified without an `end` or `step`. If `end` is not specified,
* it's set to `start` with `start` then set to `0`.
*
* **Note:** JavaScript follows the IEEE-754 standard for resolving
* floating-point values which can produce unexpected results.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
* @param {number} [step=1] The value to increment or decrement by.
* @returns {Array} Returns the range of numbers.
* @see _.inRange, _.rangeRight
* @example
*
* _.range(4);
* // => [0, 1, 2, 3]
*
* _.range(-4);
* // => [0, -1, -2, -3]
*
* _.range(1, 5);
* // => [1, 2, 3, 4]
*
* _.range(0, 20, 5);
* // => [0, 5, 10, 15]
*
* _.range(0, -4, -1);
* // => [0, -1, -2, -3]
*
* _.range(1, 4, 0);
* // => [1, 1, 1]
*
* _.range(0);
* // => []
*/
var range = createRange();
/** /**
* This method returns a new empty array. * This method returns a new empty array.
* *
@ -18236,8 +18496,11 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
lodash.matches = matches; lodash.matches = matches;
lodash.mixin = mixin; lodash.mixin = mixin;
lodash.negate = negate; lodash.negate = negate;
lodash.omit = omit;
lodash.omitBy = omitBy;
lodash.once = once; lodash.once = once;
lodash.pick = pick; lodash.pick = pick;
lodash.range = range;
lodash.slice = slice; lodash.slice = slice;
lodash.sortBy = sortBy; lodash.sortBy = sortBy;
lodash.tap = tap; lodash.tap = tap;
@ -35476,7 +35739,10 @@ BI.BasicButton = BI.inherit(BI.Single, {
}); });
// 之后的300ms点击无效 // 之后的300ms点击无效
var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, true); var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
function ev (e) { function ev (e) {
if (o.stopEvent) { if (o.stopEvent) {
@ -35492,8 +35758,8 @@ BI.BasicButton = BI.inherit(BI.Single, {
if (!self.isEnabled() || (self.isOnce() && self.isSelected())) { if (!self.isEnabled() || (self.isOnce() && self.isSelected())) {
return; return;
} }
if(BI.isKey(o.bubble) || BI.isFunction(o.bubble)) { if (BI.isKey(o.bubble) || BI.isFunction(o.bubble)) {
if(BI.isNull(self.combo)){ if (BI.isNull(self.combo)) {
var popup; var popup;
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
@ -35519,7 +35785,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
eventName: BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, eventName: BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON,
action: function (v) { action: function (v) {
self.combo.hideView(); self.combo.hideView();
if(v){ if (v) {
onClick.apply(self, arguments); onClick.apply(self, arguments);
} }
} }
@ -35549,9 +35815,9 @@ BI.BasicButton = BI.inherit(BI.Single, {
onClick.apply(self, arguments); onClick.apply(self, arguments);
} }
function getBubble() { function getBubble () {
var bubble = self.options.bubble; var bubble = self.options.bubble;
if(BI.isFunction(bubble)) { if (BI.isFunction(bubble)) {
return bubble(); return bubble();
} }
return bubble; return bubble;
@ -37837,7 +38103,10 @@ BI.Combo = BI.inherit(BI.Widget, {
} }
} }
} }
}, BI.EVENT_RESPONSE_TIME, true); }, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function (e) { self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function (e) {
debounce(e); debounce(e);
st(e); st(e);
@ -37857,7 +38126,10 @@ BI.Combo = BI.inherit(BI.Widget, {
} }
} }
} }
}, BI.EVENT_RESPONSE_TIME, true); }, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
self.element.off("click." + self.getName()).on("click." + self.getName(), function (e) { self.element.off("click." + self.getName()).on("click." + self.getName(), function (e) {
debounce(e); debounce(e);
st(e); st(e);
@ -38271,7 +38543,10 @@ BI.Expander = BI.inherit(BI.Widget, {
} }
} }
} }
}, BI.EVENT_RESPONSE_TIME, true)); }, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
}));
} }
break; break;
} }
@ -39116,7 +39391,10 @@ BI.Searcher = BI.inherit(BI.Widget, {
}); });
o.isDefaultInit && (this._assertPopupView()); o.isDefaultInit && (this._assertPopupView());
var search = BI.debounce(BI.bind(this._search, this), BI.EVENT_RESPONSE_TIME, true); var search = BI.debounce(BI.bind(this._search, this), BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
this.editor.on(BI.Controller.EVENT_CHANGE, function (type) { this.editor.on(BI.Controller.EVENT_CHANGE, function (type) {
switch (type) { switch (type) {
case BI.Events.STARTEDIT: case BI.Events.STARTEDIT:
@ -39474,7 +39752,10 @@ BI.Switcher = BI.inherit(BI.Widget, {
} }
} }
} }
}, BI.EVENT_RESPONSE_TIME, true)); }, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
}));
} }
break; break;
} }
@ -54228,8 +54509,14 @@ BI.Input = BI.inherit(BI.Single, {
self.onKeyDown(keyCode, ctrlKey); self.onKeyDown(keyCode, ctrlKey);
self._keydown_ = false; self._keydown_ = false;
}, 300); }, 300);
var _clk = BI.debounce(BI.bind(this._click, this), BI.EVENT_RESPONSE_TIME, true); var _clk = BI.debounce(BI.bind(this._click, this), BI.EVENT_RESPONSE_TIME, {
this._blurDebounce = BI.debounce(BI.bind(this._blur, this), BI.EVENT_RESPONSE_TIME, true); "leading": true,
"trailing": false
});
this._blurDebounce = BI.debounce(BI.bind(this._blur, this), BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
this.element this.element
.keydown(function (e) { .keydown(function (e) {
inputEventValid = false; inputEventValid = false;
@ -54244,7 +54531,7 @@ BI.Input = BI.inherit(BI.Single, {
}) })
.on("input propertychange", function (e) { .on("input propertychange", function (e) {
// 这个事件在input的属性发生改变的时候就会触发(class的变化也算) // 这个事件在input的属性发生改变的时候就会触发(class的变化也算)
if(BI.isNotNull(e.keyCode)) { if (BI.isNotNull(e.keyCode)) {
inputEventValid = true; inputEventValid = true;
self._keydown_ = true; self._keydown_ = true;
_keydown(e.keyCode); _keydown(e.keyCode);
@ -54283,6 +54570,7 @@ BI.Input = BI.inherit(BI.Single, {
} else { } else {
blur(); blur();
} }
function blur () { function blur () {
if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) { if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) {
self.element.val(self._lastValidValue ? self._lastValidValue : ""); self.element.val(self._lastValidValue ? self._lastValidValue : "");

26
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

2
lodash.md

@ -1 +1 @@
lodash core plus=debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,zip,unzip lodash core plus=debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,range

10
src/base/combination/combo.js

@ -162,7 +162,10 @@ BI.Combo = BI.inherit(BI.Widget, {
} }
} }
} }
}, BI.EVENT_RESPONSE_TIME, true); }, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function (e) { self.element.off(ev + "." + self.getName()).on(ev + "." + self.getName(), function (e) {
debounce(e); debounce(e);
st(e); st(e);
@ -182,7 +185,10 @@ BI.Combo = BI.inherit(BI.Widget, {
} }
} }
} }
}, BI.EVENT_RESPONSE_TIME, true); }, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
self.element.off("click." + self.getName()).on("click." + self.getName(), function (e) { self.element.off("click." + self.getName()).on("click." + self.getName(), function (e) {
debounce(e); debounce(e);
st(e); st(e);

5
src/base/combination/expander.js

@ -118,7 +118,10 @@ BI.Expander = BI.inherit(BI.Widget, {
} }
} }
} }
}, BI.EVENT_RESPONSE_TIME, true)); }, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
}));
} }
break; break;
} }

5
src/base/combination/searcher.js

@ -63,7 +63,10 @@ BI.Searcher = BI.inherit(BI.Widget, {
}); });
o.isDefaultInit && (this._assertPopupView()); o.isDefaultInit && (this._assertPopupView());
var search = BI.debounce(BI.bind(this._search, this), BI.EVENT_RESPONSE_TIME, true); var search = BI.debounce(BI.bind(this._search, this), BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
this.editor.on(BI.Controller.EVENT_CHANGE, function (type) { this.editor.on(BI.Controller.EVENT_CHANGE, function (type) {
switch (type) { switch (type) {
case BI.Events.STARTEDIT: case BI.Events.STARTEDIT:

5
src/base/combination/switcher.js

@ -115,7 +115,10 @@ BI.Switcher = BI.inherit(BI.Widget, {
} }
} }
} }
}, BI.EVENT_RESPONSE_TIME, true)); }, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
}));
} }
break; break;
} }

15
src/base/single/button/button.basic.js

@ -200,7 +200,10 @@ BI.BasicButton = BI.inherit(BI.Single, {
}); });
// 之后的300ms点击无效 // 之后的300ms点击无效
var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, true); var onClick = BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
function ev (e) { function ev (e) {
if (o.stopEvent) { if (o.stopEvent) {
@ -216,8 +219,8 @@ BI.BasicButton = BI.inherit(BI.Single, {
if (!self.isEnabled() || (self.isOnce() && self.isSelected())) { if (!self.isEnabled() || (self.isOnce() && self.isSelected())) {
return; return;
} }
if(BI.isKey(o.bubble) || BI.isFunction(o.bubble)) { if (BI.isKey(o.bubble) || BI.isFunction(o.bubble)) {
if(BI.isNull(self.combo)){ if (BI.isNull(self.combo)) {
var popup; var popup;
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
@ -243,7 +246,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
eventName: BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, eventName: BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON,
action: function (v) { action: function (v) {
self.combo.hideView(); self.combo.hideView();
if(v){ if (v) {
onClick.apply(self, arguments); onClick.apply(self, arguments);
} }
} }
@ -273,9 +276,9 @@ BI.BasicButton = BI.inherit(BI.Single, {
onClick.apply(self, arguments); onClick.apply(self, arguments);
} }
function getBubble() { function getBubble () {
var bubble = self.options.bubble; var bubble = self.options.bubble;
if(BI.isFunction(bubble)) { if (BI.isFunction(bubble)) {
return bubble(); return bubble();
} }
return bubble; return bubble;

13
src/base/single/input/input.js

@ -25,8 +25,14 @@ BI.Input = BI.inherit(BI.Single, {
self.onKeyDown(keyCode, ctrlKey); self.onKeyDown(keyCode, ctrlKey);
self._keydown_ = false; self._keydown_ = false;
}, 300); }, 300);
var _clk = BI.debounce(BI.bind(this._click, this), BI.EVENT_RESPONSE_TIME, true); var _clk = BI.debounce(BI.bind(this._click, this), BI.EVENT_RESPONSE_TIME, {
this._blurDebounce = BI.debounce(BI.bind(this._blur, this), BI.EVENT_RESPONSE_TIME, true); "leading": true,
"trailing": false
});
this._blurDebounce = BI.debounce(BI.bind(this._blur, this), BI.EVENT_RESPONSE_TIME, {
"leading": true,
"trailing": false
});
this.element this.element
.keydown(function (e) { .keydown(function (e) {
inputEventValid = false; inputEventValid = false;
@ -41,7 +47,7 @@ BI.Input = BI.inherit(BI.Single, {
}) })
.on("input propertychange", function (e) { .on("input propertychange", function (e) {
// 这个事件在input的属性发生改变的时候就会触发(class的变化也算) // 这个事件在input的属性发生改变的时候就会触发(class的变化也算)
if(BI.isNotNull(e.keyCode)) { if (BI.isNotNull(e.keyCode)) {
inputEventValid = true; inputEventValid = true;
self._keydown_ = true; self._keydown_ = true;
_keydown(e.keyCode); _keydown(e.keyCode);
@ -80,6 +86,7 @@ BI.Input = BI.inherit(BI.Single, {
} else { } else {
blur(); blur();
} }
function blur () { function blur () {
if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) { if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) {
self.element.val(self._lastValidValue ? self._lastValidValue : ""); self.element.val(self._lastValidValue ? self._lastValidValue : "");

267
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,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,zip,unzip"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,range"`
* 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>
@ -947,6 +947,9 @@
*/ */
var nativeObjectToString = objectProto.toString; var nativeObjectToString = objectProto.toString;
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);
/** Used to restore the original `_` reference in `_.noConflict`. */ /** Used to restore the original `_` reference in `_.noConflict`. */
var oldDash = root._; var oldDash = root._;
@ -978,7 +981,8 @@
}()); }());
/* Built-in method references for those with the same name as other `lodash` methods. */ /* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols, var nativeCeil = Math.ceil,
nativeGetSymbols = Object.getOwnPropertySymbols,
nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
nativeIsFinite = root.isFinite, nativeIsFinite = root.isFinite,
nativeKeys = overArg(Object.keys, Object), nativeKeys = overArg(Object.keys, Object),
@ -2781,6 +2785,29 @@
}; };
} }
/**
* The base implementation of `_.range` and `_.rangeRight` which doesn't
* coerce arguments.
*
* @private
* @param {number} start The start of the range.
* @param {number} end The end of the range.
* @param {number} step The value to increment or decrement by.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Array} Returns the range of numbers.
*/
function baseRange(start, end, step, fromRight) {
var index = -1,
length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
result = Array(length);
while (length--) {
result[fromRight ? length : ++index] = start;
start += step;
}
return result;
}
/** /**
* The base implementation of `_.rest` which doesn't validate or coerce arguments. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
* *
@ -2997,6 +3024,20 @@
return result; return result;
} }
/**
* The base implementation of `_.unset`.
*
* @private
* @param {Object} object The object to modify.
* @param {Array|string} path The property path to unset.
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
*/
function baseUnset(object, path) {
path = castPath(path, object);
object = parent(object, path);
return object == null || delete object[toKey(last(path))];
}
/** /**
* The base implementation of `wrapperValue` which returns the result of * The base implementation of `wrapperValue` which returns the result of
* performing a sequence of actions on the unwrapped `value`, where each * performing a sequence of actions on the unwrapped `value`, where each
@ -3663,6 +3704,31 @@
return wrapper; return wrapper;
} }
/**
* Creates a `_.range` or `_.rangeRight` function.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new range function.
*/
function createRange(fromRight) {
return function(start, end, step) {
if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
end = step = undefined;
}
// Ensure the sign of `-0` is preserved.
start = toFinite(start);
if (end === undefined) {
end = start;
start = 0;
} else {
end = toFinite(end);
}
step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
return baseRange(start, end, step, fromRight);
};
}
/** /**
* Creates a function that wraps `func` to continue currying. * Creates a function that wraps `func` to continue currying.
* *
@ -3797,6 +3863,19 @@
return setWrapToString(setter(result, newData), func, bitmask); return setWrapToString(setter(result, newData), func, bitmask);
} }
/**
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
* objects.
*
* @private
* @param {*} value The value to inspect.
* @param {string} key The key of the property to inspect.
* @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
*/
function customOmitClone(value) {
return isPlainObject(value) ? undefined : value;
}
/** /**
* A specialized version of `baseIsEqualDeep` for arrays with support for * A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons. * partial deep comparisons.
@ -7183,6 +7262,47 @@
(isObjectLike(value) && baseGetTag(value) == numberTag); (isObjectLike(value) && baseGetTag(value) == numberTag);
} }
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* @static
* @memberOf _
* @since 0.8.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* _.isPlainObject(new Foo);
* // => false
*
* _.isPlainObject([1, 2, 3]);
* // => false
*
* _.isPlainObject({ 'x': 0, 'y': 0 });
* // => true
*
* _.isPlainObject(Object.create(null));
* // => true
*/
function isPlainObject(value) {
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
return false;
}
var proto = getPrototype(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
funcToString.call(Ctor) == objectCtorString;
}
/** /**
* Checks if `value` is classified as a `RegExp` object. * Checks if `value` is classified as a `RegExp` object.
* *
@ -7903,6 +8023,72 @@
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
} }
/**
* The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable property paths of `object` that are not omitted.
*
* **Note:** This method is considerably slower than `_.pick`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {...(string|string[])} [paths] The property paths to omit.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.omit(object, ['a', 'c']);
* // => { 'b': '2' }
*/
var omit = flatRest(function(object, paths) {
var result = {};
if (object == null) {
return result;
}
var isDeep = false;
paths = arrayMap(paths, function(path) {
path = castPath(path, object);
isDeep || (isDeep = path.length > 1);
return path;
});
copyObject(object, getAllKeysIn(object), result);
if (isDeep) {
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
}
var length = paths.length;
while (length--) {
baseUnset(result, paths[length]);
}
return result;
});
/**
* The opposite of `_.pickBy`; this method creates an object composed of
* the own and inherited enumerable string keyed properties of `object` that
* `predicate` doesn't return truthy for. The predicate is invoked with two
* arguments: (value, key).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
* @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.omitBy(object, _.isNumber);
* // => { 'b': '2' }
*/
function omitBy(object, predicate) {
return pickBy(object, negate(baseIteratee(predicate)));
}
/** /**
* Creates an object composed of the picked `object` properties. * Creates an object composed of the picked `object` properties.
* *
@ -7924,6 +8110,37 @@
return object == null ? {} : basePick(object, paths); return object == null ? {} : basePick(object, paths);
}); });
/**
* Creates an object composed of the `object` properties `predicate` returns
* truthy for. The predicate is invoked with two arguments: (value, key).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
* @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.pickBy(object, _.isNumber);
* // => { 'a': 1, 'c': 3 }
*/
function pickBy(object, predicate) {
if (object == null) {
return {};
}
var props = arrayMap(getAllKeysIn(object), function(prop) {
return [prop];
});
predicate = baseIteratee(predicate);
return basePickBy(object, props, function(value, path) {
return predicate(value, path[0]);
});
}
/** /**
* This method is like `_.get` except that if the resolved value is a * This method is like `_.get` except that if the resolved value is a
* function it's invoked with the `this` binding of its parent object and * function it's invoked with the `this` binding of its parent object and
@ -8301,6 +8518,49 @@
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
} }
/**
* Creates an array of numbers (positive and/or negative) progressing from
* `start` up to, but not including, `end`. A step of `-1` is used if a negative
* `start` is specified without an `end` or `step`. If `end` is not specified,
* it's set to `start` with `start` then set to `0`.
*
* **Note:** JavaScript follows the IEEE-754 standard for resolving
* floating-point values which can produce unexpected results.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
* @param {number} [step=1] The value to increment or decrement by.
* @returns {Array} Returns the range of numbers.
* @see _.inRange, _.rangeRight
* @example
*
* _.range(4);
* // => [0, 1, 2, 3]
*
* _.range(-4);
* // => [0, -1, -2, -3]
*
* _.range(1, 5);
* // => [1, 2, 3, 4]
*
* _.range(0, 20, 5);
* // => [0, 5, 10, 15]
*
* _.range(0, -4, -1);
* // => [0, -1, -2, -3]
*
* _.range(1, 4, 0);
* // => [1, 1, 1]
*
* _.range(0);
* // => []
*/
var range = createRange();
/** /**
* This method returns a new empty array. * This method returns a new empty array.
* *
@ -8437,8 +8697,11 @@
lodash.matches = matches; lodash.matches = matches;
lodash.mixin = mixin; lodash.mixin = mixin;
lodash.negate = negate; lodash.negate = negate;
lodash.omit = omit;
lodash.omitBy = omitBy;
lodash.once = once; lodash.once = once;
lodash.pick = pick; lodash.pick = pick;
lodash.range = range;
lodash.slice = slice; lodash.slice = slice;
lodash.sortBy = sortBy; lodash.sortBy = sortBy;
lodash.tap = tap; lodash.tap = tap;

267
utils/utils.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,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,zip,unzip"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,range"`
* 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>
@ -947,6 +947,9 @@
*/ */
var nativeObjectToString = objectProto.toString; var nativeObjectToString = objectProto.toString;
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);
/** Used to restore the original `_` reference in `_.noConflict`. */ /** Used to restore the original `_` reference in `_.noConflict`. */
var oldDash = root._; var oldDash = root._;
@ -978,7 +981,8 @@
}()); }());
/* Built-in method references for those with the same name as other `lodash` methods. */ /* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols, var nativeCeil = Math.ceil,
nativeGetSymbols = Object.getOwnPropertySymbols,
nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
nativeIsFinite = root.isFinite, nativeIsFinite = root.isFinite,
nativeKeys = overArg(Object.keys, Object), nativeKeys = overArg(Object.keys, Object),
@ -2781,6 +2785,29 @@
}; };
} }
/**
* The base implementation of `_.range` and `_.rangeRight` which doesn't
* coerce arguments.
*
* @private
* @param {number} start The start of the range.
* @param {number} end The end of the range.
* @param {number} step The value to increment or decrement by.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Array} Returns the range of numbers.
*/
function baseRange(start, end, step, fromRight) {
var index = -1,
length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
result = Array(length);
while (length--) {
result[fromRight ? length : ++index] = start;
start += step;
}
return result;
}
/** /**
* The base implementation of `_.rest` which doesn't validate or coerce arguments. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
* *
@ -2997,6 +3024,20 @@
return result; return result;
} }
/**
* The base implementation of `_.unset`.
*
* @private
* @param {Object} object The object to modify.
* @param {Array|string} path The property path to unset.
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
*/
function baseUnset(object, path) {
path = castPath(path, object);
object = parent(object, path);
return object == null || delete object[toKey(last(path))];
}
/** /**
* The base implementation of `wrapperValue` which returns the result of * The base implementation of `wrapperValue` which returns the result of
* performing a sequence of actions on the unwrapped `value`, where each * performing a sequence of actions on the unwrapped `value`, where each
@ -3663,6 +3704,31 @@
return wrapper; return wrapper;
} }
/**
* Creates a `_.range` or `_.rangeRight` function.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new range function.
*/
function createRange(fromRight) {
return function(start, end, step) {
if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
end = step = undefined;
}
// Ensure the sign of `-0` is preserved.
start = toFinite(start);
if (end === undefined) {
end = start;
start = 0;
} else {
end = toFinite(end);
}
step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
return baseRange(start, end, step, fromRight);
};
}
/** /**
* Creates a function that wraps `func` to continue currying. * Creates a function that wraps `func` to continue currying.
* *
@ -3797,6 +3863,19 @@
return setWrapToString(setter(result, newData), func, bitmask); return setWrapToString(setter(result, newData), func, bitmask);
} }
/**
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
* objects.
*
* @private
* @param {*} value The value to inspect.
* @param {string} key The key of the property to inspect.
* @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
*/
function customOmitClone(value) {
return isPlainObject(value) ? undefined : value;
}
/** /**
* A specialized version of `baseIsEqualDeep` for arrays with support for * A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons. * partial deep comparisons.
@ -7183,6 +7262,47 @@
(isObjectLike(value) && baseGetTag(value) == numberTag); (isObjectLike(value) && baseGetTag(value) == numberTag);
} }
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* @static
* @memberOf _
* @since 0.8.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* _.isPlainObject(new Foo);
* // => false
*
* _.isPlainObject([1, 2, 3]);
* // => false
*
* _.isPlainObject({ 'x': 0, 'y': 0 });
* // => true
*
* _.isPlainObject(Object.create(null));
* // => true
*/
function isPlainObject(value) {
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
return false;
}
var proto = getPrototype(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
funcToString.call(Ctor) == objectCtorString;
}
/** /**
* Checks if `value` is classified as a `RegExp` object. * Checks if `value` is classified as a `RegExp` object.
* *
@ -7903,6 +8023,72 @@
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
} }
/**
* The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable property paths of `object` that are not omitted.
*
* **Note:** This method is considerably slower than `_.pick`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {...(string|string[])} [paths] The property paths to omit.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.omit(object, ['a', 'c']);
* // => { 'b': '2' }
*/
var omit = flatRest(function(object, paths) {
var result = {};
if (object == null) {
return result;
}
var isDeep = false;
paths = arrayMap(paths, function(path) {
path = castPath(path, object);
isDeep || (isDeep = path.length > 1);
return path;
});
copyObject(object, getAllKeysIn(object), result);
if (isDeep) {
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
}
var length = paths.length;
while (length--) {
baseUnset(result, paths[length]);
}
return result;
});
/**
* The opposite of `_.pickBy`; this method creates an object composed of
* the own and inherited enumerable string keyed properties of `object` that
* `predicate` doesn't return truthy for. The predicate is invoked with two
* arguments: (value, key).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
* @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.omitBy(object, _.isNumber);
* // => { 'b': '2' }
*/
function omitBy(object, predicate) {
return pickBy(object, negate(baseIteratee(predicate)));
}
/** /**
* Creates an object composed of the picked `object` properties. * Creates an object composed of the picked `object` properties.
* *
@ -7924,6 +8110,37 @@
return object == null ? {} : basePick(object, paths); return object == null ? {} : basePick(object, paths);
}); });
/**
* Creates an object composed of the `object` properties `predicate` returns
* truthy for. The predicate is invoked with two arguments: (value, key).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Object
* @param {Object} object The source object.
* @param {Function} [predicate=_.identity] The function invoked per property.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.pickBy(object, _.isNumber);
* // => { 'a': 1, 'c': 3 }
*/
function pickBy(object, predicate) {
if (object == null) {
return {};
}
var props = arrayMap(getAllKeysIn(object), function(prop) {
return [prop];
});
predicate = baseIteratee(predicate);
return basePickBy(object, props, function(value, path) {
return predicate(value, path[0]);
});
}
/** /**
* This method is like `_.get` except that if the resolved value is a * This method is like `_.get` except that if the resolved value is a
* function it's invoked with the `this` binding of its parent object and * function it's invoked with the `this` binding of its parent object and
@ -8301,6 +8518,49 @@
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
} }
/**
* Creates an array of numbers (positive and/or negative) progressing from
* `start` up to, but not including, `end`. A step of `-1` is used if a negative
* `start` is specified without an `end` or `step`. If `end` is not specified,
* it's set to `start` with `start` then set to `0`.
*
* **Note:** JavaScript follows the IEEE-754 standard for resolving
* floating-point values which can produce unexpected results.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
* @param {number} [step=1] The value to increment or decrement by.
* @returns {Array} Returns the range of numbers.
* @see _.inRange, _.rangeRight
* @example
*
* _.range(4);
* // => [0, 1, 2, 3]
*
* _.range(-4);
* // => [0, -1, -2, -3]
*
* _.range(1, 5);
* // => [1, 2, 3, 4]
*
* _.range(0, 20, 5);
* // => [0, 5, 10, 15]
*
* _.range(0, -4, -1);
* // => [0, -1, -2, -3]
*
* _.range(1, 4, 0);
* // => [1, 1, 1]
*
* _.range(0);
* // => []
*/
var range = createRange();
/** /**
* This method returns a new empty array. * This method returns a new empty array.
* *
@ -8437,8 +8697,11 @@
lodash.matches = matches; lodash.matches = matches;
lodash.mixin = mixin; lodash.mixin = mixin;
lodash.negate = negate; lodash.negate = negate;
lodash.omit = omit;
lodash.omitBy = omitBy;
lodash.once = once; lodash.once = once;
lodash.pick = pick; lodash.pick = pick;
lodash.range = range;
lodash.slice = slice; lodash.slice = slice;
lodash.sortBy = sortBy; lodash.sortBy = sortBy;
lodash.tap = tap; lodash.tap = tap;

Loading…
Cancel
Save