From 3e9d6add1c27b9feffa6c7fbf04fe0b85bb78fb4 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 16 Sep 2022 17:20:50 +0800 Subject: [PATCH] =?UTF-8?q?feature:=E6=8F=90=E4=BE=9Btextvaluecombo?= =?UTF-8?q?=E7=9A=84=E5=A4=8D=E9=80=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lodash.md | 2 +- .../combo/textvaluecombo/combo.textvalue.js | 18 +- .../combo/textvaluecombo/popup.textvalue.js | 129 ++++-- src/core/1.lodash.js | 437 ++++++++---------- src/core/logic/logic.layout.js | 43 +- src/core/platform/web/config.js | 7 + 6 files changed, 353 insertions(+), 283 deletions(-) diff --git a/lodash.md b/lodash.md index 8faeb0142..411585265 100644 --- a/lodash.md +++ b/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,before,after,unescape,chunk" +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,chunk,pick,pickBy,identity" diff --git a/src/case/combo/textvaluecombo/combo.textvalue.js b/src/case/combo/textvaluecombo/combo.textvalue.js index f6794f7bd..9a708cc83 100644 --- a/src/case/combo/textvaluecombo/combo.textvalue.js +++ b/src/case/combo/textvaluecombo/combo.textvalue.js @@ -16,7 +16,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { el: {}, allowClear: false, status: "success", // success | warning | error, - title: null, + title: null }); }, @@ -44,11 +44,11 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { if (this.options.status === "error") { return { level: "warning", - text: o.warningTitle, + text: o.warningTitle }; } return { - level: "success", + level: "success" }; }; @@ -96,6 +96,18 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { action: (...args) => { this.fireEvent(BI.Controller.EVENT_CHANGE, ...args); } + }, { + eventName: BI.TextValueComboPopup.EVENT_CLEAR, + action: (...args) => { + changeTag = true; + this.setValue([]); + this.combo.hideView(); + } + }, { + eventName: BI.TextValueComboPopup.EVENT_CONFIRM, + action: (...args) => { + this.combo.hideView(); + } } ] }; diff --git a/src/case/combo/textvaluecombo/popup.textvalue.js b/src/case/combo/textvaluecombo/popup.textvalue.js index 1876c9a55..9ea5eaa58 100644 --- a/src/case/combo/textvaluecombo/popup.textvalue.js +++ b/src/case/combo/textvaluecombo/popup.textvalue.js @@ -6,33 +6,93 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, { }); }, - _init: function () { - BI.TextValueComboPopup.superclass._init.apply(this, arguments); + render () { var o = this.options, self = this; - this.popup = BI.createWidget({ - type: "bi.button_group", - items: this._formatItems(o.items), - chooseType: o.chooseType, - layouts: [{ - type: "bi.vertical" - }], - value: o.value - }); + if (o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE) { + return { + type: "bi.vertical", + vgap: 5, + items: [{ + type: "bi.button_group", + ref: (_ref) => { + this.popup = _ref; + }, + items: this._formatItems(o.items), + chooseType: o.chooseType, + layouts: [{ + type: "bi.vertical" + }], + value: o.value, + listeners: [{ + eventName: BI.Controller.EVENT_CHANGE, + action: function (type, val, obj) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + if (type === BI.Events.CLICK) { + self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val, obj); + } + } + }] + }] + }; + } + return { + type: "bi.vertical", + verticalAlign: BI.VerticalAlign.Stretch, + rowSize: ["fill", ""], + items: [{ + type: "bi.select_list", + logic: { + dynamic: true, + innerVgap: 5, + rowSize: ["", "fill"], + verticalAlign: BI.VerticalAlign.Stretch + }, + ref: (_ref) => { + this.popup = _ref; + }, + el: { + el: { + chooseType: o.chooseType + } + }, + items: this._formatItems(o.items), + value: { + type: BI.ButtonGroup.CHOOSE_TYPE_MULTI, + value: o.value + }, + listeners: [{ + eventName: BI.SelectList.EVENT_CHANGE, + action: function (val) { + self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val); + } + }] + }, { + type: "bi.center", + cls: "list-view-toolbar bi-high-light bi-split-top", + height: 24, + items: BI.createItems([{ + type: "bi.text_button", + text: BI.i18nText("BI-Basic_Clears"), + handler: function () { + self.fireEvent(BI.TextValueComboPopup.EVENT_CLEAR); + } + }, { + type: "bi.text_button", + text: BI.i18nText("BI-Basic_OK"), + handler: function () { + self.fireEvent(BI.TextValueComboPopup.EVENT_CONFIRM); + } + }], { + once: false, + shadow: true, + isShadowShowingOnSelected: true + }) + }] + }; + }, - this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - if (type === BI.Events.CLICK) { - self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val, obj); - } - }); + mounted: function () { this.check(); - - BI.createWidget({ - type: "bi.vertical", - element: this, - vgap: 5, - items: [this.popup] - }); }, _formatItems: function (items) { @@ -40,6 +100,7 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, { return BI.map(items, function (i, item) { return BI.extend({ type: o.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE ? "bi.single_select_item" : "bi.multi_select_item", + iconWrapperWidth: 36, textAlign: o.textAlign, title: item.title || item.text }, item); @@ -52,13 +113,29 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, { }, getValue: function () { - return this.popup.getValue(); + if (this.options.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE) { + return this.popup.getValue(); + } + var val = this.popup.getValue(); + if (val.type === BI.ButtonGroup.CHOOSE_TYPE_MULTI) { + return val.value; + } else { + return val.assist; + } }, setValue: function (v) { - this.popup.setValue(v); + if (this.options.chooseType === BI.ButtonGroup.CHOOSE_TYPE_SINGLE) { + return this.popup.setValue(v); + } + this.popup.setValue({ + type: BI.ButtonGroup.CHOOSE_TYPE_MULTI, + value: v + }); } }); BI.TextValueComboPopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.TextValueComboPopup.EVENT_CLEAR = "EVENT_CLEAR"; +BI.TextValueComboPopup.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.shortcut("bi.text_value_combo_popup", BI.TextValueComboPopup); diff --git a/src/core/1.lodash.js b/src/core/1.lodash.js index 934448ac6..1fdf1bbc4 100644 --- a/src/core/1.lodash.js +++ b/src/core/1.lodash.js @@ -1,13 +1,13 @@ /** * @license * Lodash (Custom Build) - * 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,chunk"` + * 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,chunk,pick,pickBy,identity"` * Copyright JS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -;(function () { +;(function() { /** Used as a safe reference for `undefined` in pre-ES5 environments. */ var undefined; @@ -191,7 +191,7 @@ var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ - var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); + var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; @@ -269,11 +269,10 @@ var freeProcess = moduleExports && freeGlobal.process; /** Used to access faster Node.js helpers. */ - var nodeUtil = (function () { + var nodeUtil = (function() { try { return freeProcess && freeProcess.binding && freeProcess.binding('util'); - } catch (e) { - } + } catch (e) {} }()); /* Node.js helper references. */ @@ -297,14 +296,10 @@ */ function apply(func, thisArg, args) { switch (args.length) { - case 0: - return func.call(thisArg); - case 1: - return func.call(thisArg, args[0]); - case 2: - return func.call(thisArg, args[0], args[1]); - case 3: - return func.call(thisArg, args[0], args[1], args[2]); + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); } return func.apply(thisArg, args); } @@ -551,7 +546,7 @@ */ function baseFindKey(collection, predicate, eachFunc) { var result; - eachFunc(collection, function (value, key, collection) { + eachFunc(collection, function(value, key, collection) { if (predicate(value, key, collection)) { result = key; return false; @@ -617,7 +612,7 @@ * @returns {Function} Returns the new accessor function. */ function baseProperty(key) { - return function (object) { + return function(object) { return object == null ? undefined : object[key]; }; } @@ -630,7 +625,7 @@ * @returns {Function} Returns the new accessor function. */ function basePropertyOf(object) { - return function (key) { + return function(key) { return object == null ? undefined : object[key]; }; } @@ -649,7 +644,7 @@ * @returns {*} Returns the accumulated value. */ function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { - eachFunc(collection, function (value, index, collection) { + eachFunc(collection, function(value, index, collection) { accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection); @@ -704,7 +699,7 @@ * @returns {Function} Returns the new capped function. */ function baseUnary(func) { - return function (value) { + return function(value) { return func(value); }; } @@ -720,7 +715,7 @@ * @returns {Object} Returns the array of property values. */ function baseValues(object, props) { - return arrayMap(props, function (key) { + return arrayMap(props, function(key) { return object[key]; }); } @@ -750,8 +745,7 @@ var index = -1, length = strSymbols.length; - while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) { - } + while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} return index; } @@ -767,8 +761,7 @@ function charsEndIndex(strSymbols, chrSymbols) { var index = strSymbols.length; - while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) { - } + while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} return index; } @@ -852,7 +845,7 @@ var index = -1, result = Array(map.size); - map.forEach(function (value, key) { + map.forEach(function(value, key) { result[++index] = [key, value]; }); return result; @@ -867,7 +860,7 @@ * @returns {Function} Returns the new function. */ function overArg(func, transform) { - return function (arg) { + return function(arg) { return func(transform(arg)); }; } @@ -922,7 +915,7 @@ var index = -1, result = Array(set.size); - set.forEach(function (value) { + set.forEach(function(value) { result[++index] = value; }); return result; @@ -1031,7 +1024,7 @@ var idCounter = 0; /** Used to detect methods masquerading as native. */ - var maskSrcKey = (function () { + var maskSrcKey = (function() { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); return uid ? ('Symbol(src)_1.' + uid) : ''; }()); @@ -1068,13 +1061,12 @@ symIterator = Symbol ? Symbol.iterator : undefined, symToStringTag = Symbol ? Symbol.toStringTag : undefined; - var defineProperty = (function () { + var defineProperty = (function() { try { var func = getNative(Object, 'defineProperty'); func({}, '', {}); return func; - } catch (e) { - } + } catch (e) {} }()); /* Built-in method references for those with the same name as other `lodash` methods. */ @@ -1255,11 +1247,9 @@ * @param {Object} proto The object to inherit from. * @returns {Object} Returns the new object. */ - var baseCreate = (function () { - function object() { - } - - return function (proto) { + var baseCreate = (function() { + function object() {} + return function(proto) { if (!isObject(proto)) { return {}; } @@ -2002,7 +1992,7 @@ * @returns {Function} Returns `accumulator`. */ function baseAggregator(collection, setter, iteratee, accumulator) { - baseEach(collection, function (value, key, collection) { + baseEach(collection, function(value, key, collection) { setter(accumulator, value, iteratee(value), collection); }); return accumulator; @@ -2164,7 +2154,7 @@ stack.set(value, result); if (isSet(value)) { - value.forEach(function (subValue) { + value.forEach(function(subValue) { result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); }); @@ -2172,7 +2162,7 @@ } if (isMap(value)) { - value.forEach(function (subValue, key) { + value.forEach(function(subValue, key) { result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack)); }); @@ -2184,7 +2174,7 @@ : (isFlat ? keysIn : keys); var props = isArr ? undefined : keysFunc(value); - arrayEach(props || value, function (subValue, key) { + arrayEach(props || value, function(subValue, key) { if (props) { key = subValue; subValue = value[key]; @@ -2209,9 +2199,7 @@ if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } - return setTimeout(function () { - func.apply(undefined, args); - }, wait); + return setTimeout(function() { func.apply(undefined, args); }, wait); } /** @@ -2242,7 +2230,8 @@ if (comparator) { includes = arrayIncludesWith; isCommon = false; - } else if (values.length >= LARGE_ARRAY_SIZE) { + } + else if (values.length >= LARGE_ARRAY_SIZE) { includes = cacheHas; isCommon = false; values = new SetCache(values); @@ -2261,7 +2250,8 @@ } } result.push(value); - } else if (!includes(values, computed, comparator)) { + } + else if (!includes(values, computed, comparator)) { result.push(value); } } @@ -2289,7 +2279,7 @@ */ function baseEvery(collection, predicate) { var result = true; - baseEach(collection, function (value, index, collection) { + baseEach(collection, function(value, index, collection) { result = !!predicate(value, index, collection); return result; }); @@ -2335,7 +2325,7 @@ */ function baseFilter(collection, predicate) { var result = []; - baseEach(collection, function (value, index, collection) { + baseEach(collection, function(value, index, collection) { if (predicate(value, index, collection)) { result.push(value); } @@ -2436,7 +2426,7 @@ * @returns {Array} Returns the function names. */ function baseFunctions(object, props) { - return arrayFilter(props, function (key) { + return arrayFilter(props, function(key) { return isFunction(object[key]); }); } @@ -2605,7 +2595,7 @@ * @returns {Function} Returns `accumulator`. */ function baseInverter(object, setter, iteratee, accumulator) { - baseForOwn(object, function (value, key, object) { + baseForOwn(object, function(value, key, object) { setter(accumulator, iteratee(value), key, object); }); return accumulator; @@ -2939,7 +2929,7 @@ var index = -1, result = isArrayLike(collection) ? Array(collection.length) : []; - baseEach(collection, function (value, key, collection) { + baseEach(collection, function(value, key, collection) { result[++index] = iteratee(value, key, collection); }); return result; @@ -2957,7 +2947,7 @@ if (matchData.length == 1 && matchData[0][2]) { return matchesStrictComparable(matchData[0][0], matchData[0][1]); } - return function (object) { + return function(object) { return object === source || baseIsMatch(object, source, matchData); }; } @@ -2974,7 +2964,7 @@ if (isKey(path) && isStrictComparable(srcValue)) { return matchesStrictComparable(toKey(path), srcValue); } - return function (object) { + return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) ? hasIn(object, path) @@ -2997,11 +2987,12 @@ if (object === source) { return; } - baseFor(source, function (srcValue, key) { + baseFor(source, function(srcValue, key) { if (isObject(srcValue)) { stack || (stack = new Stack); baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); - } else { + } + else { var newValue = customizer ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) : undefined; @@ -3053,25 +3044,32 @@ if (isArr || isBuff || isTyped) { if (isArray(objValue)) { newValue = objValue; - } else if (isArrayLikeObject(objValue)) { + } + else if (isArrayLikeObject(objValue)) { newValue = copyArray(objValue); - } else if (isBuff) { + } + else if (isBuff) { isCommon = false; newValue = cloneBuffer(srcValue, true); - } else if (isTyped) { + } + else if (isTyped) { isCommon = false; newValue = cloneTypedArray(srcValue, true); - } else { + } + else { newValue = []; } - } else if (isPlainObject(srcValue) || isArguments(srcValue)) { + } + else if (isPlainObject(srcValue) || isArguments(srcValue)) { newValue = objValue; if (isArguments(objValue)) { newValue = toPlainObject(objValue); - } else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) { + } + else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) { newValue = initCloneObject(srcValue); } - } else { + } + else { isCommon = false; } } @@ -3097,14 +3095,14 @@ var index = -1; iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee)); - var result = baseMap(collection, function (value, key, collection) { - var criteria = arrayMap(iteratees, function (iteratee) { + var result = baseMap(collection, function(value, key, collection) { + var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); }); return { 'criteria': criteria, 'index': ++index, 'value': value }; }); - return baseSortBy(result, function (object, other) { + return baseSortBy(result, function(object, other) { return compareMultiple(object, other, orders); }); } @@ -3119,7 +3117,7 @@ * @returns {Object} Returns the new object. */ function basePick(object, paths) { - return basePickBy(object, paths, function (value, path) { + return basePickBy(object, paths, function(value, path) { return hasIn(object, path); }); } @@ -3157,7 +3155,7 @@ * @returns {Function} Returns the new accessor function. */ function basePropertyDeep(path) { - return function (object) { + return function(object) { return baseGet(object, path); }; } @@ -3258,7 +3256,7 @@ * @param {*} data The metadata. * @returns {Function} Returns `func`. */ - var baseSetData = !metaMap ? identity : function (func, data) { + var baseSetData = !metaMap ? identity : function(func, data) { metaMap.set(func, data); return func; }; @@ -3271,7 +3269,7 @@ * @param {Function} string The `toString` result. * @returns {Function} Returns `func`. */ - var baseSetToString = !defineProperty ? identity : function (func, string) { + var baseSetToString = !defineProperty ? identity : function(func, string) { return defineProperty(func, 'toString', { 'configurable': true, 'enumerable': false, @@ -3322,7 +3320,7 @@ function baseSome(collection, predicate) { var result; - baseEach(collection, function (value, index, collection) { + baseEach(collection, function(value, index, collection) { result = predicate(value, index, collection); return !result; }); @@ -3373,7 +3371,8 @@ if (comparator) { isCommon = false; includes = arrayIncludesWith; - } else if (length >= LARGE_ARRAY_SIZE) { + } + else if (length >= LARGE_ARRAY_SIZE) { var set = iteratee ? null : createSet(array); if (set) { return setToArray(set); @@ -3381,7 +3380,8 @@ isCommon = false; includes = cacheHas; seen = new SetCache; - } else { + } + else { seen = iteratee ? [] : result; } outer: @@ -3401,7 +3401,8 @@ seen.push(computed); } result.push(value); - } else if (!includes(seen, computed, comparator)) { + } + else if (!includes(seen, computed, comparator)) { if (seen !== result) { seen.push(computed); } @@ -3440,7 +3441,7 @@ if (result instanceof LazyWrapper) { result = result.value(); } - return arrayReduce(actions, function (result, action) { + return arrayReduce(actions, function(result, action) { return action.func.apply(action.thisArg, arrayPush([result], action.args)); }, result); } @@ -3829,7 +3830,7 @@ * @returns {Function} Returns the new aggregator function. */ function createAggregator(setter, initializer) { - return function (collection, iteratee) { + return function(collection, iteratee) { var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {}; @@ -3845,7 +3846,7 @@ * @returns {Function} Returns the new assigner function. */ function createAssigner(assigner) { - return baseRest(function (object, sources) { + return baseRest(function(object, sources) { var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined, @@ -3879,7 +3880,7 @@ * @returns {Function} Returns the new base function. */ function createBaseEach(eachFunc, fromRight) { - return function (collection, iteratee) { + return function(collection, iteratee) { if (collection == null) { return collection; } @@ -3907,7 +3908,7 @@ * @returns {Function} Returns the new base function. */ function createBaseFor(fromRight) { - return function (object, iteratee, keysFunc) { + return function(object, iteratee, keysFunc) { var index = -1, iterable = Object(object), props = keysFunc(object), @@ -3941,7 +3942,6 @@ var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return fn.apply(isBind ? thisArg : this, arguments); } - return wrapper; } @@ -3954,28 +3954,20 @@ * @returns {Function} Returns the new wrapped function. */ function createCtor(Ctor) { - return function () { + return function() { // Use a `switch` statement to work with class constructors. See // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist // for more details. var args = arguments; switch (args.length) { - case 0: - return new Ctor; - case 1: - return new Ctor(args[0]); - case 2: - return new Ctor(args[0], args[1]); - case 3: - return new Ctor(args[0], args[1], args[2]); - case 4: - return new Ctor(args[0], args[1], args[2], args[3]); - case 5: - return new Ctor(args[0], args[1], args[2], args[3], args[4]); - case 6: - return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); - case 7: - return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); + case 0: return new Ctor; + case 1: return new Ctor(args[0]); + case 2: return new Ctor(args[0], args[1]); + case 3: return new Ctor(args[0], args[1], args[2]); + case 4: return new Ctor(args[0], args[1], args[2], args[3]); + case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); + case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); + case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); } var thisBinding = baseCreate(Ctor.prototype), result = Ctor.apply(thisBinding, args); @@ -4020,7 +4012,6 @@ var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return apply(fn, this, args); } - return wrapper; } @@ -4032,14 +4023,12 @@ * @returns {Function} Returns the new find function. */ function createFind(findIndexFunc) { - return function (collection, predicate, fromIndex) { + return function(collection, predicate, fromIndex) { var iterable = Object(collection); if (!isArrayLike(collection)) { var iteratee = baseIteratee(predicate, 3); collection = keys(collection); - predicate = function (key) { - return iteratee(iterable[key], key, iterable); - }; + predicate = function(key) { return iteratee(iterable[key], key, iterable); }; } var index = findIndexFunc(collection, predicate, fromIndex); return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined; @@ -4116,7 +4105,6 @@ } return fn.apply(thisBinding, args); } - return wrapper; } @@ -4129,7 +4117,7 @@ * @returns {Function} Returns the new inverter function. */ function createInverter(setter, toIteratee) { - return function (object, iteratee) { + return function(object, iteratee) { return baseInverter(object, setter, toIteratee(iteratee), {}); }; } @@ -4166,7 +4154,6 @@ } return apply(fn, isBind ? thisArg : this, args); } - return wrapper; } @@ -4178,7 +4165,7 @@ * @returns {Function} Returns the new range function. */ function createRange(fromRight) { - return function (start, end, step) { + return function(start, end, step) { if (step && typeof step != 'number' && isIterateeCall(start, end, step)) { end = step = undefined; } @@ -4245,7 +4232,7 @@ * @param {Array} values The values to add to the set. * @returns {Object} Returns the new set. */ - var createSet = !(Set && (1 / setToArray(new Set([, -0]))[1]) == INFINITY) ? noop : function (values) { + var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) { return new Set(values); }; @@ -4418,7 +4405,7 @@ } // Recursively compare arrays (susceptible to call stack limits). if (seen) { - if (!arraySome(other, function (othValue, othIndex) { + if (!arraySome(other, function(othValue, othIndex) { if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { return seen.push(othIndex); @@ -4640,7 +4627,7 @@ * @param {Function} func The function to query. * @returns {*} Returns the metadata for `func`. */ - var getData = !metaMap ? noop : function (func) { + var getData = !metaMap ? noop : function(func) { return metaMap.get(func); }; @@ -4740,8 +4727,7 @@ try { value[symToStringTag] = undefined; var unmasked = true; - } catch (e) { - } + } catch (e) {} var result = nativeObjectToString.call(value); if (unmasked) { @@ -4761,12 +4747,12 @@ * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ - var getSymbols = !nativeGetSymbols ? stubArray : function (object) { + var getSymbols = !nativeGetSymbols ? stubArray : function(object) { if (object == null) { return []; } object = Object(object); - return arrayFilter(nativeGetSymbols(object), function (symbol) { + return arrayFilter(nativeGetSymbols(object), function(symbol) { return propertyIsEnumerable.call(object, symbol); }); }; @@ -4778,7 +4764,7 @@ * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ - var getSymbolsIn = !nativeGetSymbols ? stubArray : function (object) { + var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { var result = []; while (object) { arrayPush(result, getSymbols(object)); @@ -4802,23 +4788,18 @@ (Promise && getTag(Promise.resolve()) != promiseTag) || (Set && getTag(new Set) != setTag) || (WeakMap && getTag(new WeakMap) != weakMapTag)) { - getTag = function (value) { + getTag = function(value) { var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : undefined, ctorString = Ctor ? toSource(Ctor) : ''; if (ctorString) { switch (ctorString) { - case dataViewCtorString: - return dataViewTag; - case mapCtorString: - return mapTag; - case promiseCtorString: - return promiseTag; - case setCtorString: - return setTag; - case weakMapCtorString: - return weakMapTag; + case dataViewCtorString: return dataViewTag; + case mapCtorString: return mapTag; + case promiseCtorString: return promiseTag; + case setCtorString: return setTag; + case weakMapCtorString: return weakMapTag; } } return result; @@ -4844,18 +4825,10 @@ size = data.size; switch (data.type) { - case 'drop': - start += size; - break; - case 'dropRight': - end -= size; - break; - case 'take': - end = nativeMin(end, start + size); - break; - case 'takeRight': - start = nativeMax(start, end - size); - break; + case 'drop': start += size; break; + case 'dropRight': end -= size; break; + case 'take': end = nativeMin(end, start + size); break; + case 'takeRight': start = nativeMax(start, end - size); break; } } return { 'start': start, 'end': end }; @@ -4961,15 +4934,9 @@ case dataViewTag: return cloneDataView(object, isDeep); - case float32Tag: - case float64Tag: - case int8Tag: - case int16Tag: - case int32Tag: - case uint8Tag: - case uint8ClampedTag: - case uint16Tag: - case uint32Tag: + case float32Tag: case float64Tag: + case int8Tag: case int16Tag: case int32Tag: + case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: return cloneTypedArray(object, isDeep); case mapTag: @@ -5167,7 +5134,7 @@ * @returns {Function} Returns the new spec function. */ function matchesStrictComparable(key, srcValue) { - return function (object) { + return function(object) { if (object == null) { return false; } @@ -5185,7 +5152,7 @@ * @returns {Function} Returns the new memoized function. */ function memoizeCapped(func) { - var result = memoize(func, function (key) { + var result = memoize(func, function(key) { if (cache.size === MAX_MEMOIZE_SIZE) { cache.clear(); } @@ -5308,7 +5275,7 @@ */ function overRest(func, start, transform) { start = nativeMax(start === undefined ? (func.length - 1) : start, 0); - return function () { + return function() { var args = arguments, index = -1, length = nativeMax(args.length - start, 0), @@ -5415,7 +5382,7 @@ var count = 0, lastCalled = 0; - return function () { + return function() { var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); @@ -5438,12 +5405,12 @@ * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ - var stringToPath = memoizeCapped(function (string) { + var stringToPath = memoizeCapped(function(string) { var result = []; if (string.charCodeAt(0) === 46 /* . */) { result.push(''); } - string.replace(rePropName, function (match, number, quote, subString) { + string.replace(rePropName, function(match, number, quote, subString) { result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match)); }); return result; @@ -5475,12 +5442,10 @@ if (func != null) { try { return funcToString.call(func); - } catch (e) { - } + } catch (e) {} try { return (func + ''); - } catch (e) { - } + } catch (e) {} } return ''; } @@ -5494,7 +5459,7 @@ * @returns {Array} Returns `details`. */ function updateWrapDetails(details, bitmask) { - arrayEach(wrapFlags, function (pair) { + arrayEach(wrapFlags, function(pair) { var value = '_.' + pair[0]; if ((bitmask & pair[1]) && !arrayIncludes(details, value)) { details.push(value); @@ -5516,7 +5481,7 @@ } var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); result.__actions__ = copyArray(wrapper.__actions__); - result.__index__ = wrapper.__index__; + result.__index__ = wrapper.__index__; result.__values__ = wrapper.__values__; return result; } @@ -5652,7 +5617,7 @@ * _.difference([2, 1], [2, 3]); * // => [1] */ - var difference = baseRest(function (array, values) { + var difference = baseRest(function(array, values) { return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : []; @@ -5920,7 +5885,7 @@ * _.intersection([2, 1], [2, 3]); * // => [2] */ - var intersection = baseRest(function (arrays) { + var intersection = baseRest(function(arrays) { var mapped = arrayMap(arrays, castArrayLikeObject); return (mapped.length && mapped[0] === arrays[0]) ? baseIntersection(mapped) @@ -5997,7 +5962,8 @@ if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { start = 0; end = length; - } else { + } + else { start = start == null ? 0 : toInteger(start); end = end === undefined ? length : toInteger(end); } @@ -6088,7 +6054,7 @@ * _.union([2], [1, 2]); * // => [2, 1] */ - var union = baseRest(function (arrays) { + var union = baseRest(function(arrays) { return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); }); @@ -6165,13 +6131,13 @@ return []; } var length = 0; - array = arrayFilter(array, function (group) { + array = arrayFilter(array, function(group) { if (isArrayLikeObject(group)) { length = nativeMax(group.length, length); return true; } }); - return baseTimes(length, function (index) { + return baseTimes(length, function(index) { return arrayMap(array, baseProperty(index)); }); } @@ -6196,7 +6162,7 @@ * _.without([2, 1, 2, 3], 1, 2); * // => [3] */ - var without = baseRest(function (array, values) { + var without = baseRest(function(array, values) { return isArrayLikeObject(array) ? baseDifference(array, values) : []; @@ -6348,13 +6314,11 @@ * _(object).at(['a[0].b.c', 'a[1]']).value(); * // => [3, 4] */ - var wrapperAt = flatRest(function (paths) { + var wrapperAt = flatRest(function(paths) { var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, - interceptor = function (object) { - return baseAt(object, paths); - }; + interceptor = function(object) { return baseAt(object, paths); }; if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) { @@ -6366,7 +6330,7 @@ 'args': [interceptor], 'thisArg': undefined }); - return new LodashWrapper(value, this.__chain__).thru(function (array) { + return new LodashWrapper(value, this.__chain__).thru(function(array) { if (length && !array.length) { array.push(undefined); } @@ -6613,7 +6577,7 @@ * _.countBy(['one', 'two', 'three'], 'length'); * // => { '3': 2, '5': 1 } */ - var countBy = createAggregator(function (result, value, key) { + var countBy = createAggregator(function(result, value, key) { if (hasOwnProperty.call(result, key)) { ++result[key]; } else { @@ -6808,7 +6772,7 @@ * _.groupBy(['one', 'two', 'three'], 'length'); * // => { '3': ['one', 'two'], '5': ['three'] } */ - var groupBy = createAggregator(function (result, value, key) { + var groupBy = createAggregator(function(result, value, key) { if (hasOwnProperty.call(result, key)) { result[key].push(value); } else { @@ -7054,7 +7018,7 @@ * _.sortBy(users, ['user', 'age']); * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]] */ - var sortBy = baseRest(function (collection, iteratees) { + var sortBy = baseRest(function(collection, iteratees) { if (collection == null) { return []; } @@ -7085,7 +7049,7 @@ * }, _.now()); * // => Logs the number of milliseconds it took for the deferred invocation. */ - var now = function () { + var now = function() { return root.Date.now(); }; @@ -7120,7 +7084,7 @@ throw new TypeError(FUNC_ERROR_TEXT); } n = toInteger(n); - return function () { + return function() { if (--n < 1) { return func.apply(this, arguments); } @@ -7150,7 +7114,7 @@ throw new TypeError(FUNC_ERROR_TEXT); } n = toInteger(n); - return function () { + return function() { if (--n > 0) { result = func.apply(this, arguments); } @@ -7196,7 +7160,7 @@ * bound('hi'); * // => 'hi fred!' */ - var bind = baseRest(function (func, thisArg, partials) { + var bind = baseRest(function(func, thisArg, partials) { var bitmask = WRAP_BIND_FLAG; if (partials.length) { var holders = replaceHolders(partials, getHolder(bind)); @@ -7378,7 +7342,6 @@ } return result; } - debounced.cancel = cancel; debounced.flush = flush; return debounced; @@ -7402,7 +7365,7 @@ * }, 'deferred'); * // => Logs 'deferred' after one millisecond. */ - var defer = baseRest(function (func, args) { + var defer = baseRest(function(func, args) { return baseDelay(func, 1, args); }); @@ -7425,7 +7388,7 @@ * }, 1000, 'later'); * // => Logs 'later' after one second. */ - var delay = baseRest(function (func, wait, args) { + var delay = baseRest(function(func, wait, args) { return baseDelay(func, toNumber(wait) || 0, args); }); @@ -7477,7 +7440,7 @@ if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) { throw new TypeError(FUNC_ERROR_TEXT); } - var memoized = function () { + var memoized = function() { var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; @@ -7520,17 +7483,13 @@ if (typeof predicate != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } - return function () { + return function() { var args = arguments; switch (args.length) { - case 0: - return !predicate.call(this); - case 1: - return !predicate.call(this, args[0]); - case 2: - return !predicate.call(this, args[0], args[1]); - case 3: - return !predicate.call(this, args[0], args[1], args[2]); + case 0: return !predicate.call(this); + case 1: return !predicate.call(this, args[0]); + case 2: return !predicate.call(this, args[0], args[1]); + case 3: return !predicate.call(this, args[0], args[1], args[2]); } return !predicate.apply(this, args); }; @@ -7761,9 +7720,7 @@ * _.isArguments([1, 2, 3]); * // => false */ - var isArguments = baseIsArguments(function () { - return arguments; - }()) ? baseIsArguments : function (value) { + var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); }; @@ -8652,7 +8609,7 @@ * _.assignIn({ 'a': 0 }, new Foo, new Bar); * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 } */ - var assignIn = createAssigner(function (object, source) { + var assignIn = createAssigner(function(object, source) { copyObject(source, keysIn(source), object); }); @@ -8716,7 +8673,7 @@ * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 }); * // => { 'a': 1, 'b': 2 } */ - var defaults = baseRest(function (object, sources) { + var defaults = baseRest(function(object, sources) { object = Object(object); var index = -1; @@ -8766,7 +8723,7 @@ * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); * // => { 'a': { 'b': 2, 'c': 3 } } */ - var defaultsDeep = baseRest(function (args) { + var defaultsDeep = baseRest(function(args) { args.push(undefined, customDefaultsMerge); return apply(mergeWith, undefined, args); }); @@ -8958,7 +8915,7 @@ * _.invert(object); * // => { '1': 'c', '2': 'b' } */ - var invert = createInverter(function (result, value, key) { + var invert = createInverter(function(result, value, key) { if (value != null && typeof value.toString != 'function') { value = nativeObjectToString.call(value); @@ -8993,7 +8950,7 @@ * }); * // => { 'group1': ['a', 'c'], 'group2': ['b'] } */ - var invertBy = createInverter(function (result, value, key) { + var invertBy = createInverter(function(result, value, key) { if (value != null && typeof value.toString != 'function') { value = nativeObjectToString.call(value); @@ -9096,7 +9053,7 @@ * _.merge(object, other); * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } */ - var merge = createAssigner(function (object, source, srcIndex) { + var merge = createAssigner(function(object, source, srcIndex) { baseMerge(object, source, srcIndex); }); @@ -9131,7 +9088,7 @@ * _.mergeWith(object, other, customizer); * // => { 'a': [1, 3], 'b': [2, 4] } */ - var mergeWith = createAssigner(function (object, source, srcIndex, customizer) { + var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { baseMerge(object, source, srcIndex, customizer); }); @@ -9155,13 +9112,13 @@ * _.omit(object, ['a', 'c']); * // => { 'b': '2' } */ - var omit = flatRest(function (object, paths) { + var omit = flatRest(function(object, paths) { var result = {}; if (object == null) { return result; } var isDeep = false; - paths = arrayMap(paths, function (path) { + paths = arrayMap(paths, function(path) { path = castPath(path, object); isDeep || (isDeep = path.length > 1); return path; @@ -9218,7 +9175,7 @@ * _.pick(object, ['a', 'c']); * // => { 'a': 1, 'c': 3 } */ - var pick = flatRest(function (object, paths) { + var pick = flatRest(function(object, paths) { return object == null ? {} : basePick(object, paths); }); @@ -9244,11 +9201,11 @@ if (object == null) { return {}; } - var props = arrayMap(getAllKeysIn(object), function (prop) { + var props = arrayMap(getAllKeysIn(object), function(prop) { return [prop]; }); predicate = baseIteratee(predicate); - return basePickBy(object, props, function (value, path) { + return basePickBy(object, props, function(value, path) { return predicate(value, path[0]); }); } @@ -9442,7 +9399,8 @@ if (typeof upper == 'boolean') { floating = upper; upper = undefined; - } else if (typeof lower == 'boolean') { + } + else if (typeof lower == 'boolean') { floating = lower; lower = undefined; } @@ -9450,7 +9408,8 @@ if (lower === undefined && upper === undefined) { lower = 0; upper = 1; - } else { + } + else { lower = toFinite(lower); if (upper === undefined) { upper = lower; @@ -9594,7 +9553,7 @@ * // => true */ function constant(value) { - return function () { + return function() { return value; }; } @@ -9747,11 +9706,11 @@ var chain = !(isObject(options) && 'chain' in options) || !!options.chain, isFunc = isFunction(object); - arrayEach(methodNames, function (methodName) { + arrayEach(methodNames, function(methodName) { var func = source[methodName]; object[methodName] = func; if (isFunc) { - object.prototype[methodName] = function () { + object.prototype[methodName] = function() { var chainAll = this.__chain__; if (chain || chainAll) { var result = object(this.__wrapped__), @@ -10024,6 +9983,7 @@ lodash.omitBy = omitBy; lodash.once = once; lodash.pick = pick; + lodash.pickBy = pickBy; lodash.range = range; lodash.reject = reject; lodash.rest = rest; @@ -10105,9 +10065,9 @@ lodash.each = forEach; lodash.first = head; - mixin(lodash, (function () { + mixin(lodash, (function() { var source = {}; - baseForOwn(lodash, function (func, methodName) { + baseForOwn(lodash, function(func, methodName) { if (!hasOwnProperty.call(lodash.prototype, methodName)) { source[methodName] = func; } @@ -10127,8 +10087,8 @@ lodash.VERSION = VERSION; // Add `LazyWrapper` methods for `_.drop` and `_.take` variants. - arrayEach(['drop', 'take'], function (methodName, index) { - LazyWrapper.prototype[methodName] = function (n) { + arrayEach(['drop', 'take'], function(methodName, index) { + LazyWrapper.prototype[methodName] = function(n) { n = n === undefined ? 1 : nativeMax(toInteger(n), 0); var result = (this.__filtered__ && !index) @@ -10146,17 +10106,17 @@ return result; }; - LazyWrapper.prototype[methodName + 'Right'] = function (n) { + LazyWrapper.prototype[methodName + 'Right'] = function(n) { return this.reverse()[methodName](n).reverse(); }; }); // Add `LazyWrapper` methods that accept an `iteratee` value. - arrayEach(['filter', 'map', 'takeWhile'], function (methodName, index) { + arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) { var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; - LazyWrapper.prototype[methodName] = function (iteratee) { + LazyWrapper.prototype[methodName] = function(iteratee) { var result = this.clone(); result.__iteratees__.push({ 'iteratee': getIteratee(iteratee, 3), @@ -10168,49 +10128,49 @@ }); // Add `LazyWrapper` methods for `_.head` and `_.last`. - arrayEach(['head', 'last'], function (methodName, index) { + arrayEach(['head', 'last'], function(methodName, index) { var takeName = 'take' + (index ? 'Right' : ''); - LazyWrapper.prototype[methodName] = function () { + LazyWrapper.prototype[methodName] = function() { return this[takeName](1).value()[0]; }; }); // Add `LazyWrapper` methods for `_.initial` and `_.tail`. - arrayEach(['initial', 'tail'], function (methodName, index) { + arrayEach(['initial', 'tail'], function(methodName, index) { var dropName = 'drop' + (index ? '' : 'Right'); - LazyWrapper.prototype[methodName] = function () { + LazyWrapper.prototype[methodName] = function() { return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); }; }); - LazyWrapper.prototype.compact = function () { + LazyWrapper.prototype.compact = function() { return this.filter(identity); }; - LazyWrapper.prototype.find = function (predicate) { + LazyWrapper.prototype.find = function(predicate) { return this.filter(predicate).head(); }; - LazyWrapper.prototype.findLast = function (predicate) { + LazyWrapper.prototype.findLast = function(predicate) { return this.reverse().find(predicate); }; - LazyWrapper.prototype.invokeMap = baseRest(function (path, args) { + LazyWrapper.prototype.invokeMap = baseRest(function(path, args) { if (typeof path == 'function') { return new LazyWrapper(this); } - return this.map(function (value) { + return this.map(function(value) { return baseInvoke(value, path, args); }); }); - LazyWrapper.prototype.reject = function (predicate) { + LazyWrapper.prototype.reject = function(predicate) { return this.filter(negate(getIteratee(predicate))); }; - LazyWrapper.prototype.slice = function (start, end) { + LazyWrapper.prototype.slice = function(start, end) { start = toInteger(start); var result = this; @@ -10229,16 +10189,16 @@ return result; }; - LazyWrapper.prototype.takeRightWhile = function (predicate) { + LazyWrapper.prototype.takeRightWhile = function(predicate) { return this.reverse().takeWhile(predicate).reverse(); }; - LazyWrapper.prototype.toArray = function () { + LazyWrapper.prototype.toArray = function() { return this.take(MAX_ARRAY_LENGTH); }; // Add `LazyWrapper` methods to `lodash.prototype`. - baseForOwn(LazyWrapper.prototype, function (func, methodName) { + baseForOwn(LazyWrapper.prototype, function(func, methodName) { var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName], @@ -10247,14 +10207,14 @@ if (!lodashFunc) { return; } - lodash.prototype[methodName] = function () { + lodash.prototype[methodName] = function() { var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee = args[0], useLazy = isLazy || isArray(value); - var interceptor = function (value) { + var interceptor = function(value) { var result = lodashFunc.apply(lodash, arrayPush([value], args)); return (isTaker && chainAll) ? result[0] : result; }; @@ -10283,25 +10243,25 @@ }); // Add `Array` methods to `lodash.prototype`. - arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function (methodName) { + arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', retUnwrapped = /^(?:pop|shift)$/.test(methodName); - lodash.prototype[methodName] = function () { + lodash.prototype[methodName] = function() { var args = arguments; if (retUnwrapped && !this.__chain__) { var value = this.value(); return func.apply(isArray(value) ? value : [], args); } - return this[chainName](function (value) { + return this[chainName](function(value) { return func.apply(isArray(value) ? value : [], args); }); }; }); // Map minified method names to their real names. - baseForOwn(LazyWrapper.prototype, function (func, methodName) { + baseForOwn(LazyWrapper.prototype, function(func, methodName) { var lodashFunc = lodash[methodName]; if (lodashFunc) { var key = (lodashFunc.name + ''), @@ -10336,11 +10296,11 @@ // loaded by a script tag in the presence of an AMD loader. // See http://requirejs.org/docs/errors.html#mismatch for more details. // Use `_.noConflict` to remove Lodash from the global object. - BI._ = lodash; + root._ = lodash; // Define as an anonymous module so, through path mapping, it can be // referenced as the "underscore" module. - define(function () { + define(function() { return lodash; }); } @@ -10350,7 +10310,8 @@ (freeModule.exports = lodash)._ = lodash; // Export for CommonJS support. freeExports._ = lodash; - } else { + } + else { // Export to the global object. BI._ = lodash; } diff --git a/src/core/logic/logic.layout.js b/src/core/logic/logic.layout.js index 21ce0f9b8..94cac3b2f 100644 --- a/src/core/logic/logic.layout.js +++ b/src/core/logic/logic.layout.js @@ -32,7 +32,7 @@ BI.VerticalLayoutLogic = BI.inherit(BI.Logic, { } else { layout = "bi.vtape"; } - return { + return _.pickBy({ type: layout, scrollable: o.scrollable, scrolly: o.scrolly, @@ -45,8 +45,12 @@ BI.VerticalLayoutLogic = BI.inherit(BI.Logic, { bgap: o.bgap, innerHgap: o.innerHgap, innerVgap: o.innerVgap, - items: o.items - }; + items: o.items, + horizontalAlign: o.horizontalAlign, + verticalAlign: o.verticalAlign, + columnSize: o.columnSize, + rowSize: o.rowSize + }, _.identity); } }); @@ -85,7 +89,7 @@ BI.HorizontalLayoutLogic = BI.inherit(BI.Logic, { } else { layout = "bi.htape"; } - return { + return _.pickBy({ type: layout, scrollable: o.scrollable, scrolly: o.scrolly, @@ -98,8 +102,12 @@ BI.HorizontalLayoutLogic = BI.inherit(BI.Logic, { bgap: o.bgap, innerHgap: o.innerHgap, innerVgap: o.innerVgap, - items: o.items - }; + items: o.items, + horizontalAlign: o.horizontalAlign, + verticalAlign: o.verticalAlign, + columnSize: o.columnSize, + rowSize: o.rowSize + }, _.identity); } }); @@ -135,19 +143,21 @@ BI.TableLayoutLogic = BI.inherit(BI.Logic, { } else { layout = "bi.window"; } - return { + return _.pickBy({ type: layout, scrollable: o.scrollable, scrolly: o.scrolly, scrollx: o.scrollx, columns: o.columns, rows: o.rows, - columnSize: o.columnSize, - rowSize: o.rowSize, hgap: o.hgap, vgap: o.vgap, - items: o.items - }; + items: o.items, + horizontalAlign: o.horizontalAlign, + verticalAlign: o.verticalAlign, + columnSize: o.columnSize, + rowSize: o.rowSize + }, _.identity); } }); @@ -188,9 +198,8 @@ BI.HorizontalFillLayoutLogic = BI.inherit(BI.Logic, { } else { layout = "bi.htape"; } - return { + return _.pickBy({ type: layout, - columnSize: columnSize, scrollable: o.scrollable, scrolly: o.scrolly, scrollx: o.scrollx, @@ -202,7 +211,11 @@ BI.HorizontalFillLayoutLogic = BI.inherit(BI.Logic, { bgap: o.bgap, innerHgap: o.innerHgap, innerVgap: o.innerVgap, - items: o.items - }; + items: o.items, + horizontalAlign: o.horizontalAlign, + verticalAlign: o.verticalAlign, + columnSize: columnSize, + rowSize: o.rowSize + }, _.identity); } }); diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index 6a955a27e..efa5b0fe6 100644 --- a/src/core/platform/web/config.js +++ b/src/core/platform/web/config.js @@ -62,6 +62,13 @@ }) }); } + if (ob.verticalAlign === BI.VerticalAlign.Stretch) { + if (isSupportFlex()) { + return BI.extend({ + horizontalAlign: BI.HorizontalAlign.Stretch, + }, ob, { type: "bi.flex_vertical" }); + } + } return ob; }); BI.Plugin.configWidget("bi.inline", function (ob) {