From 64d82dfbe9bb208b50dc96b32671a8bd19af283e Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 22 Aug 2019 17:06:43 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-20971=20feat:=20=E5=8F=AF=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=98=AF=E5=90=A6=E6=90=9C=E7=B4=A2=E5=AE=9E=E9=99=85?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/demo.treevaluechoosercombo.js | 1 + .../demo.multilayer_select_tree_combo.js | 1 + .../demo.multilayer_single_tree_combo.js | 1 + dist/2.0/fineui.ie.js | 604 ++++++++++-------- dist/2.0/fineui.js | 604 ++++++++++-------- dist/bundle.ie.js | 604 ++++++++++-------- dist/bundle.js | 604 ++++++++++-------- dist/core.js | 462 +++++++------- dist/demo.js | 5 +- dist/fineui.ie.js | 604 ++++++++++-------- dist/fineui.js | 604 ++++++++++-------- dist/fineui_without_jquery_polyfill.js | 604 ++++++++++-------- dist/utils.js | 462 +++++++------- dist/widget.js | 142 ++-- lodash.md | 2 +- .../abstract.treevaluechooser.js | 6 + src/core/base.js | 2 +- src/core/lodash.js | 460 ++++++------- .../multilayerselecttree.combo.js | 4 +- .../multilayerselecttree.trigger.js | 64 +- .../multilayersingletree.combo.js | 1 + .../multilayersingletree.trigger.js | 67 +- 22 files changed, 3272 insertions(+), 2636 deletions(-) diff --git a/demo/js/component/demo.treevaluechoosercombo.js b/demo/js/component/demo.treevaluechoosercombo.js index 8fa557ee1..fbb645162 100644 --- a/demo/js/component/demo.treevaluechoosercombo.js +++ b/demo/js/component/demo.treevaluechoosercombo.js @@ -7,6 +7,7 @@ Demo.TreeValueChooser = BI.inherit(BI.Widget, { var widget = BI.createWidget({ type: "bi.tree_value_chooser_combo", width: 300, + allowSearchValue: true, // items: BI.deepClone(Demo.CONSTANTS.TREEITEMS), itemsCreator: function (op, callback) { callback(BI.deepClone(Demo.CONSTANTS.TREEITEMS)); diff --git a/demo/js/widget/selecttree/demo.multilayer_select_tree_combo.js b/demo/js/widget/selecttree/demo.multilayer_select_tree_combo.js index 645c28fcd..42485e733 100644 --- a/demo/js/widget/selecttree/demo.multilayer_select_tree_combo.js +++ b/demo/js/widget/selecttree/demo.multilayer_select_tree_combo.js @@ -16,6 +16,7 @@ Demo.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { ref: function (_ref) { self.tree = _ref; }, + allowEdit: true, text: "默认值", items: items, width: 300, diff --git a/demo/js/widget/singletree/demo.multilayer_single_tree_combo.js b/demo/js/widget/singletree/demo.multilayer_single_tree_combo.js index 109d0c489..c85db327d 100644 --- a/demo/js/widget/singletree/demo.multilayer_single_tree_combo.js +++ b/demo/js/widget/singletree/demo.multilayer_single_tree_combo.js @@ -16,6 +16,7 @@ Demo.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { ref: function (_ref) { self.tree = _ref; }, + allowEdit: true, text: "默认值", items: items, width: 300 diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js index ec2ce49c8..af0def4e0 100644 --- a/dist/2.0/fineui.ie.js +++ b/dist/2.0/fineui.ie.js @@ -22,7 +22,7 @@ if(_global.BI.prepares == null) { }/** * @license * Lodash (Custom Build) - * Build: `lodash core plus="debounce,throttle,get,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"` + * Build: `lodash core plus="debounce,throttle,get,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"` * Copyright JS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 @@ -215,34 +215,34 @@ if(_global.BI.prepares == null) { /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = - typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = - typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = - typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = - typedArrayTags[uint32Tag] = true; + typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = + typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = + typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = + typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = - typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = - typedArrayTags[errorTag] = typedArrayTags[funcTag] = - typedArrayTags[mapTag] = typedArrayTags[numberTag] = - typedArrayTags[objectTag] = typedArrayTags[regexpTag] = - typedArrayTags[setTag] = typedArrayTags[stringTag] = - typedArrayTags[weakMapTag] = false; + typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = + typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = + typedArrayTags[errorTag] = typedArrayTags[funcTag] = + typedArrayTags[mapTag] = typedArrayTags[numberTag] = + typedArrayTags[objectTag] = typedArrayTags[regexpTag] = + typedArrayTags[setTag] = typedArrayTags[stringTag] = + typedArrayTags[weakMapTag] = false; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = - cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = - cloneableTags[boolTag] = cloneableTags[dateTag] = - cloneableTags[float32Tag] = cloneableTags[float64Tag] = - cloneableTags[int8Tag] = cloneableTags[int16Tag] = - cloneableTags[int32Tag] = cloneableTags[mapTag] = - cloneableTags[numberTag] = cloneableTags[objectTag] = - cloneableTags[regexpTag] = cloneableTags[setTag] = - cloneableTags[stringTag] = cloneableTags[symbolTag] = - cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = - cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = + cloneableTags[boolTag] = cloneableTags[dateTag] = + cloneableTags[float32Tag] = cloneableTags[float64Tag] = + cloneableTags[int8Tag] = cloneableTags[int16Tag] = + cloneableTags[int32Tag] = cloneableTags[mapTag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[setTag] = + cloneableTags[stringTag] = cloneableTags[symbolTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = - cloneableTags[weakMapTag] = false; + cloneableTags[weakMapTag] = false; /** Used to map characters to HTML entities. */ var htmlEscapes = { @@ -599,8 +599,8 @@ if(_global.BI.prepares == null) { */ function baseIndexOf(array, value, fromIndex) { return value === value - ? strictIndexOf(array, value, fromIndex) - : baseFindIndex(array, baseIsNaN, fromIndex); + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); } /** @@ -656,8 +656,8 @@ if(_global.BI.prepares == null) { function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { eachFunc(collection, function(value, index, collection) { accumulator = initAccum - ? (initAccum = false, value) - : iteratee(accumulator, value, index, collection); + ? (initAccum = false, value) + : iteratee(accumulator, value, index, collection); }); return accumulator; } @@ -910,8 +910,8 @@ if(_global.BI.prepares == null) { */ function safeGet(object, key) { return key == '__proto__' - ? undefined - : object[key]; + ? undefined + : object[key]; } /** @@ -962,8 +962,8 @@ if(_global.BI.prepares == null) { */ function stringSize(string) { return hasUnicode(string) - ? unicodeSize(string) - : asciiSize(string); + ? unicodeSize(string) + : asciiSize(string); } /** @@ -975,8 +975,8 @@ if(_global.BI.prepares == null) { */ function stringToArray(string) { return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); + ? unicodeToArray(string) + : asciiToArray(string); } /** @@ -1045,8 +1045,8 @@ if(_global.BI.prepares == null) { /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ @@ -1383,30 +1383,30 @@ if(_global.BI.prepares == null) { var result = []; outer: - while (length-- && resIndex < takeCount) { - index += dir; - - var iterIndex = -1, - value = array[index]; - - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], - iteratee = data.iteratee, - type = data.type, - computed = iteratee(value); - - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } - } + while (length-- && resIndex < takeCount) { + index += dir; + + var iterIndex = -1, + value = array[index]; + + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], + iteratee = data.iteratee, + type = data.type, + computed = iteratee(value); + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; } - result[resIndex++] = value; } + } + result[resIndex++] = value; + } return result; } @@ -1914,14 +1914,14 @@ if(_global.BI.prepares == null) { for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) ))) { result.push(key); } @@ -2136,8 +2136,8 @@ if(_global.BI.prepares == null) { result = (isFlat || isFunc) ? {} : initCloneObject(value); if (!isDeep) { return isFlat - ? copySymbolsIn(value, baseAssignIn(result, value)) - : copySymbols(value, baseAssign(result, value)); + ? copySymbolsIn(value, baseAssignIn(result, value)) + : copySymbols(value, baseAssign(result, value)); } } else { if (!cloneableTags[tag]) { @@ -2171,8 +2171,8 @@ if(_global.BI.prepares == null) { } var keysFunc = isFull - ? (isFlat ? getAllKeysIn : getAllKeys) - : (isFlat ? keysIn : keys); + ? (isFlat ? getAllKeysIn : getAllKeys) + : (isFlat ? keysIn : keys); var props = isArr ? undefined : keysFunc(value); arrayEach(props || value, function(subValue, key) { @@ -2238,24 +2238,24 @@ if(_global.BI.prepares == null) { values = new SetCache(values); } outer: - while (++index < length) { - var value = array[index], - computed = iteratee == null ? value : iteratee(value); - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee == null ? value : iteratee(value); + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === computed) { + continue outer; } } + result.push(value); + } + else if (!includes(values, computed, comparator)) { + result.push(value); + } + } return result; } @@ -2306,9 +2306,9 @@ if(_global.BI.prepares == null) { current = iteratee(value); if (current != null && (computed === undefined - ? (current === current && !isSymbol(current)) - : comparator(current, computed) - )) { + ? (current === current && !isSymbol(current)) + : comparator(current, computed) + )) { var computed = current, result = value; } @@ -2480,8 +2480,8 @@ if(_global.BI.prepares == null) { return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); + ? getRawTag(value) + : objectToString(value); } /** @@ -2547,8 +2547,8 @@ if(_global.BI.prepares == null) { } maxLength = nativeMin(array.length, maxLength); caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) - ? new SetCache(othIndex && array) - : undefined; + ? new SetCache(othIndex && array) + : undefined; } array = arrays[0]; @@ -2556,31 +2556,31 @@ if(_global.BI.prepares == null) { seen = caches[0]; outer: - while (++index < length && result.length < maxLength) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (!(seen - ? cacheHas(seen, computed) - : includes(result, computed, comparator) + while (++index < length && result.length < maxLength) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (!(seen + ? cacheHas(seen, computed) + : includes(result, computed, comparator) )) { - othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache - ? cacheHas(cache, computed) - : includes(arrays[othIndex], computed, comparator)) + othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if (!(cache + ? cacheHas(cache, computed) + : includes(arrays[othIndex], computed, comparator)) ) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result.push(value); + continue outer; } } + if (seen) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -2702,8 +2702,8 @@ if(_global.BI.prepares == null) { if (isSameTag && !objIsObj) { stack || (stack = new Stack); return (objIsArr || isTypedArray(object)) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), @@ -2757,9 +2757,9 @@ if(_global.BI.prepares == null) { while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { return false; } } @@ -2779,9 +2779,9 @@ if(_global.BI.prepares == null) { var result = customizer(objValue, srcValue, key, object, source, stack); } if (!(result === undefined - ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) - : result - )) { + ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) + : result + )) { return false; } } @@ -2836,7 +2836,7 @@ if(_global.BI.prepares == null) { */ function baseIsTypedArray(value) { return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } /** @@ -2857,8 +2857,8 @@ if(_global.BI.prepares == null) { } if (typeof value == 'object') { return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); } return property(value); } @@ -2968,8 +2968,8 @@ if(_global.BI.prepares == null) { return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } @@ -2995,8 +2995,8 @@ if(_global.BI.prepares == null) { } else { var newValue = customizer - ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) + : undefined; if (newValue === undefined) { newValue = srcValue; @@ -3031,8 +3031,8 @@ if(_global.BI.prepares == null) { return; } var newValue = customizer - ? customizer(objValue, srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; var isCommon = newValue === undefined; @@ -3239,8 +3239,8 @@ if(_global.BI.prepares == null) { newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { newValue = isObject(objValue) - ? objValue - : (isIndex(path[index + 1]) ? [] : {}); + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); } } assignValue(nested, key, newValue); @@ -3386,30 +3386,30 @@ if(_global.BI.prepares == null) { seen = iteratee ? [] : result; } outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; } } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -3783,8 +3783,8 @@ if(_global.BI.prepares == null) { var key = props[index]; var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; + ? customizer(object[key], source[key], key, object, source) + : undefined; if (newValue === undefined) { newValue = source[key]; @@ -3854,8 +3854,8 @@ if(_global.BI.prepares == null) { guard = length > 2 ? sources[2] : undefined; customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; + ? (length--, customizer) + : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; @@ -4001,14 +4001,14 @@ if(_global.BI.prepares == null) { args[index] = arguments[index]; } var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) - ? [] - : replaceHolders(args, placeholder); + ? [] + : replaceHolders(args, placeholder); length -= holders.length; if (length < arity) { return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, undefined, - args, holders, undefined, undefined, arity - length); + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); } var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return apply(fn, this, args); @@ -4085,8 +4085,8 @@ if(_global.BI.prepares == null) { if (isCurried && length < arity) { var newHolders = replaceHolders(args, placeholder); return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, thisArg, - args, newHolders, argPos, ary, arity - length + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length ); } var thisBinding = isBind ? thisArg : this, @@ -4298,8 +4298,8 @@ if(_global.BI.prepares == null) { partials = newData[3]; holders = newData[4]; arity = newData[9] = newData[9] === undefined - ? (isBindKey ? 0 : func.length) - : nativeMax(newData[9] - length, 0); + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); @@ -4394,8 +4394,8 @@ if(_global.BI.prepares == null) { if (customizer) { var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { @@ -4407,18 +4407,18 @@ if(_global.BI.prepares == null) { // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { - if (!cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { + if (!cacheHas(seen, othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { result = false; break; } } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, bitmask, customizer, stack) - )) { + arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack) + )) { result = false; break; } @@ -4557,14 +4557,14 @@ if(_global.BI.prepares == null) { if (customizer) { var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) - : compared - )) { + ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) + : compared + )) { result = false; break; } @@ -4578,7 +4578,7 @@ if(_global.BI.prepares == null) { if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { + typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } @@ -4677,8 +4677,8 @@ if(_global.BI.prepares == null) { function getMapData(map, key) { var data = map.__data__; return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; } /** @@ -4875,7 +4875,7 @@ if(_global.BI.prepares == null) { } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && - (isArray(object) || isArguments(object)); + (isArray(object) || isArguments(object)); } /** @@ -4906,8 +4906,8 @@ if(_global.BI.prepares == null) { */ function initCloneObject(object) { return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; + ? baseCreate(getPrototype(object)) + : {}; } /** @@ -4986,7 +4986,7 @@ if(_global.BI.prepares == null) { */ function isFlattenable(value) { return isArray(value) || isArguments(value) || - !!(spreadableSymbol && value && value[spreadableSymbol]); + !!(spreadableSymbol && value && value[spreadableSymbol]); } /** @@ -5002,9 +5002,9 @@ if(_global.BI.prepares == null) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); } /** @@ -5023,9 +5023,9 @@ if(_global.BI.prepares == null) { } var type = typeof index; if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { return eq(object[index], value); } return false; @@ -5049,7 +5049,7 @@ if(_global.BI.prepares == null) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object)); + (object != null && value in Object(object)); } /** @@ -5062,8 +5062,8 @@ if(_global.BI.prepares == null) { function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); + ? (value !== '__proto__') + : (value === null); } /** @@ -5140,7 +5140,7 @@ if(_global.BI.prepares == null) { return false; } return object[key] === srcValue && - (srcValue !== undefined || (key in Object(object))); + (srcValue !== undefined || (key in Object(object))); }; } @@ -5187,9 +5187,9 @@ if(_global.BI.prepares == null) { isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); var isCombo = - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || - ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || + ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); // Exit early if metadata can't be merged. if (!(isCommon || isCombo)) { @@ -5579,8 +5579,8 @@ if(_global.BI.prepares == null) { */ var difference = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) - : []; + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) + : []; }); /** @@ -5708,8 +5708,8 @@ if(_global.BI.prepares == null) { if (fromIndex !== undefined) { index = toInteger(fromIndex); index = fromIndex < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1); + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1); } return baseFindIndex(array, baseIteratee(predicate, 3), index, true); } @@ -5848,8 +5848,8 @@ if(_global.BI.prepares == null) { var intersection = baseRest(function(arrays) { var mapped = arrayMap(arrays, castArrayLikeObject); return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped) - : []; + ? baseIntersection(mapped) + : []; }); /** @@ -6124,8 +6124,8 @@ if(_global.BI.prepares == null) { */ var without = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, values) - : []; + ? baseDifference(array, values) + : []; }); /** @@ -7195,8 +7195,8 @@ if(_global.BI.prepares == null) { timeWaiting = wait - timeSinceLastCall; return maxing - ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) - : timeWaiting; + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; } function shouldInvoke(time) { @@ -7207,7 +7207,7 @@ if(_global.BI.prepares == null) { // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { @@ -7646,7 +7646,7 @@ if(_global.BI.prepares == null) { */ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); + !propertyIsEnumerable.call(value, 'callee'); }; /** @@ -7751,7 +7751,7 @@ if(_global.BI.prepares == null) { */ function isBoolean(value) { return value === true || value === false || - (isObjectLike(value) && baseGetTag(value) == boolTag); + (isObjectLike(value) && baseGetTag(value) == boolTag); } /** @@ -7831,7 +7831,7 @@ if(_global.BI.prepares == null) { } if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || - isBuffer(value) || isTypedArray(value) || isArguments(value))) { + isBuffer(value) || isTypedArray(value) || isArguments(value))) { return !value.length; } var tag = getTag(value); @@ -7966,7 +7966,7 @@ if(_global.BI.prepares == null) { */ function isLength(value) { return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -8130,7 +8130,7 @@ if(_global.BI.prepares == null) { */ function isNumber(value) { return typeof value == 'number' || - (isObjectLike(value) && baseGetTag(value) == numberTag); + (isObjectLike(value) && baseGetTag(value) == numberTag); } /** @@ -8171,7 +8171,7 @@ if(_global.BI.prepares == null) { } var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && - funcToString.call(Ctor) == objectCtorString; + funcToString.call(Ctor) == objectCtorString; } /** @@ -8231,7 +8231,7 @@ if(_global.BI.prepares == null) { */ function isString(value) { return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); } /** @@ -8253,7 +8253,7 @@ if(_global.BI.prepares == null) { */ function isSymbol(value) { return typeof value == 'symbol' || - (isObjectLike(value) && baseGetTag(value) == symbolTag); + (isObjectLike(value) && baseGetTag(value) == symbolTag); } /** @@ -8443,8 +8443,8 @@ if(_global.BI.prepares == null) { value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); } /** @@ -9355,8 +9355,8 @@ if(_global.BI.prepares == null) { function escape(string) { string = toString(string); return (string && reHasUnescapedHtml.test(string)) - ? string.replace(reUnescapedHtml, escapeHtmlChar) - : string; + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; } /** @@ -9782,8 +9782,8 @@ if(_global.BI.prepares == null) { */ function max(array) { return (array && array.length) - ? baseExtremum(array, identity, baseGt) - : undefined; + ? baseExtremum(array, identity, baseGt) + : undefined; } /** @@ -9806,8 +9806,8 @@ if(_global.BI.prepares == null) { */ function min(array) { return (array && array.length) - ? baseExtremum(array, identity, baseLt) - : undefined; + ? baseExtremum(array, identity, baseLt) + : undefined; } /*------------------------------------------------------------------------*/ @@ -9953,8 +9953,8 @@ if(_global.BI.prepares == null) { n = n === undefined ? 1 : nativeMax(toInteger(n), 0); var result = (this.__filtered__ && !index) - ? new LazyWrapper(this) - : this.clone(); + ? new LazyWrapper(this) + : this.clone(); if (result.__filtered__) { result.__takeCount__ = nativeMin(n, result.__takeCount__); @@ -10538,7 +10538,7 @@ if (!_global.BI) { // 数组相关的方法 _.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection", - "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) { + "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) { BI[name] = _apply(name); }); _.each(["findIndex", "findLastIndex"], function (name) { @@ -68588,7 +68588,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { attributes: { tabIndex: 0 }, - allowEdit: false + allowEdit: false, + allowSearchValue: false }); }, @@ -68668,6 +68669,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { return { el: { type: "bi.multilayer_select_tree_trigger", + allowSearchValue: o.allowSearchValue, allowEdit: o.allowEdit, cls: "multilayer-select-tree-trigger", ref: function (_ref) { @@ -69025,7 +69027,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { this.tree = new BI.Tree(); - this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items)))); + this.tree.initTree(BI.Tree.treeFormat(o.items)); } var content = { type: "bi.htape", @@ -69079,9 +69081,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { onSearch: function (obj, callback) { var keyword = obj.keyword; if(o.itemsCreator === BI.emptyFn) { - var finding = BI.Func.getSearchResult(o.items, keyword); - var matched = finding.match, find = finding.find; - callback(self._fillTreeStructure4Search(find.concat(matched))); + callback(self._getSearchItems(keyword)); } else { callback(); } @@ -69123,27 +69123,59 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _getSearchItems: function(keyword) { + var o = this.options; + var findingText = BI.Func.getSearchResult(o.items, keyword, "text"); + var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []}; + var textItems = findingText.find.concat(findingText.match); + var valueItems = findingValue.find.concat(findingValue.match); + return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + }, + + _createJson: function(node, open) { + return { + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + isParent: BI.isNotEmptyArray(node.children), + open: open + } + }, + + _getChildren: function(node) { + var self = this; + node.children = node.children || []; + var nodes = []; + BI.each(node.children, function (idx, child) { + var children = self._getChildren(child); + nodes = nodes.concat(children); + }); + return node.children.concat(nodes); + }, + // 将搜索到的节点进行补充,构造成一棵完整的树 _fillTreeStructure4Search: function (leaves) { - var result = BI.map(leaves, "id"); - var queue = leaves.reverse() || []; + var self = this; + var result = []; + var queue = []; + BI.each(leaves, function (idx, node) { + queue.push({pId: node.pId}); + result.push(node); + result = result.concat(self._getChildren(node)); + }); while (BI.isNotEmptyArray(queue)) { var node = queue.pop(); var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { - queue.push(pNode); - result.push(pNode.id); + pNode.open = true; + queue.push({pId: pNode.pId}); + result.push(pNode); } } - var nodes = []; - BI.each(this.options.items, function (idx, item) { - if(BI.contains(result, item.id)) { - nodes.push(BI.extend({}, item, { - open: true - })) - } - }); - return nodes; + return BI.uniqBy(BI.map(result, function (idx, node) { + return self._createJson(node, node.open); + }), "id"); }, _digest: function (v) { @@ -69689,6 +69721,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { return { el: { type: "bi.multilayer_single_tree_trigger", + allowSearchValue: o.allowSearchValue, allowEdit: o.allowEdit, cls: "multilayer-single-tree-trigger", ref: function (_ref) { @@ -70037,7 +70070,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { return v; }, itemsCreator: BI.emptyFn, - watermark: BI.i18nText("BI-Basic_Search") + watermark: BI.i18nText("BI-Basic_Search"), + allowSearchValue: false }; }, @@ -70045,7 +70079,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { this.tree = new BI.Tree(); - this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items)))); + this.tree.initTree(BI.Tree.treeFormat(o.items)); } var content = { type: "bi.htape", @@ -70099,9 +70133,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { onSearch: function (obj, callback) { var keyword = obj.keyword; if(o.itemsCreator === BI.emptyFn) { - var finding = BI.Func.getSearchResult(o.items, keyword); - var matched = finding.match, find = finding.find; - callback(self._fillTreeStructure4Search(find.concat(matched))); + callback(self._getSearchItems(keyword)); } else { callback(); } @@ -70143,27 +70175,59 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _getSearchItems: function(keyword) { + var o = this.options; + var findingText = BI.Func.getSearchResult(o.items, keyword, "text"); + var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []}; + var textItems = findingText.find.concat(findingText.match); + var valueItems = findingValue.find.concat(findingValue.match); + return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + }, + + _createJson: function(node, open) { + return { + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + isParent: BI.isNotEmptyArray(node.children), + open: open + } + }, + + _getChildren: function(node) { + var self = this; + node.children = node.children || []; + var nodes = []; + BI.each(node.children, function (idx, child) { + var children = self._getChildren(child); + nodes = nodes.concat(children); + }); + return node.children.concat(nodes); + }, + // 将搜索到的节点进行补充,构造成一棵完整的树 _fillTreeStructure4Search: function (leaves) { - var result = BI.map(leaves, "id"); - var queue = leaves.reverse() || []; + var self = this; + var result = []; + var queue = []; + BI.each(leaves, function (idx, node) { + queue.push({pId: node.pId}); + result.push(node); + result = result.concat(self._getChildren(node)); + }); while (BI.isNotEmptyArray(queue)) { var node = queue.pop(); var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { - queue.push(pNode); - result.push(pNode.id); + pNode.open = true; + queue.push({pId: pNode.pId}); + result.push(pNode); } } - var nodes = []; - BI.each(this.options.items, function (idx, item) { - if(BI.contains(result, item.id)) { - nodes.push(BI.extend({}, item, { - open: true - })) - } - }); - return nodes; + return BI.uniqBy(BI.map(result, function (idx, node) { + return self._createJson(node, node.open); + }), "id"); }, _digest: function (v) { @@ -87832,11 +87896,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, { }, _isMatch: function (parentValues, value, keyword) { + var o = this.options; var node = this._getTreeNode(parentValues, value); if (!node) { return false; } var find = BI.Func.getSearchResult([node.text || node.value], keyword); + if(o.allowSearchValue && node.value) { + var valueFind = BI.Func.getSearchResult([node.value], keyword); + return valueFind.find.length > 0 || valueFind.match.length > 0 || + find.find.length > 0 || find.match.length > 0; + } return find.find.length > 0 || find.match.length > 0; }, diff --git a/dist/2.0/fineui.js b/dist/2.0/fineui.js index af2ff4900..f48221460 100644 --- a/dist/2.0/fineui.js +++ b/dist/2.0/fineui.js @@ -22,7 +22,7 @@ if(_global.BI.prepares == null) { }/** * @license * Lodash (Custom Build) - * Build: `lodash core plus="debounce,throttle,get,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"` + * Build: `lodash core plus="debounce,throttle,get,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"` * Copyright JS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 @@ -215,34 +215,34 @@ if(_global.BI.prepares == null) { /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = - typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = - typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = - typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = - typedArrayTags[uint32Tag] = true; + typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = + typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = + typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = + typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = - typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = - typedArrayTags[errorTag] = typedArrayTags[funcTag] = - typedArrayTags[mapTag] = typedArrayTags[numberTag] = - typedArrayTags[objectTag] = typedArrayTags[regexpTag] = - typedArrayTags[setTag] = typedArrayTags[stringTag] = - typedArrayTags[weakMapTag] = false; + typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = + typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = + typedArrayTags[errorTag] = typedArrayTags[funcTag] = + typedArrayTags[mapTag] = typedArrayTags[numberTag] = + typedArrayTags[objectTag] = typedArrayTags[regexpTag] = + typedArrayTags[setTag] = typedArrayTags[stringTag] = + typedArrayTags[weakMapTag] = false; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = - cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = - cloneableTags[boolTag] = cloneableTags[dateTag] = - cloneableTags[float32Tag] = cloneableTags[float64Tag] = - cloneableTags[int8Tag] = cloneableTags[int16Tag] = - cloneableTags[int32Tag] = cloneableTags[mapTag] = - cloneableTags[numberTag] = cloneableTags[objectTag] = - cloneableTags[regexpTag] = cloneableTags[setTag] = - cloneableTags[stringTag] = cloneableTags[symbolTag] = - cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = - cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = + cloneableTags[boolTag] = cloneableTags[dateTag] = + cloneableTags[float32Tag] = cloneableTags[float64Tag] = + cloneableTags[int8Tag] = cloneableTags[int16Tag] = + cloneableTags[int32Tag] = cloneableTags[mapTag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[setTag] = + cloneableTags[stringTag] = cloneableTags[symbolTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = - cloneableTags[weakMapTag] = false; + cloneableTags[weakMapTag] = false; /** Used to map characters to HTML entities. */ var htmlEscapes = { @@ -599,8 +599,8 @@ if(_global.BI.prepares == null) { */ function baseIndexOf(array, value, fromIndex) { return value === value - ? strictIndexOf(array, value, fromIndex) - : baseFindIndex(array, baseIsNaN, fromIndex); + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); } /** @@ -656,8 +656,8 @@ if(_global.BI.prepares == null) { function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { eachFunc(collection, function(value, index, collection) { accumulator = initAccum - ? (initAccum = false, value) - : iteratee(accumulator, value, index, collection); + ? (initAccum = false, value) + : iteratee(accumulator, value, index, collection); }); return accumulator; } @@ -910,8 +910,8 @@ if(_global.BI.prepares == null) { */ function safeGet(object, key) { return key == '__proto__' - ? undefined - : object[key]; + ? undefined + : object[key]; } /** @@ -962,8 +962,8 @@ if(_global.BI.prepares == null) { */ function stringSize(string) { return hasUnicode(string) - ? unicodeSize(string) - : asciiSize(string); + ? unicodeSize(string) + : asciiSize(string); } /** @@ -975,8 +975,8 @@ if(_global.BI.prepares == null) { */ function stringToArray(string) { return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); + ? unicodeToArray(string) + : asciiToArray(string); } /** @@ -1045,8 +1045,8 @@ if(_global.BI.prepares == null) { /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ @@ -1383,30 +1383,30 @@ if(_global.BI.prepares == null) { var result = []; outer: - while (length-- && resIndex < takeCount) { - index += dir; - - var iterIndex = -1, - value = array[index]; - - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], - iteratee = data.iteratee, - type = data.type, - computed = iteratee(value); - - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } - } + while (length-- && resIndex < takeCount) { + index += dir; + + var iterIndex = -1, + value = array[index]; + + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], + iteratee = data.iteratee, + type = data.type, + computed = iteratee(value); + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; } - result[resIndex++] = value; } + } + result[resIndex++] = value; + } return result; } @@ -1914,14 +1914,14 @@ if(_global.BI.prepares == null) { for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) ))) { result.push(key); } @@ -2136,8 +2136,8 @@ if(_global.BI.prepares == null) { result = (isFlat || isFunc) ? {} : initCloneObject(value); if (!isDeep) { return isFlat - ? copySymbolsIn(value, baseAssignIn(result, value)) - : copySymbols(value, baseAssign(result, value)); + ? copySymbolsIn(value, baseAssignIn(result, value)) + : copySymbols(value, baseAssign(result, value)); } } else { if (!cloneableTags[tag]) { @@ -2171,8 +2171,8 @@ if(_global.BI.prepares == null) { } var keysFunc = isFull - ? (isFlat ? getAllKeysIn : getAllKeys) - : (isFlat ? keysIn : keys); + ? (isFlat ? getAllKeysIn : getAllKeys) + : (isFlat ? keysIn : keys); var props = isArr ? undefined : keysFunc(value); arrayEach(props || value, function(subValue, key) { @@ -2238,24 +2238,24 @@ if(_global.BI.prepares == null) { values = new SetCache(values); } outer: - while (++index < length) { - var value = array[index], - computed = iteratee == null ? value : iteratee(value); - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee == null ? value : iteratee(value); + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === computed) { + continue outer; } } + result.push(value); + } + else if (!includes(values, computed, comparator)) { + result.push(value); + } + } return result; } @@ -2306,9 +2306,9 @@ if(_global.BI.prepares == null) { current = iteratee(value); if (current != null && (computed === undefined - ? (current === current && !isSymbol(current)) - : comparator(current, computed) - )) { + ? (current === current && !isSymbol(current)) + : comparator(current, computed) + )) { var computed = current, result = value; } @@ -2480,8 +2480,8 @@ if(_global.BI.prepares == null) { return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); + ? getRawTag(value) + : objectToString(value); } /** @@ -2547,8 +2547,8 @@ if(_global.BI.prepares == null) { } maxLength = nativeMin(array.length, maxLength); caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) - ? new SetCache(othIndex && array) - : undefined; + ? new SetCache(othIndex && array) + : undefined; } array = arrays[0]; @@ -2556,31 +2556,31 @@ if(_global.BI.prepares == null) { seen = caches[0]; outer: - while (++index < length && result.length < maxLength) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (!(seen - ? cacheHas(seen, computed) - : includes(result, computed, comparator) + while (++index < length && result.length < maxLength) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (!(seen + ? cacheHas(seen, computed) + : includes(result, computed, comparator) )) { - othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache - ? cacheHas(cache, computed) - : includes(arrays[othIndex], computed, comparator)) + othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if (!(cache + ? cacheHas(cache, computed) + : includes(arrays[othIndex], computed, comparator)) ) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result.push(value); + continue outer; } } + if (seen) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -2702,8 +2702,8 @@ if(_global.BI.prepares == null) { if (isSameTag && !objIsObj) { stack || (stack = new Stack); return (objIsArr || isTypedArray(object)) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), @@ -2757,9 +2757,9 @@ if(_global.BI.prepares == null) { while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { return false; } } @@ -2779,9 +2779,9 @@ if(_global.BI.prepares == null) { var result = customizer(objValue, srcValue, key, object, source, stack); } if (!(result === undefined - ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) - : result - )) { + ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) + : result + )) { return false; } } @@ -2836,7 +2836,7 @@ if(_global.BI.prepares == null) { */ function baseIsTypedArray(value) { return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } /** @@ -2857,8 +2857,8 @@ if(_global.BI.prepares == null) { } if (typeof value == 'object') { return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); } return property(value); } @@ -2968,8 +2968,8 @@ if(_global.BI.prepares == null) { return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } @@ -2995,8 +2995,8 @@ if(_global.BI.prepares == null) { } else { var newValue = customizer - ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) + : undefined; if (newValue === undefined) { newValue = srcValue; @@ -3031,8 +3031,8 @@ if(_global.BI.prepares == null) { return; } var newValue = customizer - ? customizer(objValue, srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; var isCommon = newValue === undefined; @@ -3239,8 +3239,8 @@ if(_global.BI.prepares == null) { newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { newValue = isObject(objValue) - ? objValue - : (isIndex(path[index + 1]) ? [] : {}); + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); } } assignValue(nested, key, newValue); @@ -3386,30 +3386,30 @@ if(_global.BI.prepares == null) { seen = iteratee ? [] : result; } outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; } } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -3783,8 +3783,8 @@ if(_global.BI.prepares == null) { var key = props[index]; var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; + ? customizer(object[key], source[key], key, object, source) + : undefined; if (newValue === undefined) { newValue = source[key]; @@ -3854,8 +3854,8 @@ if(_global.BI.prepares == null) { guard = length > 2 ? sources[2] : undefined; customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; + ? (length--, customizer) + : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; @@ -4001,14 +4001,14 @@ if(_global.BI.prepares == null) { args[index] = arguments[index]; } var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) - ? [] - : replaceHolders(args, placeholder); + ? [] + : replaceHolders(args, placeholder); length -= holders.length; if (length < arity) { return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, undefined, - args, holders, undefined, undefined, arity - length); + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); } var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return apply(fn, this, args); @@ -4085,8 +4085,8 @@ if(_global.BI.prepares == null) { if (isCurried && length < arity) { var newHolders = replaceHolders(args, placeholder); return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, thisArg, - args, newHolders, argPos, ary, arity - length + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length ); } var thisBinding = isBind ? thisArg : this, @@ -4298,8 +4298,8 @@ if(_global.BI.prepares == null) { partials = newData[3]; holders = newData[4]; arity = newData[9] = newData[9] === undefined - ? (isBindKey ? 0 : func.length) - : nativeMax(newData[9] - length, 0); + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); @@ -4394,8 +4394,8 @@ if(_global.BI.prepares == null) { if (customizer) { var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { @@ -4407,18 +4407,18 @@ if(_global.BI.prepares == null) { // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { - if (!cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { + if (!cacheHas(seen, othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { result = false; break; } } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, bitmask, customizer, stack) - )) { + arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack) + )) { result = false; break; } @@ -4557,14 +4557,14 @@ if(_global.BI.prepares == null) { if (customizer) { var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) - : compared - )) { + ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) + : compared + )) { result = false; break; } @@ -4578,7 +4578,7 @@ if(_global.BI.prepares == null) { if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { + typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } @@ -4677,8 +4677,8 @@ if(_global.BI.prepares == null) { function getMapData(map, key) { var data = map.__data__; return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; } /** @@ -4875,7 +4875,7 @@ if(_global.BI.prepares == null) { } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && - (isArray(object) || isArguments(object)); + (isArray(object) || isArguments(object)); } /** @@ -4906,8 +4906,8 @@ if(_global.BI.prepares == null) { */ function initCloneObject(object) { return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; + ? baseCreate(getPrototype(object)) + : {}; } /** @@ -4986,7 +4986,7 @@ if(_global.BI.prepares == null) { */ function isFlattenable(value) { return isArray(value) || isArguments(value) || - !!(spreadableSymbol && value && value[spreadableSymbol]); + !!(spreadableSymbol && value && value[spreadableSymbol]); } /** @@ -5002,9 +5002,9 @@ if(_global.BI.prepares == null) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); } /** @@ -5023,9 +5023,9 @@ if(_global.BI.prepares == null) { } var type = typeof index; if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { return eq(object[index], value); } return false; @@ -5049,7 +5049,7 @@ if(_global.BI.prepares == null) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object)); + (object != null && value in Object(object)); } /** @@ -5062,8 +5062,8 @@ if(_global.BI.prepares == null) { function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); + ? (value !== '__proto__') + : (value === null); } /** @@ -5140,7 +5140,7 @@ if(_global.BI.prepares == null) { return false; } return object[key] === srcValue && - (srcValue !== undefined || (key in Object(object))); + (srcValue !== undefined || (key in Object(object))); }; } @@ -5187,9 +5187,9 @@ if(_global.BI.prepares == null) { isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); var isCombo = - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || - ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || + ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); // Exit early if metadata can't be merged. if (!(isCommon || isCombo)) { @@ -5579,8 +5579,8 @@ if(_global.BI.prepares == null) { */ var difference = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) - : []; + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) + : []; }); /** @@ -5708,8 +5708,8 @@ if(_global.BI.prepares == null) { if (fromIndex !== undefined) { index = toInteger(fromIndex); index = fromIndex < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1); + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1); } return baseFindIndex(array, baseIteratee(predicate, 3), index, true); } @@ -5848,8 +5848,8 @@ if(_global.BI.prepares == null) { var intersection = baseRest(function(arrays) { var mapped = arrayMap(arrays, castArrayLikeObject); return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped) - : []; + ? baseIntersection(mapped) + : []; }); /** @@ -6124,8 +6124,8 @@ if(_global.BI.prepares == null) { */ var without = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, values) - : []; + ? baseDifference(array, values) + : []; }); /** @@ -7195,8 +7195,8 @@ if(_global.BI.prepares == null) { timeWaiting = wait - timeSinceLastCall; return maxing - ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) - : timeWaiting; + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; } function shouldInvoke(time) { @@ -7207,7 +7207,7 @@ if(_global.BI.prepares == null) { // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { @@ -7646,7 +7646,7 @@ if(_global.BI.prepares == null) { */ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); + !propertyIsEnumerable.call(value, 'callee'); }; /** @@ -7751,7 +7751,7 @@ if(_global.BI.prepares == null) { */ function isBoolean(value) { return value === true || value === false || - (isObjectLike(value) && baseGetTag(value) == boolTag); + (isObjectLike(value) && baseGetTag(value) == boolTag); } /** @@ -7831,7 +7831,7 @@ if(_global.BI.prepares == null) { } if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || - isBuffer(value) || isTypedArray(value) || isArguments(value))) { + isBuffer(value) || isTypedArray(value) || isArguments(value))) { return !value.length; } var tag = getTag(value); @@ -7966,7 +7966,7 @@ if(_global.BI.prepares == null) { */ function isLength(value) { return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -8130,7 +8130,7 @@ if(_global.BI.prepares == null) { */ function isNumber(value) { return typeof value == 'number' || - (isObjectLike(value) && baseGetTag(value) == numberTag); + (isObjectLike(value) && baseGetTag(value) == numberTag); } /** @@ -8171,7 +8171,7 @@ if(_global.BI.prepares == null) { } var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && - funcToString.call(Ctor) == objectCtorString; + funcToString.call(Ctor) == objectCtorString; } /** @@ -8231,7 +8231,7 @@ if(_global.BI.prepares == null) { */ function isString(value) { return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); } /** @@ -8253,7 +8253,7 @@ if(_global.BI.prepares == null) { */ function isSymbol(value) { return typeof value == 'symbol' || - (isObjectLike(value) && baseGetTag(value) == symbolTag); + (isObjectLike(value) && baseGetTag(value) == symbolTag); } /** @@ -8443,8 +8443,8 @@ if(_global.BI.prepares == null) { value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); } /** @@ -9355,8 +9355,8 @@ if(_global.BI.prepares == null) { function escape(string) { string = toString(string); return (string && reHasUnescapedHtml.test(string)) - ? string.replace(reUnescapedHtml, escapeHtmlChar) - : string; + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; } /** @@ -9782,8 +9782,8 @@ if(_global.BI.prepares == null) { */ function max(array) { return (array && array.length) - ? baseExtremum(array, identity, baseGt) - : undefined; + ? baseExtremum(array, identity, baseGt) + : undefined; } /** @@ -9806,8 +9806,8 @@ if(_global.BI.prepares == null) { */ function min(array) { return (array && array.length) - ? baseExtremum(array, identity, baseLt) - : undefined; + ? baseExtremum(array, identity, baseLt) + : undefined; } /*------------------------------------------------------------------------*/ @@ -9953,8 +9953,8 @@ if(_global.BI.prepares == null) { n = n === undefined ? 1 : nativeMax(toInteger(n), 0); var result = (this.__filtered__ && !index) - ? new LazyWrapper(this) - : this.clone(); + ? new LazyWrapper(this) + : this.clone(); if (result.__filtered__) { result.__takeCount__ = nativeMin(n, result.__takeCount__); @@ -10538,7 +10538,7 @@ if (!_global.BI) { // 数组相关的方法 _.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection", - "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) { + "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) { BI[name] = _apply(name); }); _.each(["findIndex", "findLastIndex"], function (name) { @@ -68992,7 +68992,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { attributes: { tabIndex: 0 }, - allowEdit: false + allowEdit: false, + allowSearchValue: false }); }, @@ -69072,6 +69073,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { return { el: { type: "bi.multilayer_select_tree_trigger", + allowSearchValue: o.allowSearchValue, allowEdit: o.allowEdit, cls: "multilayer-select-tree-trigger", ref: function (_ref) { @@ -69429,7 +69431,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { this.tree = new BI.Tree(); - this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items)))); + this.tree.initTree(BI.Tree.treeFormat(o.items)); } var content = { type: "bi.htape", @@ -69483,9 +69485,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { onSearch: function (obj, callback) { var keyword = obj.keyword; if(o.itemsCreator === BI.emptyFn) { - var finding = BI.Func.getSearchResult(o.items, keyword); - var matched = finding.match, find = finding.find; - callback(self._fillTreeStructure4Search(find.concat(matched))); + callback(self._getSearchItems(keyword)); } else { callback(); } @@ -69527,27 +69527,59 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _getSearchItems: function(keyword) { + var o = this.options; + var findingText = BI.Func.getSearchResult(o.items, keyword, "text"); + var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []}; + var textItems = findingText.find.concat(findingText.match); + var valueItems = findingValue.find.concat(findingValue.match); + return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + }, + + _createJson: function(node, open) { + return { + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + isParent: BI.isNotEmptyArray(node.children), + open: open + } + }, + + _getChildren: function(node) { + var self = this; + node.children = node.children || []; + var nodes = []; + BI.each(node.children, function (idx, child) { + var children = self._getChildren(child); + nodes = nodes.concat(children); + }); + return node.children.concat(nodes); + }, + // 将搜索到的节点进行补充,构造成一棵完整的树 _fillTreeStructure4Search: function (leaves) { - var result = BI.map(leaves, "id"); - var queue = leaves.reverse() || []; + var self = this; + var result = []; + var queue = []; + BI.each(leaves, function (idx, node) { + queue.push({pId: node.pId}); + result.push(node); + result = result.concat(self._getChildren(node)); + }); while (BI.isNotEmptyArray(queue)) { var node = queue.pop(); var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { - queue.push(pNode); - result.push(pNode.id); + pNode.open = true; + queue.push({pId: pNode.pId}); + result.push(pNode); } } - var nodes = []; - BI.each(this.options.items, function (idx, item) { - if(BI.contains(result, item.id)) { - nodes.push(BI.extend({}, item, { - open: true - })) - } - }); - return nodes; + return BI.uniqBy(BI.map(result, function (idx, node) { + return self._createJson(node, node.open); + }), "id"); }, _digest: function (v) { @@ -70093,6 +70125,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { return { el: { type: "bi.multilayer_single_tree_trigger", + allowSearchValue: o.allowSearchValue, allowEdit: o.allowEdit, cls: "multilayer-single-tree-trigger", ref: function (_ref) { @@ -70441,7 +70474,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { return v; }, itemsCreator: BI.emptyFn, - watermark: BI.i18nText("BI-Basic_Search") + watermark: BI.i18nText("BI-Basic_Search"), + allowSearchValue: false }; }, @@ -70449,7 +70483,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { this.tree = new BI.Tree(); - this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items)))); + this.tree.initTree(BI.Tree.treeFormat(o.items)); } var content = { type: "bi.htape", @@ -70503,9 +70537,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { onSearch: function (obj, callback) { var keyword = obj.keyword; if(o.itemsCreator === BI.emptyFn) { - var finding = BI.Func.getSearchResult(o.items, keyword); - var matched = finding.match, find = finding.find; - callback(self._fillTreeStructure4Search(find.concat(matched))); + callback(self._getSearchItems(keyword)); } else { callback(); } @@ -70547,27 +70579,59 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _getSearchItems: function(keyword) { + var o = this.options; + var findingText = BI.Func.getSearchResult(o.items, keyword, "text"); + var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []}; + var textItems = findingText.find.concat(findingText.match); + var valueItems = findingValue.find.concat(findingValue.match); + return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + }, + + _createJson: function(node, open) { + return { + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + isParent: BI.isNotEmptyArray(node.children), + open: open + } + }, + + _getChildren: function(node) { + var self = this; + node.children = node.children || []; + var nodes = []; + BI.each(node.children, function (idx, child) { + var children = self._getChildren(child); + nodes = nodes.concat(children); + }); + return node.children.concat(nodes); + }, + // 将搜索到的节点进行补充,构造成一棵完整的树 _fillTreeStructure4Search: function (leaves) { - var result = BI.map(leaves, "id"); - var queue = leaves.reverse() || []; + var self = this; + var result = []; + var queue = []; + BI.each(leaves, function (idx, node) { + queue.push({pId: node.pId}); + result.push(node); + result = result.concat(self._getChildren(node)); + }); while (BI.isNotEmptyArray(queue)) { var node = queue.pop(); var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { - queue.push(pNode); - result.push(pNode.id); + pNode.open = true; + queue.push({pId: pNode.pId}); + result.push(pNode); } } - var nodes = []; - BI.each(this.options.items, function (idx, item) { - if(BI.contains(result, item.id)) { - nodes.push(BI.extend({}, item, { - open: true - })) - } - }); - return nodes; + return BI.uniqBy(BI.map(result, function (idx, node) { + return self._createJson(node, node.open); + }), "id"); }, _digest: function (v) { @@ -88236,11 +88300,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, { }, _isMatch: function (parentValues, value, keyword) { + var o = this.options; var node = this._getTreeNode(parentValues, value); if (!node) { return false; } var find = BI.Func.getSearchResult([node.text || node.value], keyword); + if(o.allowSearchValue && node.value) { + var valueFind = BI.Func.getSearchResult([node.value], keyword); + return valueFind.find.length > 0 || valueFind.match.length > 0 || + find.find.length > 0 || find.match.length > 0; + } return find.find.length > 0 || find.match.length > 0; }, diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js index ec2ce49c8..af0def4e0 100644 --- a/dist/bundle.ie.js +++ b/dist/bundle.ie.js @@ -22,7 +22,7 @@ if(_global.BI.prepares == null) { }/** * @license * Lodash (Custom Build) - * Build: `lodash core plus="debounce,throttle,get,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"` + * Build: `lodash core plus="debounce,throttle,get,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"` * Copyright JS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 @@ -215,34 +215,34 @@ if(_global.BI.prepares == null) { /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = - typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = - typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = - typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = - typedArrayTags[uint32Tag] = true; + typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = + typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = + typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = + typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = - typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = - typedArrayTags[errorTag] = typedArrayTags[funcTag] = - typedArrayTags[mapTag] = typedArrayTags[numberTag] = - typedArrayTags[objectTag] = typedArrayTags[regexpTag] = - typedArrayTags[setTag] = typedArrayTags[stringTag] = - typedArrayTags[weakMapTag] = false; + typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = + typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = + typedArrayTags[errorTag] = typedArrayTags[funcTag] = + typedArrayTags[mapTag] = typedArrayTags[numberTag] = + typedArrayTags[objectTag] = typedArrayTags[regexpTag] = + typedArrayTags[setTag] = typedArrayTags[stringTag] = + typedArrayTags[weakMapTag] = false; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = - cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = - cloneableTags[boolTag] = cloneableTags[dateTag] = - cloneableTags[float32Tag] = cloneableTags[float64Tag] = - cloneableTags[int8Tag] = cloneableTags[int16Tag] = - cloneableTags[int32Tag] = cloneableTags[mapTag] = - cloneableTags[numberTag] = cloneableTags[objectTag] = - cloneableTags[regexpTag] = cloneableTags[setTag] = - cloneableTags[stringTag] = cloneableTags[symbolTag] = - cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = - cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = + cloneableTags[boolTag] = cloneableTags[dateTag] = + cloneableTags[float32Tag] = cloneableTags[float64Tag] = + cloneableTags[int8Tag] = cloneableTags[int16Tag] = + cloneableTags[int32Tag] = cloneableTags[mapTag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[setTag] = + cloneableTags[stringTag] = cloneableTags[symbolTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = - cloneableTags[weakMapTag] = false; + cloneableTags[weakMapTag] = false; /** Used to map characters to HTML entities. */ var htmlEscapes = { @@ -599,8 +599,8 @@ if(_global.BI.prepares == null) { */ function baseIndexOf(array, value, fromIndex) { return value === value - ? strictIndexOf(array, value, fromIndex) - : baseFindIndex(array, baseIsNaN, fromIndex); + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); } /** @@ -656,8 +656,8 @@ if(_global.BI.prepares == null) { function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { eachFunc(collection, function(value, index, collection) { accumulator = initAccum - ? (initAccum = false, value) - : iteratee(accumulator, value, index, collection); + ? (initAccum = false, value) + : iteratee(accumulator, value, index, collection); }); return accumulator; } @@ -910,8 +910,8 @@ if(_global.BI.prepares == null) { */ function safeGet(object, key) { return key == '__proto__' - ? undefined - : object[key]; + ? undefined + : object[key]; } /** @@ -962,8 +962,8 @@ if(_global.BI.prepares == null) { */ function stringSize(string) { return hasUnicode(string) - ? unicodeSize(string) - : asciiSize(string); + ? unicodeSize(string) + : asciiSize(string); } /** @@ -975,8 +975,8 @@ if(_global.BI.prepares == null) { */ function stringToArray(string) { return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); + ? unicodeToArray(string) + : asciiToArray(string); } /** @@ -1045,8 +1045,8 @@ if(_global.BI.prepares == null) { /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ @@ -1383,30 +1383,30 @@ if(_global.BI.prepares == null) { var result = []; outer: - while (length-- && resIndex < takeCount) { - index += dir; - - var iterIndex = -1, - value = array[index]; - - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], - iteratee = data.iteratee, - type = data.type, - computed = iteratee(value); - - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } - } + while (length-- && resIndex < takeCount) { + index += dir; + + var iterIndex = -1, + value = array[index]; + + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], + iteratee = data.iteratee, + type = data.type, + computed = iteratee(value); + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; } - result[resIndex++] = value; } + } + result[resIndex++] = value; + } return result; } @@ -1914,14 +1914,14 @@ if(_global.BI.prepares == null) { for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) ))) { result.push(key); } @@ -2136,8 +2136,8 @@ if(_global.BI.prepares == null) { result = (isFlat || isFunc) ? {} : initCloneObject(value); if (!isDeep) { return isFlat - ? copySymbolsIn(value, baseAssignIn(result, value)) - : copySymbols(value, baseAssign(result, value)); + ? copySymbolsIn(value, baseAssignIn(result, value)) + : copySymbols(value, baseAssign(result, value)); } } else { if (!cloneableTags[tag]) { @@ -2171,8 +2171,8 @@ if(_global.BI.prepares == null) { } var keysFunc = isFull - ? (isFlat ? getAllKeysIn : getAllKeys) - : (isFlat ? keysIn : keys); + ? (isFlat ? getAllKeysIn : getAllKeys) + : (isFlat ? keysIn : keys); var props = isArr ? undefined : keysFunc(value); arrayEach(props || value, function(subValue, key) { @@ -2238,24 +2238,24 @@ if(_global.BI.prepares == null) { values = new SetCache(values); } outer: - while (++index < length) { - var value = array[index], - computed = iteratee == null ? value : iteratee(value); - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee == null ? value : iteratee(value); + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === computed) { + continue outer; } } + result.push(value); + } + else if (!includes(values, computed, comparator)) { + result.push(value); + } + } return result; } @@ -2306,9 +2306,9 @@ if(_global.BI.prepares == null) { current = iteratee(value); if (current != null && (computed === undefined - ? (current === current && !isSymbol(current)) - : comparator(current, computed) - )) { + ? (current === current && !isSymbol(current)) + : comparator(current, computed) + )) { var computed = current, result = value; } @@ -2480,8 +2480,8 @@ if(_global.BI.prepares == null) { return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); + ? getRawTag(value) + : objectToString(value); } /** @@ -2547,8 +2547,8 @@ if(_global.BI.prepares == null) { } maxLength = nativeMin(array.length, maxLength); caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) - ? new SetCache(othIndex && array) - : undefined; + ? new SetCache(othIndex && array) + : undefined; } array = arrays[0]; @@ -2556,31 +2556,31 @@ if(_global.BI.prepares == null) { seen = caches[0]; outer: - while (++index < length && result.length < maxLength) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (!(seen - ? cacheHas(seen, computed) - : includes(result, computed, comparator) + while (++index < length && result.length < maxLength) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (!(seen + ? cacheHas(seen, computed) + : includes(result, computed, comparator) )) { - othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache - ? cacheHas(cache, computed) - : includes(arrays[othIndex], computed, comparator)) + othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if (!(cache + ? cacheHas(cache, computed) + : includes(arrays[othIndex], computed, comparator)) ) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result.push(value); + continue outer; } } + if (seen) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -2702,8 +2702,8 @@ if(_global.BI.prepares == null) { if (isSameTag && !objIsObj) { stack || (stack = new Stack); return (objIsArr || isTypedArray(object)) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), @@ -2757,9 +2757,9 @@ if(_global.BI.prepares == null) { while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { return false; } } @@ -2779,9 +2779,9 @@ if(_global.BI.prepares == null) { var result = customizer(objValue, srcValue, key, object, source, stack); } if (!(result === undefined - ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) - : result - )) { + ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) + : result + )) { return false; } } @@ -2836,7 +2836,7 @@ if(_global.BI.prepares == null) { */ function baseIsTypedArray(value) { return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } /** @@ -2857,8 +2857,8 @@ if(_global.BI.prepares == null) { } if (typeof value == 'object') { return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); } return property(value); } @@ -2968,8 +2968,8 @@ if(_global.BI.prepares == null) { return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } @@ -2995,8 +2995,8 @@ if(_global.BI.prepares == null) { } else { var newValue = customizer - ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) + : undefined; if (newValue === undefined) { newValue = srcValue; @@ -3031,8 +3031,8 @@ if(_global.BI.prepares == null) { return; } var newValue = customizer - ? customizer(objValue, srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; var isCommon = newValue === undefined; @@ -3239,8 +3239,8 @@ if(_global.BI.prepares == null) { newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { newValue = isObject(objValue) - ? objValue - : (isIndex(path[index + 1]) ? [] : {}); + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); } } assignValue(nested, key, newValue); @@ -3386,30 +3386,30 @@ if(_global.BI.prepares == null) { seen = iteratee ? [] : result; } outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; } } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -3783,8 +3783,8 @@ if(_global.BI.prepares == null) { var key = props[index]; var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; + ? customizer(object[key], source[key], key, object, source) + : undefined; if (newValue === undefined) { newValue = source[key]; @@ -3854,8 +3854,8 @@ if(_global.BI.prepares == null) { guard = length > 2 ? sources[2] : undefined; customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; + ? (length--, customizer) + : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; @@ -4001,14 +4001,14 @@ if(_global.BI.prepares == null) { args[index] = arguments[index]; } var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) - ? [] - : replaceHolders(args, placeholder); + ? [] + : replaceHolders(args, placeholder); length -= holders.length; if (length < arity) { return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, undefined, - args, holders, undefined, undefined, arity - length); + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); } var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return apply(fn, this, args); @@ -4085,8 +4085,8 @@ if(_global.BI.prepares == null) { if (isCurried && length < arity) { var newHolders = replaceHolders(args, placeholder); return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, thisArg, - args, newHolders, argPos, ary, arity - length + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length ); } var thisBinding = isBind ? thisArg : this, @@ -4298,8 +4298,8 @@ if(_global.BI.prepares == null) { partials = newData[3]; holders = newData[4]; arity = newData[9] = newData[9] === undefined - ? (isBindKey ? 0 : func.length) - : nativeMax(newData[9] - length, 0); + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); @@ -4394,8 +4394,8 @@ if(_global.BI.prepares == null) { if (customizer) { var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { @@ -4407,18 +4407,18 @@ if(_global.BI.prepares == null) { // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { - if (!cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { + if (!cacheHas(seen, othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { result = false; break; } } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, bitmask, customizer, stack) - )) { + arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack) + )) { result = false; break; } @@ -4557,14 +4557,14 @@ if(_global.BI.prepares == null) { if (customizer) { var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) - : compared - )) { + ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) + : compared + )) { result = false; break; } @@ -4578,7 +4578,7 @@ if(_global.BI.prepares == null) { if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { + typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } @@ -4677,8 +4677,8 @@ if(_global.BI.prepares == null) { function getMapData(map, key) { var data = map.__data__; return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; } /** @@ -4875,7 +4875,7 @@ if(_global.BI.prepares == null) { } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && - (isArray(object) || isArguments(object)); + (isArray(object) || isArguments(object)); } /** @@ -4906,8 +4906,8 @@ if(_global.BI.prepares == null) { */ function initCloneObject(object) { return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; + ? baseCreate(getPrototype(object)) + : {}; } /** @@ -4986,7 +4986,7 @@ if(_global.BI.prepares == null) { */ function isFlattenable(value) { return isArray(value) || isArguments(value) || - !!(spreadableSymbol && value && value[spreadableSymbol]); + !!(spreadableSymbol && value && value[spreadableSymbol]); } /** @@ -5002,9 +5002,9 @@ if(_global.BI.prepares == null) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); } /** @@ -5023,9 +5023,9 @@ if(_global.BI.prepares == null) { } var type = typeof index; if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { return eq(object[index], value); } return false; @@ -5049,7 +5049,7 @@ if(_global.BI.prepares == null) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object)); + (object != null && value in Object(object)); } /** @@ -5062,8 +5062,8 @@ if(_global.BI.prepares == null) { function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); + ? (value !== '__proto__') + : (value === null); } /** @@ -5140,7 +5140,7 @@ if(_global.BI.prepares == null) { return false; } return object[key] === srcValue && - (srcValue !== undefined || (key in Object(object))); + (srcValue !== undefined || (key in Object(object))); }; } @@ -5187,9 +5187,9 @@ if(_global.BI.prepares == null) { isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); var isCombo = - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || - ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || + ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); // Exit early if metadata can't be merged. if (!(isCommon || isCombo)) { @@ -5579,8 +5579,8 @@ if(_global.BI.prepares == null) { */ var difference = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) - : []; + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) + : []; }); /** @@ -5708,8 +5708,8 @@ if(_global.BI.prepares == null) { if (fromIndex !== undefined) { index = toInteger(fromIndex); index = fromIndex < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1); + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1); } return baseFindIndex(array, baseIteratee(predicate, 3), index, true); } @@ -5848,8 +5848,8 @@ if(_global.BI.prepares == null) { var intersection = baseRest(function(arrays) { var mapped = arrayMap(arrays, castArrayLikeObject); return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped) - : []; + ? baseIntersection(mapped) + : []; }); /** @@ -6124,8 +6124,8 @@ if(_global.BI.prepares == null) { */ var without = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, values) - : []; + ? baseDifference(array, values) + : []; }); /** @@ -7195,8 +7195,8 @@ if(_global.BI.prepares == null) { timeWaiting = wait - timeSinceLastCall; return maxing - ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) - : timeWaiting; + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; } function shouldInvoke(time) { @@ -7207,7 +7207,7 @@ if(_global.BI.prepares == null) { // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { @@ -7646,7 +7646,7 @@ if(_global.BI.prepares == null) { */ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); + !propertyIsEnumerable.call(value, 'callee'); }; /** @@ -7751,7 +7751,7 @@ if(_global.BI.prepares == null) { */ function isBoolean(value) { return value === true || value === false || - (isObjectLike(value) && baseGetTag(value) == boolTag); + (isObjectLike(value) && baseGetTag(value) == boolTag); } /** @@ -7831,7 +7831,7 @@ if(_global.BI.prepares == null) { } if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || - isBuffer(value) || isTypedArray(value) || isArguments(value))) { + isBuffer(value) || isTypedArray(value) || isArguments(value))) { return !value.length; } var tag = getTag(value); @@ -7966,7 +7966,7 @@ if(_global.BI.prepares == null) { */ function isLength(value) { return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -8130,7 +8130,7 @@ if(_global.BI.prepares == null) { */ function isNumber(value) { return typeof value == 'number' || - (isObjectLike(value) && baseGetTag(value) == numberTag); + (isObjectLike(value) && baseGetTag(value) == numberTag); } /** @@ -8171,7 +8171,7 @@ if(_global.BI.prepares == null) { } var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && - funcToString.call(Ctor) == objectCtorString; + funcToString.call(Ctor) == objectCtorString; } /** @@ -8231,7 +8231,7 @@ if(_global.BI.prepares == null) { */ function isString(value) { return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); } /** @@ -8253,7 +8253,7 @@ if(_global.BI.prepares == null) { */ function isSymbol(value) { return typeof value == 'symbol' || - (isObjectLike(value) && baseGetTag(value) == symbolTag); + (isObjectLike(value) && baseGetTag(value) == symbolTag); } /** @@ -8443,8 +8443,8 @@ if(_global.BI.prepares == null) { value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); } /** @@ -9355,8 +9355,8 @@ if(_global.BI.prepares == null) { function escape(string) { string = toString(string); return (string && reHasUnescapedHtml.test(string)) - ? string.replace(reUnescapedHtml, escapeHtmlChar) - : string; + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; } /** @@ -9782,8 +9782,8 @@ if(_global.BI.prepares == null) { */ function max(array) { return (array && array.length) - ? baseExtremum(array, identity, baseGt) - : undefined; + ? baseExtremum(array, identity, baseGt) + : undefined; } /** @@ -9806,8 +9806,8 @@ if(_global.BI.prepares == null) { */ function min(array) { return (array && array.length) - ? baseExtremum(array, identity, baseLt) - : undefined; + ? baseExtremum(array, identity, baseLt) + : undefined; } /*------------------------------------------------------------------------*/ @@ -9953,8 +9953,8 @@ if(_global.BI.prepares == null) { n = n === undefined ? 1 : nativeMax(toInteger(n), 0); var result = (this.__filtered__ && !index) - ? new LazyWrapper(this) - : this.clone(); + ? new LazyWrapper(this) + : this.clone(); if (result.__filtered__) { result.__takeCount__ = nativeMin(n, result.__takeCount__); @@ -10538,7 +10538,7 @@ if (!_global.BI) { // 数组相关的方法 _.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection", - "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) { + "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) { BI[name] = _apply(name); }); _.each(["findIndex", "findLastIndex"], function (name) { @@ -68588,7 +68588,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { attributes: { tabIndex: 0 }, - allowEdit: false + allowEdit: false, + allowSearchValue: false }); }, @@ -68668,6 +68669,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { return { el: { type: "bi.multilayer_select_tree_trigger", + allowSearchValue: o.allowSearchValue, allowEdit: o.allowEdit, cls: "multilayer-select-tree-trigger", ref: function (_ref) { @@ -69025,7 +69027,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { this.tree = new BI.Tree(); - this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items)))); + this.tree.initTree(BI.Tree.treeFormat(o.items)); } var content = { type: "bi.htape", @@ -69079,9 +69081,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { onSearch: function (obj, callback) { var keyword = obj.keyword; if(o.itemsCreator === BI.emptyFn) { - var finding = BI.Func.getSearchResult(o.items, keyword); - var matched = finding.match, find = finding.find; - callback(self._fillTreeStructure4Search(find.concat(matched))); + callback(self._getSearchItems(keyword)); } else { callback(); } @@ -69123,27 +69123,59 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _getSearchItems: function(keyword) { + var o = this.options; + var findingText = BI.Func.getSearchResult(o.items, keyword, "text"); + var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []}; + var textItems = findingText.find.concat(findingText.match); + var valueItems = findingValue.find.concat(findingValue.match); + return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + }, + + _createJson: function(node, open) { + return { + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + isParent: BI.isNotEmptyArray(node.children), + open: open + } + }, + + _getChildren: function(node) { + var self = this; + node.children = node.children || []; + var nodes = []; + BI.each(node.children, function (idx, child) { + var children = self._getChildren(child); + nodes = nodes.concat(children); + }); + return node.children.concat(nodes); + }, + // 将搜索到的节点进行补充,构造成一棵完整的树 _fillTreeStructure4Search: function (leaves) { - var result = BI.map(leaves, "id"); - var queue = leaves.reverse() || []; + var self = this; + var result = []; + var queue = []; + BI.each(leaves, function (idx, node) { + queue.push({pId: node.pId}); + result.push(node); + result = result.concat(self._getChildren(node)); + }); while (BI.isNotEmptyArray(queue)) { var node = queue.pop(); var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { - queue.push(pNode); - result.push(pNode.id); + pNode.open = true; + queue.push({pId: pNode.pId}); + result.push(pNode); } } - var nodes = []; - BI.each(this.options.items, function (idx, item) { - if(BI.contains(result, item.id)) { - nodes.push(BI.extend({}, item, { - open: true - })) - } - }); - return nodes; + return BI.uniqBy(BI.map(result, function (idx, node) { + return self._createJson(node, node.open); + }), "id"); }, _digest: function (v) { @@ -69689,6 +69721,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { return { el: { type: "bi.multilayer_single_tree_trigger", + allowSearchValue: o.allowSearchValue, allowEdit: o.allowEdit, cls: "multilayer-single-tree-trigger", ref: function (_ref) { @@ -70037,7 +70070,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { return v; }, itemsCreator: BI.emptyFn, - watermark: BI.i18nText("BI-Basic_Search") + watermark: BI.i18nText("BI-Basic_Search"), + allowSearchValue: false }; }, @@ -70045,7 +70079,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { this.tree = new BI.Tree(); - this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items)))); + this.tree.initTree(BI.Tree.treeFormat(o.items)); } var content = { type: "bi.htape", @@ -70099,9 +70133,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { onSearch: function (obj, callback) { var keyword = obj.keyword; if(o.itemsCreator === BI.emptyFn) { - var finding = BI.Func.getSearchResult(o.items, keyword); - var matched = finding.match, find = finding.find; - callback(self._fillTreeStructure4Search(find.concat(matched))); + callback(self._getSearchItems(keyword)); } else { callback(); } @@ -70143,27 +70175,59 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _getSearchItems: function(keyword) { + var o = this.options; + var findingText = BI.Func.getSearchResult(o.items, keyword, "text"); + var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []}; + var textItems = findingText.find.concat(findingText.match); + var valueItems = findingValue.find.concat(findingValue.match); + return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + }, + + _createJson: function(node, open) { + return { + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + isParent: BI.isNotEmptyArray(node.children), + open: open + } + }, + + _getChildren: function(node) { + var self = this; + node.children = node.children || []; + var nodes = []; + BI.each(node.children, function (idx, child) { + var children = self._getChildren(child); + nodes = nodes.concat(children); + }); + return node.children.concat(nodes); + }, + // 将搜索到的节点进行补充,构造成一棵完整的树 _fillTreeStructure4Search: function (leaves) { - var result = BI.map(leaves, "id"); - var queue = leaves.reverse() || []; + var self = this; + var result = []; + var queue = []; + BI.each(leaves, function (idx, node) { + queue.push({pId: node.pId}); + result.push(node); + result = result.concat(self._getChildren(node)); + }); while (BI.isNotEmptyArray(queue)) { var node = queue.pop(); var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { - queue.push(pNode); - result.push(pNode.id); + pNode.open = true; + queue.push({pId: pNode.pId}); + result.push(pNode); } } - var nodes = []; - BI.each(this.options.items, function (idx, item) { - if(BI.contains(result, item.id)) { - nodes.push(BI.extend({}, item, { - open: true - })) - } - }); - return nodes; + return BI.uniqBy(BI.map(result, function (idx, node) { + return self._createJson(node, node.open); + }), "id"); }, _digest: function (v) { @@ -87832,11 +87896,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, { }, _isMatch: function (parentValues, value, keyword) { + var o = this.options; var node = this._getTreeNode(parentValues, value); if (!node) { return false; } var find = BI.Func.getSearchResult([node.text || node.value], keyword); + if(o.allowSearchValue && node.value) { + var valueFind = BI.Func.getSearchResult([node.value], keyword); + return valueFind.find.length > 0 || valueFind.match.length > 0 || + find.find.length > 0 || find.match.length > 0; + } return find.find.length > 0 || find.match.length > 0; }, diff --git a/dist/bundle.js b/dist/bundle.js index af2ff4900..f48221460 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -22,7 +22,7 @@ if(_global.BI.prepares == null) { }/** * @license * Lodash (Custom Build) - * Build: `lodash core plus="debounce,throttle,get,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"` + * Build: `lodash core plus="debounce,throttle,get,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"` * Copyright JS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 @@ -215,34 +215,34 @@ if(_global.BI.prepares == null) { /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = - typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = - typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = - typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = - typedArrayTags[uint32Tag] = true; + typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = + typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = + typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = + typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = - typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = - typedArrayTags[errorTag] = typedArrayTags[funcTag] = - typedArrayTags[mapTag] = typedArrayTags[numberTag] = - typedArrayTags[objectTag] = typedArrayTags[regexpTag] = - typedArrayTags[setTag] = typedArrayTags[stringTag] = - typedArrayTags[weakMapTag] = false; + typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = + typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = + typedArrayTags[errorTag] = typedArrayTags[funcTag] = + typedArrayTags[mapTag] = typedArrayTags[numberTag] = + typedArrayTags[objectTag] = typedArrayTags[regexpTag] = + typedArrayTags[setTag] = typedArrayTags[stringTag] = + typedArrayTags[weakMapTag] = false; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = - cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = - cloneableTags[boolTag] = cloneableTags[dateTag] = - cloneableTags[float32Tag] = cloneableTags[float64Tag] = - cloneableTags[int8Tag] = cloneableTags[int16Tag] = - cloneableTags[int32Tag] = cloneableTags[mapTag] = - cloneableTags[numberTag] = cloneableTags[objectTag] = - cloneableTags[regexpTag] = cloneableTags[setTag] = - cloneableTags[stringTag] = cloneableTags[symbolTag] = - cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = - cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = + cloneableTags[boolTag] = cloneableTags[dateTag] = + cloneableTags[float32Tag] = cloneableTags[float64Tag] = + cloneableTags[int8Tag] = cloneableTags[int16Tag] = + cloneableTags[int32Tag] = cloneableTags[mapTag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[setTag] = + cloneableTags[stringTag] = cloneableTags[symbolTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = - cloneableTags[weakMapTag] = false; + cloneableTags[weakMapTag] = false; /** Used to map characters to HTML entities. */ var htmlEscapes = { @@ -599,8 +599,8 @@ if(_global.BI.prepares == null) { */ function baseIndexOf(array, value, fromIndex) { return value === value - ? strictIndexOf(array, value, fromIndex) - : baseFindIndex(array, baseIsNaN, fromIndex); + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); } /** @@ -656,8 +656,8 @@ if(_global.BI.prepares == null) { function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { eachFunc(collection, function(value, index, collection) { accumulator = initAccum - ? (initAccum = false, value) - : iteratee(accumulator, value, index, collection); + ? (initAccum = false, value) + : iteratee(accumulator, value, index, collection); }); return accumulator; } @@ -910,8 +910,8 @@ if(_global.BI.prepares == null) { */ function safeGet(object, key) { return key == '__proto__' - ? undefined - : object[key]; + ? undefined + : object[key]; } /** @@ -962,8 +962,8 @@ if(_global.BI.prepares == null) { */ function stringSize(string) { return hasUnicode(string) - ? unicodeSize(string) - : asciiSize(string); + ? unicodeSize(string) + : asciiSize(string); } /** @@ -975,8 +975,8 @@ if(_global.BI.prepares == null) { */ function stringToArray(string) { return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); + ? unicodeToArray(string) + : asciiToArray(string); } /** @@ -1045,8 +1045,8 @@ if(_global.BI.prepares == null) { /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ @@ -1383,30 +1383,30 @@ if(_global.BI.prepares == null) { var result = []; outer: - while (length-- && resIndex < takeCount) { - index += dir; - - var iterIndex = -1, - value = array[index]; - - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], - iteratee = data.iteratee, - type = data.type, - computed = iteratee(value); - - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } - } + while (length-- && resIndex < takeCount) { + index += dir; + + var iterIndex = -1, + value = array[index]; + + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], + iteratee = data.iteratee, + type = data.type, + computed = iteratee(value); + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; } - result[resIndex++] = value; } + } + result[resIndex++] = value; + } return result; } @@ -1914,14 +1914,14 @@ if(_global.BI.prepares == null) { for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) ))) { result.push(key); } @@ -2136,8 +2136,8 @@ if(_global.BI.prepares == null) { result = (isFlat || isFunc) ? {} : initCloneObject(value); if (!isDeep) { return isFlat - ? copySymbolsIn(value, baseAssignIn(result, value)) - : copySymbols(value, baseAssign(result, value)); + ? copySymbolsIn(value, baseAssignIn(result, value)) + : copySymbols(value, baseAssign(result, value)); } } else { if (!cloneableTags[tag]) { @@ -2171,8 +2171,8 @@ if(_global.BI.prepares == null) { } var keysFunc = isFull - ? (isFlat ? getAllKeysIn : getAllKeys) - : (isFlat ? keysIn : keys); + ? (isFlat ? getAllKeysIn : getAllKeys) + : (isFlat ? keysIn : keys); var props = isArr ? undefined : keysFunc(value); arrayEach(props || value, function(subValue, key) { @@ -2238,24 +2238,24 @@ if(_global.BI.prepares == null) { values = new SetCache(values); } outer: - while (++index < length) { - var value = array[index], - computed = iteratee == null ? value : iteratee(value); - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee == null ? value : iteratee(value); + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === computed) { + continue outer; } } + result.push(value); + } + else if (!includes(values, computed, comparator)) { + result.push(value); + } + } return result; } @@ -2306,9 +2306,9 @@ if(_global.BI.prepares == null) { current = iteratee(value); if (current != null && (computed === undefined - ? (current === current && !isSymbol(current)) - : comparator(current, computed) - )) { + ? (current === current && !isSymbol(current)) + : comparator(current, computed) + )) { var computed = current, result = value; } @@ -2480,8 +2480,8 @@ if(_global.BI.prepares == null) { return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); + ? getRawTag(value) + : objectToString(value); } /** @@ -2547,8 +2547,8 @@ if(_global.BI.prepares == null) { } maxLength = nativeMin(array.length, maxLength); caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) - ? new SetCache(othIndex && array) - : undefined; + ? new SetCache(othIndex && array) + : undefined; } array = arrays[0]; @@ -2556,31 +2556,31 @@ if(_global.BI.prepares == null) { seen = caches[0]; outer: - while (++index < length && result.length < maxLength) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (!(seen - ? cacheHas(seen, computed) - : includes(result, computed, comparator) + while (++index < length && result.length < maxLength) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (!(seen + ? cacheHas(seen, computed) + : includes(result, computed, comparator) )) { - othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache - ? cacheHas(cache, computed) - : includes(arrays[othIndex], computed, comparator)) + othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if (!(cache + ? cacheHas(cache, computed) + : includes(arrays[othIndex], computed, comparator)) ) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result.push(value); + continue outer; } } + if (seen) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -2702,8 +2702,8 @@ if(_global.BI.prepares == null) { if (isSameTag && !objIsObj) { stack || (stack = new Stack); return (objIsArr || isTypedArray(object)) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), @@ -2757,9 +2757,9 @@ if(_global.BI.prepares == null) { while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { return false; } } @@ -2779,9 +2779,9 @@ if(_global.BI.prepares == null) { var result = customizer(objValue, srcValue, key, object, source, stack); } if (!(result === undefined - ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) - : result - )) { + ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) + : result + )) { return false; } } @@ -2836,7 +2836,7 @@ if(_global.BI.prepares == null) { */ function baseIsTypedArray(value) { return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } /** @@ -2857,8 +2857,8 @@ if(_global.BI.prepares == null) { } if (typeof value == 'object') { return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); } return property(value); } @@ -2968,8 +2968,8 @@ if(_global.BI.prepares == null) { return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } @@ -2995,8 +2995,8 @@ if(_global.BI.prepares == null) { } else { var newValue = customizer - ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) + : undefined; if (newValue === undefined) { newValue = srcValue; @@ -3031,8 +3031,8 @@ if(_global.BI.prepares == null) { return; } var newValue = customizer - ? customizer(objValue, srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; var isCommon = newValue === undefined; @@ -3239,8 +3239,8 @@ if(_global.BI.prepares == null) { newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { newValue = isObject(objValue) - ? objValue - : (isIndex(path[index + 1]) ? [] : {}); + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); } } assignValue(nested, key, newValue); @@ -3386,30 +3386,30 @@ if(_global.BI.prepares == null) { seen = iteratee ? [] : result; } outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; } } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -3783,8 +3783,8 @@ if(_global.BI.prepares == null) { var key = props[index]; var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; + ? customizer(object[key], source[key], key, object, source) + : undefined; if (newValue === undefined) { newValue = source[key]; @@ -3854,8 +3854,8 @@ if(_global.BI.prepares == null) { guard = length > 2 ? sources[2] : undefined; customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; + ? (length--, customizer) + : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; @@ -4001,14 +4001,14 @@ if(_global.BI.prepares == null) { args[index] = arguments[index]; } var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) - ? [] - : replaceHolders(args, placeholder); + ? [] + : replaceHolders(args, placeholder); length -= holders.length; if (length < arity) { return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, undefined, - args, holders, undefined, undefined, arity - length); + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); } var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return apply(fn, this, args); @@ -4085,8 +4085,8 @@ if(_global.BI.prepares == null) { if (isCurried && length < arity) { var newHolders = replaceHolders(args, placeholder); return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, thisArg, - args, newHolders, argPos, ary, arity - length + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length ); } var thisBinding = isBind ? thisArg : this, @@ -4298,8 +4298,8 @@ if(_global.BI.prepares == null) { partials = newData[3]; holders = newData[4]; arity = newData[9] = newData[9] === undefined - ? (isBindKey ? 0 : func.length) - : nativeMax(newData[9] - length, 0); + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); @@ -4394,8 +4394,8 @@ if(_global.BI.prepares == null) { if (customizer) { var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { @@ -4407,18 +4407,18 @@ if(_global.BI.prepares == null) { // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { - if (!cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { + if (!cacheHas(seen, othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { result = false; break; } } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, bitmask, customizer, stack) - )) { + arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack) + )) { result = false; break; } @@ -4557,14 +4557,14 @@ if(_global.BI.prepares == null) { if (customizer) { var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) - : compared - )) { + ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) + : compared + )) { result = false; break; } @@ -4578,7 +4578,7 @@ if(_global.BI.prepares == null) { if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { + typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } @@ -4677,8 +4677,8 @@ if(_global.BI.prepares == null) { function getMapData(map, key) { var data = map.__data__; return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; } /** @@ -4875,7 +4875,7 @@ if(_global.BI.prepares == null) { } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && - (isArray(object) || isArguments(object)); + (isArray(object) || isArguments(object)); } /** @@ -4906,8 +4906,8 @@ if(_global.BI.prepares == null) { */ function initCloneObject(object) { return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; + ? baseCreate(getPrototype(object)) + : {}; } /** @@ -4986,7 +4986,7 @@ if(_global.BI.prepares == null) { */ function isFlattenable(value) { return isArray(value) || isArguments(value) || - !!(spreadableSymbol && value && value[spreadableSymbol]); + !!(spreadableSymbol && value && value[spreadableSymbol]); } /** @@ -5002,9 +5002,9 @@ if(_global.BI.prepares == null) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); } /** @@ -5023,9 +5023,9 @@ if(_global.BI.prepares == null) { } var type = typeof index; if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { return eq(object[index], value); } return false; @@ -5049,7 +5049,7 @@ if(_global.BI.prepares == null) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object)); + (object != null && value in Object(object)); } /** @@ -5062,8 +5062,8 @@ if(_global.BI.prepares == null) { function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); + ? (value !== '__proto__') + : (value === null); } /** @@ -5140,7 +5140,7 @@ if(_global.BI.prepares == null) { return false; } return object[key] === srcValue && - (srcValue !== undefined || (key in Object(object))); + (srcValue !== undefined || (key in Object(object))); }; } @@ -5187,9 +5187,9 @@ if(_global.BI.prepares == null) { isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); var isCombo = - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || - ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || + ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); // Exit early if metadata can't be merged. if (!(isCommon || isCombo)) { @@ -5579,8 +5579,8 @@ if(_global.BI.prepares == null) { */ var difference = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) - : []; + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) + : []; }); /** @@ -5708,8 +5708,8 @@ if(_global.BI.prepares == null) { if (fromIndex !== undefined) { index = toInteger(fromIndex); index = fromIndex < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1); + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1); } return baseFindIndex(array, baseIteratee(predicate, 3), index, true); } @@ -5848,8 +5848,8 @@ if(_global.BI.prepares == null) { var intersection = baseRest(function(arrays) { var mapped = arrayMap(arrays, castArrayLikeObject); return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped) - : []; + ? baseIntersection(mapped) + : []; }); /** @@ -6124,8 +6124,8 @@ if(_global.BI.prepares == null) { */ var without = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, values) - : []; + ? baseDifference(array, values) + : []; }); /** @@ -7195,8 +7195,8 @@ if(_global.BI.prepares == null) { timeWaiting = wait - timeSinceLastCall; return maxing - ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) - : timeWaiting; + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; } function shouldInvoke(time) { @@ -7207,7 +7207,7 @@ if(_global.BI.prepares == null) { // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { @@ -7646,7 +7646,7 @@ if(_global.BI.prepares == null) { */ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); + !propertyIsEnumerable.call(value, 'callee'); }; /** @@ -7751,7 +7751,7 @@ if(_global.BI.prepares == null) { */ function isBoolean(value) { return value === true || value === false || - (isObjectLike(value) && baseGetTag(value) == boolTag); + (isObjectLike(value) && baseGetTag(value) == boolTag); } /** @@ -7831,7 +7831,7 @@ if(_global.BI.prepares == null) { } if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || - isBuffer(value) || isTypedArray(value) || isArguments(value))) { + isBuffer(value) || isTypedArray(value) || isArguments(value))) { return !value.length; } var tag = getTag(value); @@ -7966,7 +7966,7 @@ if(_global.BI.prepares == null) { */ function isLength(value) { return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -8130,7 +8130,7 @@ if(_global.BI.prepares == null) { */ function isNumber(value) { return typeof value == 'number' || - (isObjectLike(value) && baseGetTag(value) == numberTag); + (isObjectLike(value) && baseGetTag(value) == numberTag); } /** @@ -8171,7 +8171,7 @@ if(_global.BI.prepares == null) { } var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && - funcToString.call(Ctor) == objectCtorString; + funcToString.call(Ctor) == objectCtorString; } /** @@ -8231,7 +8231,7 @@ if(_global.BI.prepares == null) { */ function isString(value) { return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); } /** @@ -8253,7 +8253,7 @@ if(_global.BI.prepares == null) { */ function isSymbol(value) { return typeof value == 'symbol' || - (isObjectLike(value) && baseGetTag(value) == symbolTag); + (isObjectLike(value) && baseGetTag(value) == symbolTag); } /** @@ -8443,8 +8443,8 @@ if(_global.BI.prepares == null) { value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); } /** @@ -9355,8 +9355,8 @@ if(_global.BI.prepares == null) { function escape(string) { string = toString(string); return (string && reHasUnescapedHtml.test(string)) - ? string.replace(reUnescapedHtml, escapeHtmlChar) - : string; + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; } /** @@ -9782,8 +9782,8 @@ if(_global.BI.prepares == null) { */ function max(array) { return (array && array.length) - ? baseExtremum(array, identity, baseGt) - : undefined; + ? baseExtremum(array, identity, baseGt) + : undefined; } /** @@ -9806,8 +9806,8 @@ if(_global.BI.prepares == null) { */ function min(array) { return (array && array.length) - ? baseExtremum(array, identity, baseLt) - : undefined; + ? baseExtremum(array, identity, baseLt) + : undefined; } /*------------------------------------------------------------------------*/ @@ -9953,8 +9953,8 @@ if(_global.BI.prepares == null) { n = n === undefined ? 1 : nativeMax(toInteger(n), 0); var result = (this.__filtered__ && !index) - ? new LazyWrapper(this) - : this.clone(); + ? new LazyWrapper(this) + : this.clone(); if (result.__filtered__) { result.__takeCount__ = nativeMin(n, result.__takeCount__); @@ -10538,7 +10538,7 @@ if (!_global.BI) { // 数组相关的方法 _.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection", - "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) { + "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) { BI[name] = _apply(name); }); _.each(["findIndex", "findLastIndex"], function (name) { @@ -68992,7 +68992,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { attributes: { tabIndex: 0 }, - allowEdit: false + allowEdit: false, + allowSearchValue: false }); }, @@ -69072,6 +69073,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { return { el: { type: "bi.multilayer_select_tree_trigger", + allowSearchValue: o.allowSearchValue, allowEdit: o.allowEdit, cls: "multilayer-select-tree-trigger", ref: function (_ref) { @@ -69429,7 +69431,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { this.tree = new BI.Tree(); - this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items)))); + this.tree.initTree(BI.Tree.treeFormat(o.items)); } var content = { type: "bi.htape", @@ -69483,9 +69485,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { onSearch: function (obj, callback) { var keyword = obj.keyword; if(o.itemsCreator === BI.emptyFn) { - var finding = BI.Func.getSearchResult(o.items, keyword); - var matched = finding.match, find = finding.find; - callback(self._fillTreeStructure4Search(find.concat(matched))); + callback(self._getSearchItems(keyword)); } else { callback(); } @@ -69527,27 +69527,59 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _getSearchItems: function(keyword) { + var o = this.options; + var findingText = BI.Func.getSearchResult(o.items, keyword, "text"); + var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []}; + var textItems = findingText.find.concat(findingText.match); + var valueItems = findingValue.find.concat(findingValue.match); + return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + }, + + _createJson: function(node, open) { + return { + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + isParent: BI.isNotEmptyArray(node.children), + open: open + } + }, + + _getChildren: function(node) { + var self = this; + node.children = node.children || []; + var nodes = []; + BI.each(node.children, function (idx, child) { + var children = self._getChildren(child); + nodes = nodes.concat(children); + }); + return node.children.concat(nodes); + }, + // 将搜索到的节点进行补充,构造成一棵完整的树 _fillTreeStructure4Search: function (leaves) { - var result = BI.map(leaves, "id"); - var queue = leaves.reverse() || []; + var self = this; + var result = []; + var queue = []; + BI.each(leaves, function (idx, node) { + queue.push({pId: node.pId}); + result.push(node); + result = result.concat(self._getChildren(node)); + }); while (BI.isNotEmptyArray(queue)) { var node = queue.pop(); var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { - queue.push(pNode); - result.push(pNode.id); + pNode.open = true; + queue.push({pId: pNode.pId}); + result.push(pNode); } } - var nodes = []; - BI.each(this.options.items, function (idx, item) { - if(BI.contains(result, item.id)) { - nodes.push(BI.extend({}, item, { - open: true - })) - } - }); - return nodes; + return BI.uniqBy(BI.map(result, function (idx, node) { + return self._createJson(node, node.open); + }), "id"); }, _digest: function (v) { @@ -70093,6 +70125,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { return { el: { type: "bi.multilayer_single_tree_trigger", + allowSearchValue: o.allowSearchValue, allowEdit: o.allowEdit, cls: "multilayer-single-tree-trigger", ref: function (_ref) { @@ -70441,7 +70474,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { return v; }, itemsCreator: BI.emptyFn, - watermark: BI.i18nText("BI-Basic_Search") + watermark: BI.i18nText("BI-Basic_Search"), + allowSearchValue: false }; }, @@ -70449,7 +70483,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { this.tree = new BI.Tree(); - this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items)))); + this.tree.initTree(BI.Tree.treeFormat(o.items)); } var content = { type: "bi.htape", @@ -70503,9 +70537,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { onSearch: function (obj, callback) { var keyword = obj.keyword; if(o.itemsCreator === BI.emptyFn) { - var finding = BI.Func.getSearchResult(o.items, keyword); - var matched = finding.match, find = finding.find; - callback(self._fillTreeStructure4Search(find.concat(matched))); + callback(self._getSearchItems(keyword)); } else { callback(); } @@ -70547,27 +70579,59 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _getSearchItems: function(keyword) { + var o = this.options; + var findingText = BI.Func.getSearchResult(o.items, keyword, "text"); + var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []}; + var textItems = findingText.find.concat(findingText.match); + var valueItems = findingValue.find.concat(findingValue.match); + return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + }, + + _createJson: function(node, open) { + return { + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + isParent: BI.isNotEmptyArray(node.children), + open: open + } + }, + + _getChildren: function(node) { + var self = this; + node.children = node.children || []; + var nodes = []; + BI.each(node.children, function (idx, child) { + var children = self._getChildren(child); + nodes = nodes.concat(children); + }); + return node.children.concat(nodes); + }, + // 将搜索到的节点进行补充,构造成一棵完整的树 _fillTreeStructure4Search: function (leaves) { - var result = BI.map(leaves, "id"); - var queue = leaves.reverse() || []; + var self = this; + var result = []; + var queue = []; + BI.each(leaves, function (idx, node) { + queue.push({pId: node.pId}); + result.push(node); + result = result.concat(self._getChildren(node)); + }); while (BI.isNotEmptyArray(queue)) { var node = queue.pop(); var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { - queue.push(pNode); - result.push(pNode.id); + pNode.open = true; + queue.push({pId: pNode.pId}); + result.push(pNode); } } - var nodes = []; - BI.each(this.options.items, function (idx, item) { - if(BI.contains(result, item.id)) { - nodes.push(BI.extend({}, item, { - open: true - })) - } - }); - return nodes; + return BI.uniqBy(BI.map(result, function (idx, node) { + return self._createJson(node, node.open); + }), "id"); }, _digest: function (v) { @@ -88236,11 +88300,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, { }, _isMatch: function (parentValues, value, keyword) { + var o = this.options; var node = this._getTreeNode(parentValues, value); if (!node) { return false; } var find = BI.Func.getSearchResult([node.text || node.value], keyword); + if(o.allowSearchValue && node.value) { + var valueFind = BI.Func.getSearchResult([node.value], keyword); + return valueFind.find.length > 0 || valueFind.match.length > 0 || + find.find.length > 0 || find.match.length > 0; + } return find.find.length > 0 || find.match.length > 0; }, diff --git a/dist/core.js b/dist/core.js index 629dc87b9..6815d00b6 100644 --- a/dist/core.js +++ b/dist/core.js @@ -22,7 +22,7 @@ if(_global.BI.prepares == null) { }/** * @license * Lodash (Custom Build) - * Build: `lodash core plus="debounce,throttle,get,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"` + * Build: `lodash core plus="debounce,throttle,get,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"` * Copyright JS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 @@ -215,34 +215,34 @@ if(_global.BI.prepares == null) { /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = - typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = - typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = - typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = - typedArrayTags[uint32Tag] = true; + typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = + typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = + typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = + typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = - typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = - typedArrayTags[errorTag] = typedArrayTags[funcTag] = - typedArrayTags[mapTag] = typedArrayTags[numberTag] = - typedArrayTags[objectTag] = typedArrayTags[regexpTag] = - typedArrayTags[setTag] = typedArrayTags[stringTag] = - typedArrayTags[weakMapTag] = false; + typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = + typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = + typedArrayTags[errorTag] = typedArrayTags[funcTag] = + typedArrayTags[mapTag] = typedArrayTags[numberTag] = + typedArrayTags[objectTag] = typedArrayTags[regexpTag] = + typedArrayTags[setTag] = typedArrayTags[stringTag] = + typedArrayTags[weakMapTag] = false; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = - cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = - cloneableTags[boolTag] = cloneableTags[dateTag] = - cloneableTags[float32Tag] = cloneableTags[float64Tag] = - cloneableTags[int8Tag] = cloneableTags[int16Tag] = - cloneableTags[int32Tag] = cloneableTags[mapTag] = - cloneableTags[numberTag] = cloneableTags[objectTag] = - cloneableTags[regexpTag] = cloneableTags[setTag] = - cloneableTags[stringTag] = cloneableTags[symbolTag] = - cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = - cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = + cloneableTags[boolTag] = cloneableTags[dateTag] = + cloneableTags[float32Tag] = cloneableTags[float64Tag] = + cloneableTags[int8Tag] = cloneableTags[int16Tag] = + cloneableTags[int32Tag] = cloneableTags[mapTag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[setTag] = + cloneableTags[stringTag] = cloneableTags[symbolTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = - cloneableTags[weakMapTag] = false; + cloneableTags[weakMapTag] = false; /** Used to map characters to HTML entities. */ var htmlEscapes = { @@ -599,8 +599,8 @@ if(_global.BI.prepares == null) { */ function baseIndexOf(array, value, fromIndex) { return value === value - ? strictIndexOf(array, value, fromIndex) - : baseFindIndex(array, baseIsNaN, fromIndex); + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); } /** @@ -656,8 +656,8 @@ if(_global.BI.prepares == null) { function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { eachFunc(collection, function(value, index, collection) { accumulator = initAccum - ? (initAccum = false, value) - : iteratee(accumulator, value, index, collection); + ? (initAccum = false, value) + : iteratee(accumulator, value, index, collection); }); return accumulator; } @@ -910,8 +910,8 @@ if(_global.BI.prepares == null) { */ function safeGet(object, key) { return key == '__proto__' - ? undefined - : object[key]; + ? undefined + : object[key]; } /** @@ -962,8 +962,8 @@ if(_global.BI.prepares == null) { */ function stringSize(string) { return hasUnicode(string) - ? unicodeSize(string) - : asciiSize(string); + ? unicodeSize(string) + : asciiSize(string); } /** @@ -975,8 +975,8 @@ if(_global.BI.prepares == null) { */ function stringToArray(string) { return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); + ? unicodeToArray(string) + : asciiToArray(string); } /** @@ -1045,8 +1045,8 @@ if(_global.BI.prepares == null) { /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ @@ -1383,30 +1383,30 @@ if(_global.BI.prepares == null) { var result = []; outer: - while (length-- && resIndex < takeCount) { - index += dir; - - var iterIndex = -1, - value = array[index]; - - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], - iteratee = data.iteratee, - type = data.type, - computed = iteratee(value); - - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } - } + while (length-- && resIndex < takeCount) { + index += dir; + + var iterIndex = -1, + value = array[index]; + + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], + iteratee = data.iteratee, + type = data.type, + computed = iteratee(value); + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; } - result[resIndex++] = value; } + } + result[resIndex++] = value; + } return result; } @@ -1914,14 +1914,14 @@ if(_global.BI.prepares == null) { for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) ))) { result.push(key); } @@ -2136,8 +2136,8 @@ if(_global.BI.prepares == null) { result = (isFlat || isFunc) ? {} : initCloneObject(value); if (!isDeep) { return isFlat - ? copySymbolsIn(value, baseAssignIn(result, value)) - : copySymbols(value, baseAssign(result, value)); + ? copySymbolsIn(value, baseAssignIn(result, value)) + : copySymbols(value, baseAssign(result, value)); } } else { if (!cloneableTags[tag]) { @@ -2171,8 +2171,8 @@ if(_global.BI.prepares == null) { } var keysFunc = isFull - ? (isFlat ? getAllKeysIn : getAllKeys) - : (isFlat ? keysIn : keys); + ? (isFlat ? getAllKeysIn : getAllKeys) + : (isFlat ? keysIn : keys); var props = isArr ? undefined : keysFunc(value); arrayEach(props || value, function(subValue, key) { @@ -2238,24 +2238,24 @@ if(_global.BI.prepares == null) { values = new SetCache(values); } outer: - while (++index < length) { - var value = array[index], - computed = iteratee == null ? value : iteratee(value); - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee == null ? value : iteratee(value); + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === computed) { + continue outer; } } + result.push(value); + } + else if (!includes(values, computed, comparator)) { + result.push(value); + } + } return result; } @@ -2306,9 +2306,9 @@ if(_global.BI.prepares == null) { current = iteratee(value); if (current != null && (computed === undefined - ? (current === current && !isSymbol(current)) - : comparator(current, computed) - )) { + ? (current === current && !isSymbol(current)) + : comparator(current, computed) + )) { var computed = current, result = value; } @@ -2480,8 +2480,8 @@ if(_global.BI.prepares == null) { return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); + ? getRawTag(value) + : objectToString(value); } /** @@ -2547,8 +2547,8 @@ if(_global.BI.prepares == null) { } maxLength = nativeMin(array.length, maxLength); caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) - ? new SetCache(othIndex && array) - : undefined; + ? new SetCache(othIndex && array) + : undefined; } array = arrays[0]; @@ -2556,31 +2556,31 @@ if(_global.BI.prepares == null) { seen = caches[0]; outer: - while (++index < length && result.length < maxLength) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (!(seen - ? cacheHas(seen, computed) - : includes(result, computed, comparator) + while (++index < length && result.length < maxLength) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (!(seen + ? cacheHas(seen, computed) + : includes(result, computed, comparator) )) { - othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache - ? cacheHas(cache, computed) - : includes(arrays[othIndex], computed, comparator)) + othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if (!(cache + ? cacheHas(cache, computed) + : includes(arrays[othIndex], computed, comparator)) ) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result.push(value); + continue outer; } } + if (seen) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -2702,8 +2702,8 @@ if(_global.BI.prepares == null) { if (isSameTag && !objIsObj) { stack || (stack = new Stack); return (objIsArr || isTypedArray(object)) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), @@ -2757,9 +2757,9 @@ if(_global.BI.prepares == null) { while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { return false; } } @@ -2779,9 +2779,9 @@ if(_global.BI.prepares == null) { var result = customizer(objValue, srcValue, key, object, source, stack); } if (!(result === undefined - ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) - : result - )) { + ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) + : result + )) { return false; } } @@ -2836,7 +2836,7 @@ if(_global.BI.prepares == null) { */ function baseIsTypedArray(value) { return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } /** @@ -2857,8 +2857,8 @@ if(_global.BI.prepares == null) { } if (typeof value == 'object') { return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); } return property(value); } @@ -2968,8 +2968,8 @@ if(_global.BI.prepares == null) { return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } @@ -2995,8 +2995,8 @@ if(_global.BI.prepares == null) { } else { var newValue = customizer - ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) + : undefined; if (newValue === undefined) { newValue = srcValue; @@ -3031,8 +3031,8 @@ if(_global.BI.prepares == null) { return; } var newValue = customizer - ? customizer(objValue, srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; var isCommon = newValue === undefined; @@ -3239,8 +3239,8 @@ if(_global.BI.prepares == null) { newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { newValue = isObject(objValue) - ? objValue - : (isIndex(path[index + 1]) ? [] : {}); + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); } } assignValue(nested, key, newValue); @@ -3386,30 +3386,30 @@ if(_global.BI.prepares == null) { seen = iteratee ? [] : result; } outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; } } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -3783,8 +3783,8 @@ if(_global.BI.prepares == null) { var key = props[index]; var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; + ? customizer(object[key], source[key], key, object, source) + : undefined; if (newValue === undefined) { newValue = source[key]; @@ -3854,8 +3854,8 @@ if(_global.BI.prepares == null) { guard = length > 2 ? sources[2] : undefined; customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; + ? (length--, customizer) + : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; @@ -4001,14 +4001,14 @@ if(_global.BI.prepares == null) { args[index] = arguments[index]; } var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) - ? [] - : replaceHolders(args, placeholder); + ? [] + : replaceHolders(args, placeholder); length -= holders.length; if (length < arity) { return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, undefined, - args, holders, undefined, undefined, arity - length); + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); } var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return apply(fn, this, args); @@ -4085,8 +4085,8 @@ if(_global.BI.prepares == null) { if (isCurried && length < arity) { var newHolders = replaceHolders(args, placeholder); return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, thisArg, - args, newHolders, argPos, ary, arity - length + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length ); } var thisBinding = isBind ? thisArg : this, @@ -4298,8 +4298,8 @@ if(_global.BI.prepares == null) { partials = newData[3]; holders = newData[4]; arity = newData[9] = newData[9] === undefined - ? (isBindKey ? 0 : func.length) - : nativeMax(newData[9] - length, 0); + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); @@ -4394,8 +4394,8 @@ if(_global.BI.prepares == null) { if (customizer) { var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { @@ -4407,18 +4407,18 @@ if(_global.BI.prepares == null) { // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { - if (!cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { + if (!cacheHas(seen, othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { result = false; break; } } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, bitmask, customizer, stack) - )) { + arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack) + )) { result = false; break; } @@ -4557,14 +4557,14 @@ if(_global.BI.prepares == null) { if (customizer) { var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) - : compared - )) { + ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) + : compared + )) { result = false; break; } @@ -4578,7 +4578,7 @@ if(_global.BI.prepares == null) { if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { + typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } @@ -4677,8 +4677,8 @@ if(_global.BI.prepares == null) { function getMapData(map, key) { var data = map.__data__; return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; } /** @@ -4875,7 +4875,7 @@ if(_global.BI.prepares == null) { } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && - (isArray(object) || isArguments(object)); + (isArray(object) || isArguments(object)); } /** @@ -4906,8 +4906,8 @@ if(_global.BI.prepares == null) { */ function initCloneObject(object) { return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; + ? baseCreate(getPrototype(object)) + : {}; } /** @@ -4986,7 +4986,7 @@ if(_global.BI.prepares == null) { */ function isFlattenable(value) { return isArray(value) || isArguments(value) || - !!(spreadableSymbol && value && value[spreadableSymbol]); + !!(spreadableSymbol && value && value[spreadableSymbol]); } /** @@ -5002,9 +5002,9 @@ if(_global.BI.prepares == null) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); } /** @@ -5023,9 +5023,9 @@ if(_global.BI.prepares == null) { } var type = typeof index; if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { return eq(object[index], value); } return false; @@ -5049,7 +5049,7 @@ if(_global.BI.prepares == null) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object)); + (object != null && value in Object(object)); } /** @@ -5062,8 +5062,8 @@ if(_global.BI.prepares == null) { function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); + ? (value !== '__proto__') + : (value === null); } /** @@ -5140,7 +5140,7 @@ if(_global.BI.prepares == null) { return false; } return object[key] === srcValue && - (srcValue !== undefined || (key in Object(object))); + (srcValue !== undefined || (key in Object(object))); }; } @@ -5187,9 +5187,9 @@ if(_global.BI.prepares == null) { isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); var isCombo = - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || - ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || + ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); // Exit early if metadata can't be merged. if (!(isCommon || isCombo)) { @@ -5579,8 +5579,8 @@ if(_global.BI.prepares == null) { */ var difference = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) - : []; + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) + : []; }); /** @@ -5708,8 +5708,8 @@ if(_global.BI.prepares == null) { if (fromIndex !== undefined) { index = toInteger(fromIndex); index = fromIndex < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1); + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1); } return baseFindIndex(array, baseIteratee(predicate, 3), index, true); } @@ -5848,8 +5848,8 @@ if(_global.BI.prepares == null) { var intersection = baseRest(function(arrays) { var mapped = arrayMap(arrays, castArrayLikeObject); return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped) - : []; + ? baseIntersection(mapped) + : []; }); /** @@ -6124,8 +6124,8 @@ if(_global.BI.prepares == null) { */ var without = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, values) - : []; + ? baseDifference(array, values) + : []; }); /** @@ -7195,8 +7195,8 @@ if(_global.BI.prepares == null) { timeWaiting = wait - timeSinceLastCall; return maxing - ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) - : timeWaiting; + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; } function shouldInvoke(time) { @@ -7207,7 +7207,7 @@ if(_global.BI.prepares == null) { // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { @@ -7646,7 +7646,7 @@ if(_global.BI.prepares == null) { */ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); + !propertyIsEnumerable.call(value, 'callee'); }; /** @@ -7751,7 +7751,7 @@ if(_global.BI.prepares == null) { */ function isBoolean(value) { return value === true || value === false || - (isObjectLike(value) && baseGetTag(value) == boolTag); + (isObjectLike(value) && baseGetTag(value) == boolTag); } /** @@ -7831,7 +7831,7 @@ if(_global.BI.prepares == null) { } if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || - isBuffer(value) || isTypedArray(value) || isArguments(value))) { + isBuffer(value) || isTypedArray(value) || isArguments(value))) { return !value.length; } var tag = getTag(value); @@ -7966,7 +7966,7 @@ if(_global.BI.prepares == null) { */ function isLength(value) { return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -8130,7 +8130,7 @@ if(_global.BI.prepares == null) { */ function isNumber(value) { return typeof value == 'number' || - (isObjectLike(value) && baseGetTag(value) == numberTag); + (isObjectLike(value) && baseGetTag(value) == numberTag); } /** @@ -8171,7 +8171,7 @@ if(_global.BI.prepares == null) { } var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && - funcToString.call(Ctor) == objectCtorString; + funcToString.call(Ctor) == objectCtorString; } /** @@ -8231,7 +8231,7 @@ if(_global.BI.prepares == null) { */ function isString(value) { return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); } /** @@ -8253,7 +8253,7 @@ if(_global.BI.prepares == null) { */ function isSymbol(value) { return typeof value == 'symbol' || - (isObjectLike(value) && baseGetTag(value) == symbolTag); + (isObjectLike(value) && baseGetTag(value) == symbolTag); } /** @@ -8443,8 +8443,8 @@ if(_global.BI.prepares == null) { value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); } /** @@ -9355,8 +9355,8 @@ if(_global.BI.prepares == null) { function escape(string) { string = toString(string); return (string && reHasUnescapedHtml.test(string)) - ? string.replace(reUnescapedHtml, escapeHtmlChar) - : string; + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; } /** @@ -9782,8 +9782,8 @@ if(_global.BI.prepares == null) { */ function max(array) { return (array && array.length) - ? baseExtremum(array, identity, baseGt) - : undefined; + ? baseExtremum(array, identity, baseGt) + : undefined; } /** @@ -9806,8 +9806,8 @@ if(_global.BI.prepares == null) { */ function min(array) { return (array && array.length) - ? baseExtremum(array, identity, baseLt) - : undefined; + ? baseExtremum(array, identity, baseLt) + : undefined; } /*------------------------------------------------------------------------*/ @@ -9953,8 +9953,8 @@ if(_global.BI.prepares == null) { n = n === undefined ? 1 : nativeMax(toInteger(n), 0); var result = (this.__filtered__ && !index) - ? new LazyWrapper(this) - : this.clone(); + ? new LazyWrapper(this) + : this.clone(); if (result.__filtered__) { result.__takeCount__ = nativeMin(n, result.__takeCount__); @@ -10538,7 +10538,7 @@ if (!_global.BI) { // 数组相关的方法 _.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection", - "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) { + "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) { BI[name] = _apply(name); }); _.each(["findIndex", "findLastIndex"], function (name) { diff --git a/dist/demo.js b/dist/demo.js index 7d0b73c8a..8afee9124 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -3308,8 +3308,9 @@ BI.shortcut("demo.center", Demo.Center);Demo.TreeValueChooser = BI.inherit(BI.Wi render: function () { var widget = BI.createWidget({ - type: "bi.list_tree_value_chooser_insert_combo", + type: "bi.tree_value_chooser_combo", width: 300, + allowSearchValue: true, // items: BI.deepClone(Demo.CONSTANTS.TREEITEMS), itemsCreator: function (op, callback) { callback(BI.deepClone(Demo.CONSTANTS.TREEITEMS)); @@ -10404,6 +10405,7 @@ Demo.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { ref: function (_ref) { self.tree = _ref; }, + allowEdit: true, text: "默认值", items: items, width: 300, @@ -10586,6 +10588,7 @@ Demo.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { ref: function (_ref) { self.tree = _ref; }, + allowEdit: true, text: "默认值", items: items, width: 300 diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js index 2a1ea7105..6394497ab 100644 --- a/dist/fineui.ie.js +++ b/dist/fineui.ie.js @@ -267,7 +267,7 @@ if(_global.BI.prepares == null) { }/** * @license * Lodash (Custom Build) - * Build: `lodash core plus="debounce,throttle,get,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"` + * Build: `lodash core plus="debounce,throttle,get,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"` * Copyright JS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 @@ -460,34 +460,34 @@ if(_global.BI.prepares == null) { /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = - typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = - typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = - typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = - typedArrayTags[uint32Tag] = true; + typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = + typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = + typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = + typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = - typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = - typedArrayTags[errorTag] = typedArrayTags[funcTag] = - typedArrayTags[mapTag] = typedArrayTags[numberTag] = - typedArrayTags[objectTag] = typedArrayTags[regexpTag] = - typedArrayTags[setTag] = typedArrayTags[stringTag] = - typedArrayTags[weakMapTag] = false; + typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = + typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = + typedArrayTags[errorTag] = typedArrayTags[funcTag] = + typedArrayTags[mapTag] = typedArrayTags[numberTag] = + typedArrayTags[objectTag] = typedArrayTags[regexpTag] = + typedArrayTags[setTag] = typedArrayTags[stringTag] = + typedArrayTags[weakMapTag] = false; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = - cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = - cloneableTags[boolTag] = cloneableTags[dateTag] = - cloneableTags[float32Tag] = cloneableTags[float64Tag] = - cloneableTags[int8Tag] = cloneableTags[int16Tag] = - cloneableTags[int32Tag] = cloneableTags[mapTag] = - cloneableTags[numberTag] = cloneableTags[objectTag] = - cloneableTags[regexpTag] = cloneableTags[setTag] = - cloneableTags[stringTag] = cloneableTags[symbolTag] = - cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = - cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = + cloneableTags[boolTag] = cloneableTags[dateTag] = + cloneableTags[float32Tag] = cloneableTags[float64Tag] = + cloneableTags[int8Tag] = cloneableTags[int16Tag] = + cloneableTags[int32Tag] = cloneableTags[mapTag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[setTag] = + cloneableTags[stringTag] = cloneableTags[symbolTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = - cloneableTags[weakMapTag] = false; + cloneableTags[weakMapTag] = false; /** Used to map characters to HTML entities. */ var htmlEscapes = { @@ -844,8 +844,8 @@ if(_global.BI.prepares == null) { */ function baseIndexOf(array, value, fromIndex) { return value === value - ? strictIndexOf(array, value, fromIndex) - : baseFindIndex(array, baseIsNaN, fromIndex); + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); } /** @@ -901,8 +901,8 @@ if(_global.BI.prepares == null) { function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { eachFunc(collection, function(value, index, collection) { accumulator = initAccum - ? (initAccum = false, value) - : iteratee(accumulator, value, index, collection); + ? (initAccum = false, value) + : iteratee(accumulator, value, index, collection); }); return accumulator; } @@ -1155,8 +1155,8 @@ if(_global.BI.prepares == null) { */ function safeGet(object, key) { return key == '__proto__' - ? undefined - : object[key]; + ? undefined + : object[key]; } /** @@ -1207,8 +1207,8 @@ if(_global.BI.prepares == null) { */ function stringSize(string) { return hasUnicode(string) - ? unicodeSize(string) - : asciiSize(string); + ? unicodeSize(string) + : asciiSize(string); } /** @@ -1220,8 +1220,8 @@ if(_global.BI.prepares == null) { */ function stringToArray(string) { return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); + ? unicodeToArray(string) + : asciiToArray(string); } /** @@ -1290,8 +1290,8 @@ if(_global.BI.prepares == null) { /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ @@ -1628,30 +1628,30 @@ if(_global.BI.prepares == null) { var result = []; outer: - while (length-- && resIndex < takeCount) { - index += dir; - - var iterIndex = -1, - value = array[index]; - - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], - iteratee = data.iteratee, - type = data.type, - computed = iteratee(value); - - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } - } + while (length-- && resIndex < takeCount) { + index += dir; + + var iterIndex = -1, + value = array[index]; + + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], + iteratee = data.iteratee, + type = data.type, + computed = iteratee(value); + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; } - result[resIndex++] = value; } + } + result[resIndex++] = value; + } return result; } @@ -2159,14 +2159,14 @@ if(_global.BI.prepares == null) { for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) ))) { result.push(key); } @@ -2381,8 +2381,8 @@ if(_global.BI.prepares == null) { result = (isFlat || isFunc) ? {} : initCloneObject(value); if (!isDeep) { return isFlat - ? copySymbolsIn(value, baseAssignIn(result, value)) - : copySymbols(value, baseAssign(result, value)); + ? copySymbolsIn(value, baseAssignIn(result, value)) + : copySymbols(value, baseAssign(result, value)); } } else { if (!cloneableTags[tag]) { @@ -2416,8 +2416,8 @@ if(_global.BI.prepares == null) { } var keysFunc = isFull - ? (isFlat ? getAllKeysIn : getAllKeys) - : (isFlat ? keysIn : keys); + ? (isFlat ? getAllKeysIn : getAllKeys) + : (isFlat ? keysIn : keys); var props = isArr ? undefined : keysFunc(value); arrayEach(props || value, function(subValue, key) { @@ -2483,24 +2483,24 @@ if(_global.BI.prepares == null) { values = new SetCache(values); } outer: - while (++index < length) { - var value = array[index], - computed = iteratee == null ? value : iteratee(value); - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee == null ? value : iteratee(value); + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === computed) { + continue outer; } } + result.push(value); + } + else if (!includes(values, computed, comparator)) { + result.push(value); + } + } return result; } @@ -2551,9 +2551,9 @@ if(_global.BI.prepares == null) { current = iteratee(value); if (current != null && (computed === undefined - ? (current === current && !isSymbol(current)) - : comparator(current, computed) - )) { + ? (current === current && !isSymbol(current)) + : comparator(current, computed) + )) { var computed = current, result = value; } @@ -2725,8 +2725,8 @@ if(_global.BI.prepares == null) { return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); + ? getRawTag(value) + : objectToString(value); } /** @@ -2792,8 +2792,8 @@ if(_global.BI.prepares == null) { } maxLength = nativeMin(array.length, maxLength); caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) - ? new SetCache(othIndex && array) - : undefined; + ? new SetCache(othIndex && array) + : undefined; } array = arrays[0]; @@ -2801,31 +2801,31 @@ if(_global.BI.prepares == null) { seen = caches[0]; outer: - while (++index < length && result.length < maxLength) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (!(seen - ? cacheHas(seen, computed) - : includes(result, computed, comparator) + while (++index < length && result.length < maxLength) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (!(seen + ? cacheHas(seen, computed) + : includes(result, computed, comparator) )) { - othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache - ? cacheHas(cache, computed) - : includes(arrays[othIndex], computed, comparator)) + othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if (!(cache + ? cacheHas(cache, computed) + : includes(arrays[othIndex], computed, comparator)) ) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result.push(value); + continue outer; } } + if (seen) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -2947,8 +2947,8 @@ if(_global.BI.prepares == null) { if (isSameTag && !objIsObj) { stack || (stack = new Stack); return (objIsArr || isTypedArray(object)) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), @@ -3002,9 +3002,9 @@ if(_global.BI.prepares == null) { while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { return false; } } @@ -3024,9 +3024,9 @@ if(_global.BI.prepares == null) { var result = customizer(objValue, srcValue, key, object, source, stack); } if (!(result === undefined - ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) - : result - )) { + ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) + : result + )) { return false; } } @@ -3081,7 +3081,7 @@ if(_global.BI.prepares == null) { */ function baseIsTypedArray(value) { return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } /** @@ -3102,8 +3102,8 @@ if(_global.BI.prepares == null) { } if (typeof value == 'object') { return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); } return property(value); } @@ -3213,8 +3213,8 @@ if(_global.BI.prepares == null) { return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } @@ -3240,8 +3240,8 @@ if(_global.BI.prepares == null) { } else { var newValue = customizer - ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) + : undefined; if (newValue === undefined) { newValue = srcValue; @@ -3276,8 +3276,8 @@ if(_global.BI.prepares == null) { return; } var newValue = customizer - ? customizer(objValue, srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; var isCommon = newValue === undefined; @@ -3484,8 +3484,8 @@ if(_global.BI.prepares == null) { newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { newValue = isObject(objValue) - ? objValue - : (isIndex(path[index + 1]) ? [] : {}); + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); } } assignValue(nested, key, newValue); @@ -3631,30 +3631,30 @@ if(_global.BI.prepares == null) { seen = iteratee ? [] : result; } outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; } } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -4028,8 +4028,8 @@ if(_global.BI.prepares == null) { var key = props[index]; var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; + ? customizer(object[key], source[key], key, object, source) + : undefined; if (newValue === undefined) { newValue = source[key]; @@ -4099,8 +4099,8 @@ if(_global.BI.prepares == null) { guard = length > 2 ? sources[2] : undefined; customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; + ? (length--, customizer) + : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; @@ -4246,14 +4246,14 @@ if(_global.BI.prepares == null) { args[index] = arguments[index]; } var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) - ? [] - : replaceHolders(args, placeholder); + ? [] + : replaceHolders(args, placeholder); length -= holders.length; if (length < arity) { return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, undefined, - args, holders, undefined, undefined, arity - length); + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); } var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return apply(fn, this, args); @@ -4330,8 +4330,8 @@ if(_global.BI.prepares == null) { if (isCurried && length < arity) { var newHolders = replaceHolders(args, placeholder); return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, thisArg, - args, newHolders, argPos, ary, arity - length + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length ); } var thisBinding = isBind ? thisArg : this, @@ -4543,8 +4543,8 @@ if(_global.BI.prepares == null) { partials = newData[3]; holders = newData[4]; arity = newData[9] = newData[9] === undefined - ? (isBindKey ? 0 : func.length) - : nativeMax(newData[9] - length, 0); + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); @@ -4639,8 +4639,8 @@ if(_global.BI.prepares == null) { if (customizer) { var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { @@ -4652,18 +4652,18 @@ if(_global.BI.prepares == null) { // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { - if (!cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { + if (!cacheHas(seen, othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { result = false; break; } } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, bitmask, customizer, stack) - )) { + arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack) + )) { result = false; break; } @@ -4802,14 +4802,14 @@ if(_global.BI.prepares == null) { if (customizer) { var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) - : compared - )) { + ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) + : compared + )) { result = false; break; } @@ -4823,7 +4823,7 @@ if(_global.BI.prepares == null) { if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { + typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } @@ -4922,8 +4922,8 @@ if(_global.BI.prepares == null) { function getMapData(map, key) { var data = map.__data__; return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; } /** @@ -5120,7 +5120,7 @@ if(_global.BI.prepares == null) { } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && - (isArray(object) || isArguments(object)); + (isArray(object) || isArguments(object)); } /** @@ -5151,8 +5151,8 @@ if(_global.BI.prepares == null) { */ function initCloneObject(object) { return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; + ? baseCreate(getPrototype(object)) + : {}; } /** @@ -5231,7 +5231,7 @@ if(_global.BI.prepares == null) { */ function isFlattenable(value) { return isArray(value) || isArguments(value) || - !!(spreadableSymbol && value && value[spreadableSymbol]); + !!(spreadableSymbol && value && value[spreadableSymbol]); } /** @@ -5247,9 +5247,9 @@ if(_global.BI.prepares == null) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); } /** @@ -5268,9 +5268,9 @@ if(_global.BI.prepares == null) { } var type = typeof index; if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { return eq(object[index], value); } return false; @@ -5294,7 +5294,7 @@ if(_global.BI.prepares == null) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object)); + (object != null && value in Object(object)); } /** @@ -5307,8 +5307,8 @@ if(_global.BI.prepares == null) { function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); + ? (value !== '__proto__') + : (value === null); } /** @@ -5385,7 +5385,7 @@ if(_global.BI.prepares == null) { return false; } return object[key] === srcValue && - (srcValue !== undefined || (key in Object(object))); + (srcValue !== undefined || (key in Object(object))); }; } @@ -5432,9 +5432,9 @@ if(_global.BI.prepares == null) { isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); var isCombo = - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || - ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || + ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); // Exit early if metadata can't be merged. if (!(isCommon || isCombo)) { @@ -5824,8 +5824,8 @@ if(_global.BI.prepares == null) { */ var difference = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) - : []; + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) + : []; }); /** @@ -5953,8 +5953,8 @@ if(_global.BI.prepares == null) { if (fromIndex !== undefined) { index = toInteger(fromIndex); index = fromIndex < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1); + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1); } return baseFindIndex(array, baseIteratee(predicate, 3), index, true); } @@ -6093,8 +6093,8 @@ if(_global.BI.prepares == null) { var intersection = baseRest(function(arrays) { var mapped = arrayMap(arrays, castArrayLikeObject); return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped) - : []; + ? baseIntersection(mapped) + : []; }); /** @@ -6369,8 +6369,8 @@ if(_global.BI.prepares == null) { */ var without = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, values) - : []; + ? baseDifference(array, values) + : []; }); /** @@ -7440,8 +7440,8 @@ if(_global.BI.prepares == null) { timeWaiting = wait - timeSinceLastCall; return maxing - ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) - : timeWaiting; + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; } function shouldInvoke(time) { @@ -7452,7 +7452,7 @@ if(_global.BI.prepares == null) { // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { @@ -7891,7 +7891,7 @@ if(_global.BI.prepares == null) { */ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); + !propertyIsEnumerable.call(value, 'callee'); }; /** @@ -7996,7 +7996,7 @@ if(_global.BI.prepares == null) { */ function isBoolean(value) { return value === true || value === false || - (isObjectLike(value) && baseGetTag(value) == boolTag); + (isObjectLike(value) && baseGetTag(value) == boolTag); } /** @@ -8076,7 +8076,7 @@ if(_global.BI.prepares == null) { } if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || - isBuffer(value) || isTypedArray(value) || isArguments(value))) { + isBuffer(value) || isTypedArray(value) || isArguments(value))) { return !value.length; } var tag = getTag(value); @@ -8211,7 +8211,7 @@ if(_global.BI.prepares == null) { */ function isLength(value) { return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -8375,7 +8375,7 @@ if(_global.BI.prepares == null) { */ function isNumber(value) { return typeof value == 'number' || - (isObjectLike(value) && baseGetTag(value) == numberTag); + (isObjectLike(value) && baseGetTag(value) == numberTag); } /** @@ -8416,7 +8416,7 @@ if(_global.BI.prepares == null) { } var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && - funcToString.call(Ctor) == objectCtorString; + funcToString.call(Ctor) == objectCtorString; } /** @@ -8476,7 +8476,7 @@ if(_global.BI.prepares == null) { */ function isString(value) { return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); } /** @@ -8498,7 +8498,7 @@ if(_global.BI.prepares == null) { */ function isSymbol(value) { return typeof value == 'symbol' || - (isObjectLike(value) && baseGetTag(value) == symbolTag); + (isObjectLike(value) && baseGetTag(value) == symbolTag); } /** @@ -8688,8 +8688,8 @@ if(_global.BI.prepares == null) { value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); } /** @@ -9600,8 +9600,8 @@ if(_global.BI.prepares == null) { function escape(string) { string = toString(string); return (string && reHasUnescapedHtml.test(string)) - ? string.replace(reUnescapedHtml, escapeHtmlChar) - : string; + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; } /** @@ -10027,8 +10027,8 @@ if(_global.BI.prepares == null) { */ function max(array) { return (array && array.length) - ? baseExtremum(array, identity, baseGt) - : undefined; + ? baseExtremum(array, identity, baseGt) + : undefined; } /** @@ -10051,8 +10051,8 @@ if(_global.BI.prepares == null) { */ function min(array) { return (array && array.length) - ? baseExtremum(array, identity, baseLt) - : undefined; + ? baseExtremum(array, identity, baseLt) + : undefined; } /*------------------------------------------------------------------------*/ @@ -10198,8 +10198,8 @@ if(_global.BI.prepares == null) { n = n === undefined ? 1 : nativeMax(toInteger(n), 0); var result = (this.__filtered__ && !index) - ? new LazyWrapper(this) - : this.clone(); + ? new LazyWrapper(this) + : this.clone(); if (result.__filtered__) { result.__takeCount__ = nativeMin(n, result.__takeCount__); @@ -10783,7 +10783,7 @@ if (!_global.BI) { // 数组相关的方法 _.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection", - "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) { + "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) { BI[name] = _apply(name); }); _.each(["findIndex", "findLastIndex"], function (name) { @@ -68833,7 +68833,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { attributes: { tabIndex: 0 }, - allowEdit: false + allowEdit: false, + allowSearchValue: false }); }, @@ -68913,6 +68914,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { return { el: { type: "bi.multilayer_select_tree_trigger", + allowSearchValue: o.allowSearchValue, allowEdit: o.allowEdit, cls: "multilayer-select-tree-trigger", ref: function (_ref) { @@ -69270,7 +69272,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { this.tree = new BI.Tree(); - this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items)))); + this.tree.initTree(BI.Tree.treeFormat(o.items)); } var content = { type: "bi.htape", @@ -69324,9 +69326,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { onSearch: function (obj, callback) { var keyword = obj.keyword; if(o.itemsCreator === BI.emptyFn) { - var finding = BI.Func.getSearchResult(o.items, keyword); - var matched = finding.match, find = finding.find; - callback(self._fillTreeStructure4Search(find.concat(matched))); + callback(self._getSearchItems(keyword)); } else { callback(); } @@ -69368,27 +69368,59 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _getSearchItems: function(keyword) { + var o = this.options; + var findingText = BI.Func.getSearchResult(o.items, keyword, "text"); + var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []}; + var textItems = findingText.find.concat(findingText.match); + var valueItems = findingValue.find.concat(findingValue.match); + return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + }, + + _createJson: function(node, open) { + return { + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + isParent: BI.isNotEmptyArray(node.children), + open: open + } + }, + + _getChildren: function(node) { + var self = this; + node.children = node.children || []; + var nodes = []; + BI.each(node.children, function (idx, child) { + var children = self._getChildren(child); + nodes = nodes.concat(children); + }); + return node.children.concat(nodes); + }, + // 将搜索到的节点进行补充,构造成一棵完整的树 _fillTreeStructure4Search: function (leaves) { - var result = BI.map(leaves, "id"); - var queue = leaves.reverse() || []; + var self = this; + var result = []; + var queue = []; + BI.each(leaves, function (idx, node) { + queue.push({pId: node.pId}); + result.push(node); + result = result.concat(self._getChildren(node)); + }); while (BI.isNotEmptyArray(queue)) { var node = queue.pop(); var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { - queue.push(pNode); - result.push(pNode.id); + pNode.open = true; + queue.push({pId: pNode.pId}); + result.push(pNode); } } - var nodes = []; - BI.each(this.options.items, function (idx, item) { - if(BI.contains(result, item.id)) { - nodes.push(BI.extend({}, item, { - open: true - })) - } - }); - return nodes; + return BI.uniqBy(BI.map(result, function (idx, node) { + return self._createJson(node, node.open); + }), "id"); }, _digest: function (v) { @@ -69934,6 +69966,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { return { el: { type: "bi.multilayer_single_tree_trigger", + allowSearchValue: o.allowSearchValue, allowEdit: o.allowEdit, cls: "multilayer-single-tree-trigger", ref: function (_ref) { @@ -70282,7 +70315,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { return v; }, itemsCreator: BI.emptyFn, - watermark: BI.i18nText("BI-Basic_Search") + watermark: BI.i18nText("BI-Basic_Search"), + allowSearchValue: false }; }, @@ -70290,7 +70324,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { this.tree = new BI.Tree(); - this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items)))); + this.tree.initTree(BI.Tree.treeFormat(o.items)); } var content = { type: "bi.htape", @@ -70344,9 +70378,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { onSearch: function (obj, callback) { var keyword = obj.keyword; if(o.itemsCreator === BI.emptyFn) { - var finding = BI.Func.getSearchResult(o.items, keyword); - var matched = finding.match, find = finding.find; - callback(self._fillTreeStructure4Search(find.concat(matched))); + callback(self._getSearchItems(keyword)); } else { callback(); } @@ -70388,27 +70420,59 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _getSearchItems: function(keyword) { + var o = this.options; + var findingText = BI.Func.getSearchResult(o.items, keyword, "text"); + var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []}; + var textItems = findingText.find.concat(findingText.match); + var valueItems = findingValue.find.concat(findingValue.match); + return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + }, + + _createJson: function(node, open) { + return { + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + isParent: BI.isNotEmptyArray(node.children), + open: open + } + }, + + _getChildren: function(node) { + var self = this; + node.children = node.children || []; + var nodes = []; + BI.each(node.children, function (idx, child) { + var children = self._getChildren(child); + nodes = nodes.concat(children); + }); + return node.children.concat(nodes); + }, + // 将搜索到的节点进行补充,构造成一棵完整的树 _fillTreeStructure4Search: function (leaves) { - var result = BI.map(leaves, "id"); - var queue = leaves.reverse() || []; + var self = this; + var result = []; + var queue = []; + BI.each(leaves, function (idx, node) { + queue.push({pId: node.pId}); + result.push(node); + result = result.concat(self._getChildren(node)); + }); while (BI.isNotEmptyArray(queue)) { var node = queue.pop(); var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { - queue.push(pNode); - result.push(pNode.id); + pNode.open = true; + queue.push({pId: pNode.pId}); + result.push(pNode); } } - var nodes = []; - BI.each(this.options.items, function (idx, item) { - if(BI.contains(result, item.id)) { - nodes.push(BI.extend({}, item, { - open: true - })) - } - }); - return nodes; + return BI.uniqBy(BI.map(result, function (idx, node) { + return self._createJson(node, node.open); + }), "id"); }, _digest: function (v) { @@ -88077,11 +88141,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, { }, _isMatch: function (parentValues, value, keyword) { + var o = this.options; var node = this._getTreeNode(parentValues, value); if (!node) { return false; } var find = BI.Func.getSearchResult([node.text || node.value], keyword); + if(o.allowSearchValue && node.value) { + var valueFind = BI.Func.getSearchResult([node.value], keyword); + return valueFind.find.length > 0 || valueFind.match.length > 0 || + find.find.length > 0 || find.match.length > 0; + } return find.find.length > 0 || find.match.length > 0; }, diff --git a/dist/fineui.js b/dist/fineui.js index c0e3b9366..682e5e08b 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -267,7 +267,7 @@ if(_global.BI.prepares == null) { }/** * @license * Lodash (Custom Build) - * Build: `lodash core plus="debounce,throttle,get,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"` + * Build: `lodash core plus="debounce,throttle,get,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"` * Copyright JS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 @@ -460,34 +460,34 @@ if(_global.BI.prepares == null) { /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = - typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = - typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = - typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = - typedArrayTags[uint32Tag] = true; + typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = + typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = + typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = + typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = - typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = - typedArrayTags[errorTag] = typedArrayTags[funcTag] = - typedArrayTags[mapTag] = typedArrayTags[numberTag] = - typedArrayTags[objectTag] = typedArrayTags[regexpTag] = - typedArrayTags[setTag] = typedArrayTags[stringTag] = - typedArrayTags[weakMapTag] = false; + typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = + typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = + typedArrayTags[errorTag] = typedArrayTags[funcTag] = + typedArrayTags[mapTag] = typedArrayTags[numberTag] = + typedArrayTags[objectTag] = typedArrayTags[regexpTag] = + typedArrayTags[setTag] = typedArrayTags[stringTag] = + typedArrayTags[weakMapTag] = false; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = - cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = - cloneableTags[boolTag] = cloneableTags[dateTag] = - cloneableTags[float32Tag] = cloneableTags[float64Tag] = - cloneableTags[int8Tag] = cloneableTags[int16Tag] = - cloneableTags[int32Tag] = cloneableTags[mapTag] = - cloneableTags[numberTag] = cloneableTags[objectTag] = - cloneableTags[regexpTag] = cloneableTags[setTag] = - cloneableTags[stringTag] = cloneableTags[symbolTag] = - cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = - cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = + cloneableTags[boolTag] = cloneableTags[dateTag] = + cloneableTags[float32Tag] = cloneableTags[float64Tag] = + cloneableTags[int8Tag] = cloneableTags[int16Tag] = + cloneableTags[int32Tag] = cloneableTags[mapTag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[setTag] = + cloneableTags[stringTag] = cloneableTags[symbolTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = - cloneableTags[weakMapTag] = false; + cloneableTags[weakMapTag] = false; /** Used to map characters to HTML entities. */ var htmlEscapes = { @@ -844,8 +844,8 @@ if(_global.BI.prepares == null) { */ function baseIndexOf(array, value, fromIndex) { return value === value - ? strictIndexOf(array, value, fromIndex) - : baseFindIndex(array, baseIsNaN, fromIndex); + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); } /** @@ -901,8 +901,8 @@ if(_global.BI.prepares == null) { function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { eachFunc(collection, function(value, index, collection) { accumulator = initAccum - ? (initAccum = false, value) - : iteratee(accumulator, value, index, collection); + ? (initAccum = false, value) + : iteratee(accumulator, value, index, collection); }); return accumulator; } @@ -1155,8 +1155,8 @@ if(_global.BI.prepares == null) { */ function safeGet(object, key) { return key == '__proto__' - ? undefined - : object[key]; + ? undefined + : object[key]; } /** @@ -1207,8 +1207,8 @@ if(_global.BI.prepares == null) { */ function stringSize(string) { return hasUnicode(string) - ? unicodeSize(string) - : asciiSize(string); + ? unicodeSize(string) + : asciiSize(string); } /** @@ -1220,8 +1220,8 @@ if(_global.BI.prepares == null) { */ function stringToArray(string) { return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); + ? unicodeToArray(string) + : asciiToArray(string); } /** @@ -1290,8 +1290,8 @@ if(_global.BI.prepares == null) { /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ @@ -1628,30 +1628,30 @@ if(_global.BI.prepares == null) { var result = []; outer: - while (length-- && resIndex < takeCount) { - index += dir; - - var iterIndex = -1, - value = array[index]; - - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], - iteratee = data.iteratee, - type = data.type, - computed = iteratee(value); - - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } - } + while (length-- && resIndex < takeCount) { + index += dir; + + var iterIndex = -1, + value = array[index]; + + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], + iteratee = data.iteratee, + type = data.type, + computed = iteratee(value); + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; } - result[resIndex++] = value; } + } + result[resIndex++] = value; + } return result; } @@ -2159,14 +2159,14 @@ if(_global.BI.prepares == null) { for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) ))) { result.push(key); } @@ -2381,8 +2381,8 @@ if(_global.BI.prepares == null) { result = (isFlat || isFunc) ? {} : initCloneObject(value); if (!isDeep) { return isFlat - ? copySymbolsIn(value, baseAssignIn(result, value)) - : copySymbols(value, baseAssign(result, value)); + ? copySymbolsIn(value, baseAssignIn(result, value)) + : copySymbols(value, baseAssign(result, value)); } } else { if (!cloneableTags[tag]) { @@ -2416,8 +2416,8 @@ if(_global.BI.prepares == null) { } var keysFunc = isFull - ? (isFlat ? getAllKeysIn : getAllKeys) - : (isFlat ? keysIn : keys); + ? (isFlat ? getAllKeysIn : getAllKeys) + : (isFlat ? keysIn : keys); var props = isArr ? undefined : keysFunc(value); arrayEach(props || value, function(subValue, key) { @@ -2483,24 +2483,24 @@ if(_global.BI.prepares == null) { values = new SetCache(values); } outer: - while (++index < length) { - var value = array[index], - computed = iteratee == null ? value : iteratee(value); - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee == null ? value : iteratee(value); + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === computed) { + continue outer; } } + result.push(value); + } + else if (!includes(values, computed, comparator)) { + result.push(value); + } + } return result; } @@ -2551,9 +2551,9 @@ if(_global.BI.prepares == null) { current = iteratee(value); if (current != null && (computed === undefined - ? (current === current && !isSymbol(current)) - : comparator(current, computed) - )) { + ? (current === current && !isSymbol(current)) + : comparator(current, computed) + )) { var computed = current, result = value; } @@ -2725,8 +2725,8 @@ if(_global.BI.prepares == null) { return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); + ? getRawTag(value) + : objectToString(value); } /** @@ -2792,8 +2792,8 @@ if(_global.BI.prepares == null) { } maxLength = nativeMin(array.length, maxLength); caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) - ? new SetCache(othIndex && array) - : undefined; + ? new SetCache(othIndex && array) + : undefined; } array = arrays[0]; @@ -2801,31 +2801,31 @@ if(_global.BI.prepares == null) { seen = caches[0]; outer: - while (++index < length && result.length < maxLength) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (!(seen - ? cacheHas(seen, computed) - : includes(result, computed, comparator) + while (++index < length && result.length < maxLength) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (!(seen + ? cacheHas(seen, computed) + : includes(result, computed, comparator) )) { - othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache - ? cacheHas(cache, computed) - : includes(arrays[othIndex], computed, comparator)) + othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if (!(cache + ? cacheHas(cache, computed) + : includes(arrays[othIndex], computed, comparator)) ) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result.push(value); + continue outer; } } + if (seen) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -2947,8 +2947,8 @@ if(_global.BI.prepares == null) { if (isSameTag && !objIsObj) { stack || (stack = new Stack); return (objIsArr || isTypedArray(object)) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), @@ -3002,9 +3002,9 @@ if(_global.BI.prepares == null) { while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { return false; } } @@ -3024,9 +3024,9 @@ if(_global.BI.prepares == null) { var result = customizer(objValue, srcValue, key, object, source, stack); } if (!(result === undefined - ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) - : result - )) { + ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) + : result + )) { return false; } } @@ -3081,7 +3081,7 @@ if(_global.BI.prepares == null) { */ function baseIsTypedArray(value) { return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } /** @@ -3102,8 +3102,8 @@ if(_global.BI.prepares == null) { } if (typeof value == 'object') { return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); } return property(value); } @@ -3213,8 +3213,8 @@ if(_global.BI.prepares == null) { return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } @@ -3240,8 +3240,8 @@ if(_global.BI.prepares == null) { } else { var newValue = customizer - ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) + : undefined; if (newValue === undefined) { newValue = srcValue; @@ -3276,8 +3276,8 @@ if(_global.BI.prepares == null) { return; } var newValue = customizer - ? customizer(objValue, srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; var isCommon = newValue === undefined; @@ -3484,8 +3484,8 @@ if(_global.BI.prepares == null) { newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { newValue = isObject(objValue) - ? objValue - : (isIndex(path[index + 1]) ? [] : {}); + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); } } assignValue(nested, key, newValue); @@ -3631,30 +3631,30 @@ if(_global.BI.prepares == null) { seen = iteratee ? [] : result; } outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; } } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -4028,8 +4028,8 @@ if(_global.BI.prepares == null) { var key = props[index]; var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; + ? customizer(object[key], source[key], key, object, source) + : undefined; if (newValue === undefined) { newValue = source[key]; @@ -4099,8 +4099,8 @@ if(_global.BI.prepares == null) { guard = length > 2 ? sources[2] : undefined; customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; + ? (length--, customizer) + : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; @@ -4246,14 +4246,14 @@ if(_global.BI.prepares == null) { args[index] = arguments[index]; } var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) - ? [] - : replaceHolders(args, placeholder); + ? [] + : replaceHolders(args, placeholder); length -= holders.length; if (length < arity) { return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, undefined, - args, holders, undefined, undefined, arity - length); + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); } var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return apply(fn, this, args); @@ -4330,8 +4330,8 @@ if(_global.BI.prepares == null) { if (isCurried && length < arity) { var newHolders = replaceHolders(args, placeholder); return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, thisArg, - args, newHolders, argPos, ary, arity - length + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length ); } var thisBinding = isBind ? thisArg : this, @@ -4543,8 +4543,8 @@ if(_global.BI.prepares == null) { partials = newData[3]; holders = newData[4]; arity = newData[9] = newData[9] === undefined - ? (isBindKey ? 0 : func.length) - : nativeMax(newData[9] - length, 0); + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); @@ -4639,8 +4639,8 @@ if(_global.BI.prepares == null) { if (customizer) { var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { @@ -4652,18 +4652,18 @@ if(_global.BI.prepares == null) { // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { - if (!cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { + if (!cacheHas(seen, othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { result = false; break; } } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, bitmask, customizer, stack) - )) { + arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack) + )) { result = false; break; } @@ -4802,14 +4802,14 @@ if(_global.BI.prepares == null) { if (customizer) { var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) - : compared - )) { + ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) + : compared + )) { result = false; break; } @@ -4823,7 +4823,7 @@ if(_global.BI.prepares == null) { if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { + typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } @@ -4922,8 +4922,8 @@ if(_global.BI.prepares == null) { function getMapData(map, key) { var data = map.__data__; return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; } /** @@ -5120,7 +5120,7 @@ if(_global.BI.prepares == null) { } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && - (isArray(object) || isArguments(object)); + (isArray(object) || isArguments(object)); } /** @@ -5151,8 +5151,8 @@ if(_global.BI.prepares == null) { */ function initCloneObject(object) { return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; + ? baseCreate(getPrototype(object)) + : {}; } /** @@ -5231,7 +5231,7 @@ if(_global.BI.prepares == null) { */ function isFlattenable(value) { return isArray(value) || isArguments(value) || - !!(spreadableSymbol && value && value[spreadableSymbol]); + !!(spreadableSymbol && value && value[spreadableSymbol]); } /** @@ -5247,9 +5247,9 @@ if(_global.BI.prepares == null) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); } /** @@ -5268,9 +5268,9 @@ if(_global.BI.prepares == null) { } var type = typeof index; if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { return eq(object[index], value); } return false; @@ -5294,7 +5294,7 @@ if(_global.BI.prepares == null) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object)); + (object != null && value in Object(object)); } /** @@ -5307,8 +5307,8 @@ if(_global.BI.prepares == null) { function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); + ? (value !== '__proto__') + : (value === null); } /** @@ -5385,7 +5385,7 @@ if(_global.BI.prepares == null) { return false; } return object[key] === srcValue && - (srcValue !== undefined || (key in Object(object))); + (srcValue !== undefined || (key in Object(object))); }; } @@ -5432,9 +5432,9 @@ if(_global.BI.prepares == null) { isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); var isCombo = - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || - ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || + ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); // Exit early if metadata can't be merged. if (!(isCommon || isCombo)) { @@ -5824,8 +5824,8 @@ if(_global.BI.prepares == null) { */ var difference = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) - : []; + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) + : []; }); /** @@ -5953,8 +5953,8 @@ if(_global.BI.prepares == null) { if (fromIndex !== undefined) { index = toInteger(fromIndex); index = fromIndex < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1); + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1); } return baseFindIndex(array, baseIteratee(predicate, 3), index, true); } @@ -6093,8 +6093,8 @@ if(_global.BI.prepares == null) { var intersection = baseRest(function(arrays) { var mapped = arrayMap(arrays, castArrayLikeObject); return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped) - : []; + ? baseIntersection(mapped) + : []; }); /** @@ -6369,8 +6369,8 @@ if(_global.BI.prepares == null) { */ var without = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, values) - : []; + ? baseDifference(array, values) + : []; }); /** @@ -7440,8 +7440,8 @@ if(_global.BI.prepares == null) { timeWaiting = wait - timeSinceLastCall; return maxing - ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) - : timeWaiting; + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; } function shouldInvoke(time) { @@ -7452,7 +7452,7 @@ if(_global.BI.prepares == null) { // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { @@ -7891,7 +7891,7 @@ if(_global.BI.prepares == null) { */ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); + !propertyIsEnumerable.call(value, 'callee'); }; /** @@ -7996,7 +7996,7 @@ if(_global.BI.prepares == null) { */ function isBoolean(value) { return value === true || value === false || - (isObjectLike(value) && baseGetTag(value) == boolTag); + (isObjectLike(value) && baseGetTag(value) == boolTag); } /** @@ -8076,7 +8076,7 @@ if(_global.BI.prepares == null) { } if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || - isBuffer(value) || isTypedArray(value) || isArguments(value))) { + isBuffer(value) || isTypedArray(value) || isArguments(value))) { return !value.length; } var tag = getTag(value); @@ -8211,7 +8211,7 @@ if(_global.BI.prepares == null) { */ function isLength(value) { return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -8375,7 +8375,7 @@ if(_global.BI.prepares == null) { */ function isNumber(value) { return typeof value == 'number' || - (isObjectLike(value) && baseGetTag(value) == numberTag); + (isObjectLike(value) && baseGetTag(value) == numberTag); } /** @@ -8416,7 +8416,7 @@ if(_global.BI.prepares == null) { } var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && - funcToString.call(Ctor) == objectCtorString; + funcToString.call(Ctor) == objectCtorString; } /** @@ -8476,7 +8476,7 @@ if(_global.BI.prepares == null) { */ function isString(value) { return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); } /** @@ -8498,7 +8498,7 @@ if(_global.BI.prepares == null) { */ function isSymbol(value) { return typeof value == 'symbol' || - (isObjectLike(value) && baseGetTag(value) == symbolTag); + (isObjectLike(value) && baseGetTag(value) == symbolTag); } /** @@ -8688,8 +8688,8 @@ if(_global.BI.prepares == null) { value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); } /** @@ -9600,8 +9600,8 @@ if(_global.BI.prepares == null) { function escape(string) { string = toString(string); return (string && reHasUnescapedHtml.test(string)) - ? string.replace(reUnescapedHtml, escapeHtmlChar) - : string; + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; } /** @@ -10027,8 +10027,8 @@ if(_global.BI.prepares == null) { */ function max(array) { return (array && array.length) - ? baseExtremum(array, identity, baseGt) - : undefined; + ? baseExtremum(array, identity, baseGt) + : undefined; } /** @@ -10051,8 +10051,8 @@ if(_global.BI.prepares == null) { */ function min(array) { return (array && array.length) - ? baseExtremum(array, identity, baseLt) - : undefined; + ? baseExtremum(array, identity, baseLt) + : undefined; } /*------------------------------------------------------------------------*/ @@ -10198,8 +10198,8 @@ if(_global.BI.prepares == null) { n = n === undefined ? 1 : nativeMax(toInteger(n), 0); var result = (this.__filtered__ && !index) - ? new LazyWrapper(this) - : this.clone(); + ? new LazyWrapper(this) + : this.clone(); if (result.__filtered__) { result.__takeCount__ = nativeMin(n, result.__takeCount__); @@ -10783,7 +10783,7 @@ if (!_global.BI) { // 数组相关的方法 _.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection", - "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) { + "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) { BI[name] = _apply(name); }); _.each(["findIndex", "findLastIndex"], function (name) { @@ -69237,7 +69237,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { attributes: { tabIndex: 0 }, - allowEdit: false + allowEdit: false, + allowSearchValue: false }); }, @@ -69317,6 +69318,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { return { el: { type: "bi.multilayer_select_tree_trigger", + allowSearchValue: o.allowSearchValue, allowEdit: o.allowEdit, cls: "multilayer-select-tree-trigger", ref: function (_ref) { @@ -69674,7 +69676,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { this.tree = new BI.Tree(); - this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items)))); + this.tree.initTree(BI.Tree.treeFormat(o.items)); } var content = { type: "bi.htape", @@ -69728,9 +69730,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { onSearch: function (obj, callback) { var keyword = obj.keyword; if(o.itemsCreator === BI.emptyFn) { - var finding = BI.Func.getSearchResult(o.items, keyword); - var matched = finding.match, find = finding.find; - callback(self._fillTreeStructure4Search(find.concat(matched))); + callback(self._getSearchItems(keyword)); } else { callback(); } @@ -69772,27 +69772,59 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _getSearchItems: function(keyword) { + var o = this.options; + var findingText = BI.Func.getSearchResult(o.items, keyword, "text"); + var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []}; + var textItems = findingText.find.concat(findingText.match); + var valueItems = findingValue.find.concat(findingValue.match); + return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + }, + + _createJson: function(node, open) { + return { + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + isParent: BI.isNotEmptyArray(node.children), + open: open + } + }, + + _getChildren: function(node) { + var self = this; + node.children = node.children || []; + var nodes = []; + BI.each(node.children, function (idx, child) { + var children = self._getChildren(child); + nodes = nodes.concat(children); + }); + return node.children.concat(nodes); + }, + // 将搜索到的节点进行补充,构造成一棵完整的树 _fillTreeStructure4Search: function (leaves) { - var result = BI.map(leaves, "id"); - var queue = leaves.reverse() || []; + var self = this; + var result = []; + var queue = []; + BI.each(leaves, function (idx, node) { + queue.push({pId: node.pId}); + result.push(node); + result = result.concat(self._getChildren(node)); + }); while (BI.isNotEmptyArray(queue)) { var node = queue.pop(); var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { - queue.push(pNode); - result.push(pNode.id); + pNode.open = true; + queue.push({pId: pNode.pId}); + result.push(pNode); } } - var nodes = []; - BI.each(this.options.items, function (idx, item) { - if(BI.contains(result, item.id)) { - nodes.push(BI.extend({}, item, { - open: true - })) - } - }); - return nodes; + return BI.uniqBy(BI.map(result, function (idx, node) { + return self._createJson(node, node.open); + }), "id"); }, _digest: function (v) { @@ -70338,6 +70370,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { return { el: { type: "bi.multilayer_single_tree_trigger", + allowSearchValue: o.allowSearchValue, allowEdit: o.allowEdit, cls: "multilayer-single-tree-trigger", ref: function (_ref) { @@ -70686,7 +70719,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { return v; }, itemsCreator: BI.emptyFn, - watermark: BI.i18nText("BI-Basic_Search") + watermark: BI.i18nText("BI-Basic_Search"), + allowSearchValue: false }; }, @@ -70694,7 +70728,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { this.tree = new BI.Tree(); - this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items)))); + this.tree.initTree(BI.Tree.treeFormat(o.items)); } var content = { type: "bi.htape", @@ -70748,9 +70782,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { onSearch: function (obj, callback) { var keyword = obj.keyword; if(o.itemsCreator === BI.emptyFn) { - var finding = BI.Func.getSearchResult(o.items, keyword); - var matched = finding.match, find = finding.find; - callback(self._fillTreeStructure4Search(find.concat(matched))); + callback(self._getSearchItems(keyword)); } else { callback(); } @@ -70792,27 +70824,59 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _getSearchItems: function(keyword) { + var o = this.options; + var findingText = BI.Func.getSearchResult(o.items, keyword, "text"); + var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []}; + var textItems = findingText.find.concat(findingText.match); + var valueItems = findingValue.find.concat(findingValue.match); + return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + }, + + _createJson: function(node, open) { + return { + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + isParent: BI.isNotEmptyArray(node.children), + open: open + } + }, + + _getChildren: function(node) { + var self = this; + node.children = node.children || []; + var nodes = []; + BI.each(node.children, function (idx, child) { + var children = self._getChildren(child); + nodes = nodes.concat(children); + }); + return node.children.concat(nodes); + }, + // 将搜索到的节点进行补充,构造成一棵完整的树 _fillTreeStructure4Search: function (leaves) { - var result = BI.map(leaves, "id"); - var queue = leaves.reverse() || []; + var self = this; + var result = []; + var queue = []; + BI.each(leaves, function (idx, node) { + queue.push({pId: node.pId}); + result.push(node); + result = result.concat(self._getChildren(node)); + }); while (BI.isNotEmptyArray(queue)) { var node = queue.pop(); var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { - queue.push(pNode); - result.push(pNode.id); + pNode.open = true; + queue.push({pId: pNode.pId}); + result.push(pNode); } } - var nodes = []; - BI.each(this.options.items, function (idx, item) { - if(BI.contains(result, item.id)) { - nodes.push(BI.extend({}, item, { - open: true - })) - } - }); - return nodes; + return BI.uniqBy(BI.map(result, function (idx, node) { + return self._createJson(node, node.open); + }), "id"); }, _digest: function (v) { @@ -88481,11 +88545,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, { }, _isMatch: function (parentValues, value, keyword) { + var o = this.options; var node = this._getTreeNode(parentValues, value); if (!node) { return false; } var find = BI.Func.getSearchResult([node.text || node.value], keyword); + if(o.allowSearchValue && node.value) { + var valueFind = BI.Func.getSearchResult([node.value], keyword); + return valueFind.find.length > 0 || valueFind.match.length > 0 || + find.find.length > 0 || find.match.length > 0; + } return find.find.length > 0 || find.match.length > 0; }, diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js index 3975ca4ee..d967eb3a5 100644 --- a/dist/fineui_without_jquery_polyfill.js +++ b/dist/fineui_without_jquery_polyfill.js @@ -22,7 +22,7 @@ if(_global.BI.prepares == null) { }/** * @license * Lodash (Custom Build) - * Build: `lodash core plus="debounce,throttle,get,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"` + * Build: `lodash core plus="debounce,throttle,get,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"` * Copyright JS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 @@ -215,34 +215,34 @@ if(_global.BI.prepares == null) { /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = - typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = - typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = - typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = - typedArrayTags[uint32Tag] = true; + typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = + typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = + typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = + typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = - typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = - typedArrayTags[errorTag] = typedArrayTags[funcTag] = - typedArrayTags[mapTag] = typedArrayTags[numberTag] = - typedArrayTags[objectTag] = typedArrayTags[regexpTag] = - typedArrayTags[setTag] = typedArrayTags[stringTag] = - typedArrayTags[weakMapTag] = false; + typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = + typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = + typedArrayTags[errorTag] = typedArrayTags[funcTag] = + typedArrayTags[mapTag] = typedArrayTags[numberTag] = + typedArrayTags[objectTag] = typedArrayTags[regexpTag] = + typedArrayTags[setTag] = typedArrayTags[stringTag] = + typedArrayTags[weakMapTag] = false; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = - cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = - cloneableTags[boolTag] = cloneableTags[dateTag] = - cloneableTags[float32Tag] = cloneableTags[float64Tag] = - cloneableTags[int8Tag] = cloneableTags[int16Tag] = - cloneableTags[int32Tag] = cloneableTags[mapTag] = - cloneableTags[numberTag] = cloneableTags[objectTag] = - cloneableTags[regexpTag] = cloneableTags[setTag] = - cloneableTags[stringTag] = cloneableTags[symbolTag] = - cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = - cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = + cloneableTags[boolTag] = cloneableTags[dateTag] = + cloneableTags[float32Tag] = cloneableTags[float64Tag] = + cloneableTags[int8Tag] = cloneableTags[int16Tag] = + cloneableTags[int32Tag] = cloneableTags[mapTag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[setTag] = + cloneableTags[stringTag] = cloneableTags[symbolTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = - cloneableTags[weakMapTag] = false; + cloneableTags[weakMapTag] = false; /** Used to map characters to HTML entities. */ var htmlEscapes = { @@ -599,8 +599,8 @@ if(_global.BI.prepares == null) { */ function baseIndexOf(array, value, fromIndex) { return value === value - ? strictIndexOf(array, value, fromIndex) - : baseFindIndex(array, baseIsNaN, fromIndex); + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); } /** @@ -656,8 +656,8 @@ if(_global.BI.prepares == null) { function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { eachFunc(collection, function(value, index, collection) { accumulator = initAccum - ? (initAccum = false, value) - : iteratee(accumulator, value, index, collection); + ? (initAccum = false, value) + : iteratee(accumulator, value, index, collection); }); return accumulator; } @@ -910,8 +910,8 @@ if(_global.BI.prepares == null) { */ function safeGet(object, key) { return key == '__proto__' - ? undefined - : object[key]; + ? undefined + : object[key]; } /** @@ -962,8 +962,8 @@ if(_global.BI.prepares == null) { */ function stringSize(string) { return hasUnicode(string) - ? unicodeSize(string) - : asciiSize(string); + ? unicodeSize(string) + : asciiSize(string); } /** @@ -975,8 +975,8 @@ if(_global.BI.prepares == null) { */ function stringToArray(string) { return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); + ? unicodeToArray(string) + : asciiToArray(string); } /** @@ -1045,8 +1045,8 @@ if(_global.BI.prepares == null) { /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ @@ -1383,30 +1383,30 @@ if(_global.BI.prepares == null) { var result = []; outer: - while (length-- && resIndex < takeCount) { - index += dir; - - var iterIndex = -1, - value = array[index]; - - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], - iteratee = data.iteratee, - type = data.type, - computed = iteratee(value); - - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } - } + while (length-- && resIndex < takeCount) { + index += dir; + + var iterIndex = -1, + value = array[index]; + + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], + iteratee = data.iteratee, + type = data.type, + computed = iteratee(value); + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; } - result[resIndex++] = value; } + } + result[resIndex++] = value; + } return result; } @@ -1914,14 +1914,14 @@ if(_global.BI.prepares == null) { for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) ))) { result.push(key); } @@ -2136,8 +2136,8 @@ if(_global.BI.prepares == null) { result = (isFlat || isFunc) ? {} : initCloneObject(value); if (!isDeep) { return isFlat - ? copySymbolsIn(value, baseAssignIn(result, value)) - : copySymbols(value, baseAssign(result, value)); + ? copySymbolsIn(value, baseAssignIn(result, value)) + : copySymbols(value, baseAssign(result, value)); } } else { if (!cloneableTags[tag]) { @@ -2171,8 +2171,8 @@ if(_global.BI.prepares == null) { } var keysFunc = isFull - ? (isFlat ? getAllKeysIn : getAllKeys) - : (isFlat ? keysIn : keys); + ? (isFlat ? getAllKeysIn : getAllKeys) + : (isFlat ? keysIn : keys); var props = isArr ? undefined : keysFunc(value); arrayEach(props || value, function(subValue, key) { @@ -2238,24 +2238,24 @@ if(_global.BI.prepares == null) { values = new SetCache(values); } outer: - while (++index < length) { - var value = array[index], - computed = iteratee == null ? value : iteratee(value); - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee == null ? value : iteratee(value); + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === computed) { + continue outer; } } + result.push(value); + } + else if (!includes(values, computed, comparator)) { + result.push(value); + } + } return result; } @@ -2306,9 +2306,9 @@ if(_global.BI.prepares == null) { current = iteratee(value); if (current != null && (computed === undefined - ? (current === current && !isSymbol(current)) - : comparator(current, computed) - )) { + ? (current === current && !isSymbol(current)) + : comparator(current, computed) + )) { var computed = current, result = value; } @@ -2480,8 +2480,8 @@ if(_global.BI.prepares == null) { return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); + ? getRawTag(value) + : objectToString(value); } /** @@ -2547,8 +2547,8 @@ if(_global.BI.prepares == null) { } maxLength = nativeMin(array.length, maxLength); caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) - ? new SetCache(othIndex && array) - : undefined; + ? new SetCache(othIndex && array) + : undefined; } array = arrays[0]; @@ -2556,31 +2556,31 @@ if(_global.BI.prepares == null) { seen = caches[0]; outer: - while (++index < length && result.length < maxLength) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (!(seen - ? cacheHas(seen, computed) - : includes(result, computed, comparator) + while (++index < length && result.length < maxLength) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (!(seen + ? cacheHas(seen, computed) + : includes(result, computed, comparator) )) { - othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache - ? cacheHas(cache, computed) - : includes(arrays[othIndex], computed, comparator)) + othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if (!(cache + ? cacheHas(cache, computed) + : includes(arrays[othIndex], computed, comparator)) ) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result.push(value); + continue outer; } } + if (seen) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -2702,8 +2702,8 @@ if(_global.BI.prepares == null) { if (isSameTag && !objIsObj) { stack || (stack = new Stack); return (objIsArr || isTypedArray(object)) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), @@ -2757,9 +2757,9 @@ if(_global.BI.prepares == null) { while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { return false; } } @@ -2779,9 +2779,9 @@ if(_global.BI.prepares == null) { var result = customizer(objValue, srcValue, key, object, source, stack); } if (!(result === undefined - ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) - : result - )) { + ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) + : result + )) { return false; } } @@ -2836,7 +2836,7 @@ if(_global.BI.prepares == null) { */ function baseIsTypedArray(value) { return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } /** @@ -2857,8 +2857,8 @@ if(_global.BI.prepares == null) { } if (typeof value == 'object') { return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); } return property(value); } @@ -2968,8 +2968,8 @@ if(_global.BI.prepares == null) { return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } @@ -2995,8 +2995,8 @@ if(_global.BI.prepares == null) { } else { var newValue = customizer - ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) + : undefined; if (newValue === undefined) { newValue = srcValue; @@ -3031,8 +3031,8 @@ if(_global.BI.prepares == null) { return; } var newValue = customizer - ? customizer(objValue, srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; var isCommon = newValue === undefined; @@ -3239,8 +3239,8 @@ if(_global.BI.prepares == null) { newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { newValue = isObject(objValue) - ? objValue - : (isIndex(path[index + 1]) ? [] : {}); + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); } } assignValue(nested, key, newValue); @@ -3386,30 +3386,30 @@ if(_global.BI.prepares == null) { seen = iteratee ? [] : result; } outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; } } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -3783,8 +3783,8 @@ if(_global.BI.prepares == null) { var key = props[index]; var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; + ? customizer(object[key], source[key], key, object, source) + : undefined; if (newValue === undefined) { newValue = source[key]; @@ -3854,8 +3854,8 @@ if(_global.BI.prepares == null) { guard = length > 2 ? sources[2] : undefined; customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; + ? (length--, customizer) + : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; @@ -4001,14 +4001,14 @@ if(_global.BI.prepares == null) { args[index] = arguments[index]; } var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) - ? [] - : replaceHolders(args, placeholder); + ? [] + : replaceHolders(args, placeholder); length -= holders.length; if (length < arity) { return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, undefined, - args, holders, undefined, undefined, arity - length); + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); } var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return apply(fn, this, args); @@ -4085,8 +4085,8 @@ if(_global.BI.prepares == null) { if (isCurried && length < arity) { var newHolders = replaceHolders(args, placeholder); return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, thisArg, - args, newHolders, argPos, ary, arity - length + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length ); } var thisBinding = isBind ? thisArg : this, @@ -4298,8 +4298,8 @@ if(_global.BI.prepares == null) { partials = newData[3]; holders = newData[4]; arity = newData[9] = newData[9] === undefined - ? (isBindKey ? 0 : func.length) - : nativeMax(newData[9] - length, 0); + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); @@ -4394,8 +4394,8 @@ if(_global.BI.prepares == null) { if (customizer) { var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { @@ -4407,18 +4407,18 @@ if(_global.BI.prepares == null) { // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { - if (!cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { + if (!cacheHas(seen, othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { result = false; break; } } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, bitmask, customizer, stack) - )) { + arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack) + )) { result = false; break; } @@ -4557,14 +4557,14 @@ if(_global.BI.prepares == null) { if (customizer) { var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) - : compared - )) { + ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) + : compared + )) { result = false; break; } @@ -4578,7 +4578,7 @@ if(_global.BI.prepares == null) { if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { + typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } @@ -4677,8 +4677,8 @@ if(_global.BI.prepares == null) { function getMapData(map, key) { var data = map.__data__; return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; } /** @@ -4875,7 +4875,7 @@ if(_global.BI.prepares == null) { } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && - (isArray(object) || isArguments(object)); + (isArray(object) || isArguments(object)); } /** @@ -4906,8 +4906,8 @@ if(_global.BI.prepares == null) { */ function initCloneObject(object) { return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; + ? baseCreate(getPrototype(object)) + : {}; } /** @@ -4986,7 +4986,7 @@ if(_global.BI.prepares == null) { */ function isFlattenable(value) { return isArray(value) || isArguments(value) || - !!(spreadableSymbol && value && value[spreadableSymbol]); + !!(spreadableSymbol && value && value[spreadableSymbol]); } /** @@ -5002,9 +5002,9 @@ if(_global.BI.prepares == null) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); } /** @@ -5023,9 +5023,9 @@ if(_global.BI.prepares == null) { } var type = typeof index; if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { return eq(object[index], value); } return false; @@ -5049,7 +5049,7 @@ if(_global.BI.prepares == null) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object)); + (object != null && value in Object(object)); } /** @@ -5062,8 +5062,8 @@ if(_global.BI.prepares == null) { function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); + ? (value !== '__proto__') + : (value === null); } /** @@ -5140,7 +5140,7 @@ if(_global.BI.prepares == null) { return false; } return object[key] === srcValue && - (srcValue !== undefined || (key in Object(object))); + (srcValue !== undefined || (key in Object(object))); }; } @@ -5187,9 +5187,9 @@ if(_global.BI.prepares == null) { isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); var isCombo = - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || - ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || + ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); // Exit early if metadata can't be merged. if (!(isCommon || isCombo)) { @@ -5579,8 +5579,8 @@ if(_global.BI.prepares == null) { */ var difference = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) - : []; + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) + : []; }); /** @@ -5708,8 +5708,8 @@ if(_global.BI.prepares == null) { if (fromIndex !== undefined) { index = toInteger(fromIndex); index = fromIndex < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1); + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1); } return baseFindIndex(array, baseIteratee(predicate, 3), index, true); } @@ -5848,8 +5848,8 @@ if(_global.BI.prepares == null) { var intersection = baseRest(function(arrays) { var mapped = arrayMap(arrays, castArrayLikeObject); return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped) - : []; + ? baseIntersection(mapped) + : []; }); /** @@ -6124,8 +6124,8 @@ if(_global.BI.prepares == null) { */ var without = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, values) - : []; + ? baseDifference(array, values) + : []; }); /** @@ -7195,8 +7195,8 @@ if(_global.BI.prepares == null) { timeWaiting = wait - timeSinceLastCall; return maxing - ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) - : timeWaiting; + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; } function shouldInvoke(time) { @@ -7207,7 +7207,7 @@ if(_global.BI.prepares == null) { // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { @@ -7646,7 +7646,7 @@ if(_global.BI.prepares == null) { */ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); + !propertyIsEnumerable.call(value, 'callee'); }; /** @@ -7751,7 +7751,7 @@ if(_global.BI.prepares == null) { */ function isBoolean(value) { return value === true || value === false || - (isObjectLike(value) && baseGetTag(value) == boolTag); + (isObjectLike(value) && baseGetTag(value) == boolTag); } /** @@ -7831,7 +7831,7 @@ if(_global.BI.prepares == null) { } if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || - isBuffer(value) || isTypedArray(value) || isArguments(value))) { + isBuffer(value) || isTypedArray(value) || isArguments(value))) { return !value.length; } var tag = getTag(value); @@ -7966,7 +7966,7 @@ if(_global.BI.prepares == null) { */ function isLength(value) { return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -8130,7 +8130,7 @@ if(_global.BI.prepares == null) { */ function isNumber(value) { return typeof value == 'number' || - (isObjectLike(value) && baseGetTag(value) == numberTag); + (isObjectLike(value) && baseGetTag(value) == numberTag); } /** @@ -8171,7 +8171,7 @@ if(_global.BI.prepares == null) { } var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && - funcToString.call(Ctor) == objectCtorString; + funcToString.call(Ctor) == objectCtorString; } /** @@ -8231,7 +8231,7 @@ if(_global.BI.prepares == null) { */ function isString(value) { return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); } /** @@ -8253,7 +8253,7 @@ if(_global.BI.prepares == null) { */ function isSymbol(value) { return typeof value == 'symbol' || - (isObjectLike(value) && baseGetTag(value) == symbolTag); + (isObjectLike(value) && baseGetTag(value) == symbolTag); } /** @@ -8443,8 +8443,8 @@ if(_global.BI.prepares == null) { value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); } /** @@ -9355,8 +9355,8 @@ if(_global.BI.prepares == null) { function escape(string) { string = toString(string); return (string && reHasUnescapedHtml.test(string)) - ? string.replace(reUnescapedHtml, escapeHtmlChar) - : string; + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; } /** @@ -9782,8 +9782,8 @@ if(_global.BI.prepares == null) { */ function max(array) { return (array && array.length) - ? baseExtremum(array, identity, baseGt) - : undefined; + ? baseExtremum(array, identity, baseGt) + : undefined; } /** @@ -9806,8 +9806,8 @@ if(_global.BI.prepares == null) { */ function min(array) { return (array && array.length) - ? baseExtremum(array, identity, baseLt) - : undefined; + ? baseExtremum(array, identity, baseLt) + : undefined; } /*------------------------------------------------------------------------*/ @@ -9953,8 +9953,8 @@ if(_global.BI.prepares == null) { n = n === undefined ? 1 : nativeMax(toInteger(n), 0); var result = (this.__filtered__ && !index) - ? new LazyWrapper(this) - : this.clone(); + ? new LazyWrapper(this) + : this.clone(); if (result.__filtered__) { result.__takeCount__ = nativeMin(n, result.__takeCount__); @@ -10538,7 +10538,7 @@ if (!_global.BI) { // 数组相关的方法 _.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection", - "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) { + "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) { BI[name] = _apply(name); }); _.each(["findIndex", "findLastIndex"], function (name) { @@ -51539,7 +51539,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { attributes: { tabIndex: 0 }, - allowEdit: false + allowEdit: false, + allowSearchValue: false }); }, @@ -51619,6 +51620,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { return { el: { type: "bi.multilayer_select_tree_trigger", + allowSearchValue: o.allowSearchValue, allowEdit: o.allowEdit, cls: "multilayer-select-tree-trigger", ref: function (_ref) { @@ -51976,7 +51978,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { this.tree = new BI.Tree(); - this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items)))); + this.tree.initTree(BI.Tree.treeFormat(o.items)); } var content = { type: "bi.htape", @@ -52030,9 +52032,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { onSearch: function (obj, callback) { var keyword = obj.keyword; if(o.itemsCreator === BI.emptyFn) { - var finding = BI.Func.getSearchResult(o.items, keyword); - var matched = finding.match, find = finding.find; - callback(self._fillTreeStructure4Search(find.concat(matched))); + callback(self._getSearchItems(keyword)); } else { callback(); } @@ -52074,27 +52074,59 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _getSearchItems: function(keyword) { + var o = this.options; + var findingText = BI.Func.getSearchResult(o.items, keyword, "text"); + var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []}; + var textItems = findingText.find.concat(findingText.match); + var valueItems = findingValue.find.concat(findingValue.match); + return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + }, + + _createJson: function(node, open) { + return { + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + isParent: BI.isNotEmptyArray(node.children), + open: open + } + }, + + _getChildren: function(node) { + var self = this; + node.children = node.children || []; + var nodes = []; + BI.each(node.children, function (idx, child) { + var children = self._getChildren(child); + nodes = nodes.concat(children); + }); + return node.children.concat(nodes); + }, + // 将搜索到的节点进行补充,构造成一棵完整的树 _fillTreeStructure4Search: function (leaves) { - var result = BI.map(leaves, "id"); - var queue = leaves.reverse() || []; + var self = this; + var result = []; + var queue = []; + BI.each(leaves, function (idx, node) { + queue.push({pId: node.pId}); + result.push(node); + result = result.concat(self._getChildren(node)); + }); while (BI.isNotEmptyArray(queue)) { var node = queue.pop(); var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { - queue.push(pNode); - result.push(pNode.id); + pNode.open = true; + queue.push({pId: pNode.pId}); + result.push(pNode); } } - var nodes = []; - BI.each(this.options.items, function (idx, item) { - if(BI.contains(result, item.id)) { - nodes.push(BI.extend({}, item, { - open: true - })) - } - }); - return nodes; + return BI.uniqBy(BI.map(result, function (idx, node) { + return self._createJson(node, node.open); + }), "id"); }, _digest: function (v) { @@ -52640,6 +52672,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { return { el: { type: "bi.multilayer_single_tree_trigger", + allowSearchValue: o.allowSearchValue, allowEdit: o.allowEdit, cls: "multilayer-single-tree-trigger", ref: function (_ref) { @@ -52988,7 +53021,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { return v; }, itemsCreator: BI.emptyFn, - watermark: BI.i18nText("BI-Basic_Search") + watermark: BI.i18nText("BI-Basic_Search"), + allowSearchValue: false }; }, @@ -52996,7 +53030,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { this.tree = new BI.Tree(); - this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items)))); + this.tree.initTree(BI.Tree.treeFormat(o.items)); } var content = { type: "bi.htape", @@ -53050,9 +53084,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { onSearch: function (obj, callback) { var keyword = obj.keyword; if(o.itemsCreator === BI.emptyFn) { - var finding = BI.Func.getSearchResult(o.items, keyword); - var matched = finding.match, find = finding.find; - callback(self._fillTreeStructure4Search(find.concat(matched))); + callback(self._getSearchItems(keyword)); } else { callback(); } @@ -53094,27 +53126,59 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _getSearchItems: function(keyword) { + var o = this.options; + var findingText = BI.Func.getSearchResult(o.items, keyword, "text"); + var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []}; + var textItems = findingText.find.concat(findingText.match); + var valueItems = findingValue.find.concat(findingValue.match); + return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + }, + + _createJson: function(node, open) { + return { + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + isParent: BI.isNotEmptyArray(node.children), + open: open + } + }, + + _getChildren: function(node) { + var self = this; + node.children = node.children || []; + var nodes = []; + BI.each(node.children, function (idx, child) { + var children = self._getChildren(child); + nodes = nodes.concat(children); + }); + return node.children.concat(nodes); + }, + // 将搜索到的节点进行补充,构造成一棵完整的树 _fillTreeStructure4Search: function (leaves) { - var result = BI.map(leaves, "id"); - var queue = leaves.reverse() || []; + var self = this; + var result = []; + var queue = []; + BI.each(leaves, function (idx, node) { + queue.push({pId: node.pId}); + result.push(node); + result = result.concat(self._getChildren(node)); + }); while (BI.isNotEmptyArray(queue)) { var node = queue.pop(); var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { - queue.push(pNode); - result.push(pNode.id); + pNode.open = true; + queue.push({pId: pNode.pId}); + result.push(pNode); } } - var nodes = []; - BI.each(this.options.items, function (idx, item) { - if(BI.contains(result, item.id)) { - nodes.push(BI.extend({}, item, { - open: true - })) - } - }); - return nodes; + return BI.uniqBy(BI.map(result, function (idx, node) { + return self._createJson(node, node.open); + }), "id"); }, _digest: function (v) { @@ -70783,11 +70847,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, { }, _isMatch: function (parentValues, value, keyword) { + var o = this.options; var node = this._getTreeNode(parentValues, value); if (!node) { return false; } var find = BI.Func.getSearchResult([node.text || node.value], keyword); + if(o.allowSearchValue && node.value) { + var valueFind = BI.Func.getSearchResult([node.value], keyword); + return valueFind.find.length > 0 || valueFind.match.length > 0 || + find.find.length > 0 || find.match.length > 0; + } return find.find.length > 0 || find.match.length > 0; }, diff --git a/dist/utils.js b/dist/utils.js index 3091e8cca..45d261a02 100644 --- a/dist/utils.js +++ b/dist/utils.js @@ -22,7 +22,7 @@ if(_global.BI.prepares == null) { }/** * @license * Lodash (Custom Build) - * Build: `lodash core plus="debounce,throttle,get,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"` + * Build: `lodash core plus="debounce,throttle,get,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"` * Copyright JS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 @@ -215,34 +215,34 @@ if(_global.BI.prepares == null) { /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = - typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = - typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = - typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = - typedArrayTags[uint32Tag] = true; + typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = + typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = + typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = + typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = - typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = - typedArrayTags[errorTag] = typedArrayTags[funcTag] = - typedArrayTags[mapTag] = typedArrayTags[numberTag] = - typedArrayTags[objectTag] = typedArrayTags[regexpTag] = - typedArrayTags[setTag] = typedArrayTags[stringTag] = - typedArrayTags[weakMapTag] = false; + typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = + typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = + typedArrayTags[errorTag] = typedArrayTags[funcTag] = + typedArrayTags[mapTag] = typedArrayTags[numberTag] = + typedArrayTags[objectTag] = typedArrayTags[regexpTag] = + typedArrayTags[setTag] = typedArrayTags[stringTag] = + typedArrayTags[weakMapTag] = false; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = - cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = - cloneableTags[boolTag] = cloneableTags[dateTag] = - cloneableTags[float32Tag] = cloneableTags[float64Tag] = - cloneableTags[int8Tag] = cloneableTags[int16Tag] = - cloneableTags[int32Tag] = cloneableTags[mapTag] = - cloneableTags[numberTag] = cloneableTags[objectTag] = - cloneableTags[regexpTag] = cloneableTags[setTag] = - cloneableTags[stringTag] = cloneableTags[symbolTag] = - cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = - cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = + cloneableTags[boolTag] = cloneableTags[dateTag] = + cloneableTags[float32Tag] = cloneableTags[float64Tag] = + cloneableTags[int8Tag] = cloneableTags[int16Tag] = + cloneableTags[int32Tag] = cloneableTags[mapTag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[setTag] = + cloneableTags[stringTag] = cloneableTags[symbolTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = - cloneableTags[weakMapTag] = false; + cloneableTags[weakMapTag] = false; /** Used to map characters to HTML entities. */ var htmlEscapes = { @@ -599,8 +599,8 @@ if(_global.BI.prepares == null) { */ function baseIndexOf(array, value, fromIndex) { return value === value - ? strictIndexOf(array, value, fromIndex) - : baseFindIndex(array, baseIsNaN, fromIndex); + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); } /** @@ -656,8 +656,8 @@ if(_global.BI.prepares == null) { function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { eachFunc(collection, function(value, index, collection) { accumulator = initAccum - ? (initAccum = false, value) - : iteratee(accumulator, value, index, collection); + ? (initAccum = false, value) + : iteratee(accumulator, value, index, collection); }); return accumulator; } @@ -910,8 +910,8 @@ if(_global.BI.prepares == null) { */ function safeGet(object, key) { return key == '__proto__' - ? undefined - : object[key]; + ? undefined + : object[key]; } /** @@ -962,8 +962,8 @@ if(_global.BI.prepares == null) { */ function stringSize(string) { return hasUnicode(string) - ? unicodeSize(string) - : asciiSize(string); + ? unicodeSize(string) + : asciiSize(string); } /** @@ -975,8 +975,8 @@ if(_global.BI.prepares == null) { */ function stringToArray(string) { return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); + ? unicodeToArray(string) + : asciiToArray(string); } /** @@ -1045,8 +1045,8 @@ if(_global.BI.prepares == null) { /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ @@ -1383,30 +1383,30 @@ if(_global.BI.prepares == null) { var result = []; outer: - while (length-- && resIndex < takeCount) { - index += dir; - - var iterIndex = -1, - value = array[index]; - - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], - iteratee = data.iteratee, - type = data.type, - computed = iteratee(value); - - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } - } + while (length-- && resIndex < takeCount) { + index += dir; + + var iterIndex = -1, + value = array[index]; + + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], + iteratee = data.iteratee, + type = data.type, + computed = iteratee(value); + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; } - result[resIndex++] = value; } + } + result[resIndex++] = value; + } return result; } @@ -1914,14 +1914,14 @@ if(_global.BI.prepares == null) { for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) ))) { result.push(key); } @@ -2136,8 +2136,8 @@ if(_global.BI.prepares == null) { result = (isFlat || isFunc) ? {} : initCloneObject(value); if (!isDeep) { return isFlat - ? copySymbolsIn(value, baseAssignIn(result, value)) - : copySymbols(value, baseAssign(result, value)); + ? copySymbolsIn(value, baseAssignIn(result, value)) + : copySymbols(value, baseAssign(result, value)); } } else { if (!cloneableTags[tag]) { @@ -2171,8 +2171,8 @@ if(_global.BI.prepares == null) { } var keysFunc = isFull - ? (isFlat ? getAllKeysIn : getAllKeys) - : (isFlat ? keysIn : keys); + ? (isFlat ? getAllKeysIn : getAllKeys) + : (isFlat ? keysIn : keys); var props = isArr ? undefined : keysFunc(value); arrayEach(props || value, function(subValue, key) { @@ -2238,24 +2238,24 @@ if(_global.BI.prepares == null) { values = new SetCache(values); } outer: - while (++index < length) { - var value = array[index], - computed = iteratee == null ? value : iteratee(value); - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee == null ? value : iteratee(value); + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === computed) { + continue outer; } } + result.push(value); + } + else if (!includes(values, computed, comparator)) { + result.push(value); + } + } return result; } @@ -2306,9 +2306,9 @@ if(_global.BI.prepares == null) { current = iteratee(value); if (current != null && (computed === undefined - ? (current === current && !isSymbol(current)) - : comparator(current, computed) - )) { + ? (current === current && !isSymbol(current)) + : comparator(current, computed) + )) { var computed = current, result = value; } @@ -2480,8 +2480,8 @@ if(_global.BI.prepares == null) { return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); + ? getRawTag(value) + : objectToString(value); } /** @@ -2547,8 +2547,8 @@ if(_global.BI.prepares == null) { } maxLength = nativeMin(array.length, maxLength); caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) - ? new SetCache(othIndex && array) - : undefined; + ? new SetCache(othIndex && array) + : undefined; } array = arrays[0]; @@ -2556,31 +2556,31 @@ if(_global.BI.prepares == null) { seen = caches[0]; outer: - while (++index < length && result.length < maxLength) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (!(seen - ? cacheHas(seen, computed) - : includes(result, computed, comparator) + while (++index < length && result.length < maxLength) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (!(seen + ? cacheHas(seen, computed) + : includes(result, computed, comparator) )) { - othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache - ? cacheHas(cache, computed) - : includes(arrays[othIndex], computed, comparator)) + othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if (!(cache + ? cacheHas(cache, computed) + : includes(arrays[othIndex], computed, comparator)) ) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result.push(value); + continue outer; } } + if (seen) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -2702,8 +2702,8 @@ if(_global.BI.prepares == null) { if (isSameTag && !objIsObj) { stack || (stack = new Stack); return (objIsArr || isTypedArray(object)) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), @@ -2757,9 +2757,9 @@ if(_global.BI.prepares == null) { while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { return false; } } @@ -2779,9 +2779,9 @@ if(_global.BI.prepares == null) { var result = customizer(objValue, srcValue, key, object, source, stack); } if (!(result === undefined - ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) - : result - )) { + ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) + : result + )) { return false; } } @@ -2836,7 +2836,7 @@ if(_global.BI.prepares == null) { */ function baseIsTypedArray(value) { return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } /** @@ -2857,8 +2857,8 @@ if(_global.BI.prepares == null) { } if (typeof value == 'object') { return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); } return property(value); } @@ -2968,8 +2968,8 @@ if(_global.BI.prepares == null) { return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } @@ -2995,8 +2995,8 @@ if(_global.BI.prepares == null) { } else { var newValue = customizer - ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) + : undefined; if (newValue === undefined) { newValue = srcValue; @@ -3031,8 +3031,8 @@ if(_global.BI.prepares == null) { return; } var newValue = customizer - ? customizer(objValue, srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; var isCommon = newValue === undefined; @@ -3239,8 +3239,8 @@ if(_global.BI.prepares == null) { newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { newValue = isObject(objValue) - ? objValue - : (isIndex(path[index + 1]) ? [] : {}); + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); } } assignValue(nested, key, newValue); @@ -3386,30 +3386,30 @@ if(_global.BI.prepares == null) { seen = iteratee ? [] : result; } outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; } } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -3783,8 +3783,8 @@ if(_global.BI.prepares == null) { var key = props[index]; var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; + ? customizer(object[key], source[key], key, object, source) + : undefined; if (newValue === undefined) { newValue = source[key]; @@ -3854,8 +3854,8 @@ if(_global.BI.prepares == null) { guard = length > 2 ? sources[2] : undefined; customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; + ? (length--, customizer) + : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; @@ -4001,14 +4001,14 @@ if(_global.BI.prepares == null) { args[index] = arguments[index]; } var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) - ? [] - : replaceHolders(args, placeholder); + ? [] + : replaceHolders(args, placeholder); length -= holders.length; if (length < arity) { return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, undefined, - args, holders, undefined, undefined, arity - length); + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); } var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return apply(fn, this, args); @@ -4085,8 +4085,8 @@ if(_global.BI.prepares == null) { if (isCurried && length < arity) { var newHolders = replaceHolders(args, placeholder); return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, thisArg, - args, newHolders, argPos, ary, arity - length + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length ); } var thisBinding = isBind ? thisArg : this, @@ -4298,8 +4298,8 @@ if(_global.BI.prepares == null) { partials = newData[3]; holders = newData[4]; arity = newData[9] = newData[9] === undefined - ? (isBindKey ? 0 : func.length) - : nativeMax(newData[9] - length, 0); + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); @@ -4394,8 +4394,8 @@ if(_global.BI.prepares == null) { if (customizer) { var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { @@ -4407,18 +4407,18 @@ if(_global.BI.prepares == null) { // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { - if (!cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { + if (!cacheHas(seen, othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { result = false; break; } } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, bitmask, customizer, stack) - )) { + arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack) + )) { result = false; break; } @@ -4557,14 +4557,14 @@ if(_global.BI.prepares == null) { if (customizer) { var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) - : compared - )) { + ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) + : compared + )) { result = false; break; } @@ -4578,7 +4578,7 @@ if(_global.BI.prepares == null) { if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { + typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } @@ -4677,8 +4677,8 @@ if(_global.BI.prepares == null) { function getMapData(map, key) { var data = map.__data__; return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; } /** @@ -4875,7 +4875,7 @@ if(_global.BI.prepares == null) { } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && - (isArray(object) || isArguments(object)); + (isArray(object) || isArguments(object)); } /** @@ -4906,8 +4906,8 @@ if(_global.BI.prepares == null) { */ function initCloneObject(object) { return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; + ? baseCreate(getPrototype(object)) + : {}; } /** @@ -4986,7 +4986,7 @@ if(_global.BI.prepares == null) { */ function isFlattenable(value) { return isArray(value) || isArguments(value) || - !!(spreadableSymbol && value && value[spreadableSymbol]); + !!(spreadableSymbol && value && value[spreadableSymbol]); } /** @@ -5002,9 +5002,9 @@ if(_global.BI.prepares == null) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); } /** @@ -5023,9 +5023,9 @@ if(_global.BI.prepares == null) { } var type = typeof index; if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { return eq(object[index], value); } return false; @@ -5049,7 +5049,7 @@ if(_global.BI.prepares == null) { return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object)); + (object != null && value in Object(object)); } /** @@ -5062,8 +5062,8 @@ if(_global.BI.prepares == null) { function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); + ? (value !== '__proto__') + : (value === null); } /** @@ -5140,7 +5140,7 @@ if(_global.BI.prepares == null) { return false; } return object[key] === srcValue && - (srcValue !== undefined || (key in Object(object))); + (srcValue !== undefined || (key in Object(object))); }; } @@ -5187,9 +5187,9 @@ if(_global.BI.prepares == null) { isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); var isCombo = - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || - ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || + ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); // Exit early if metadata can't be merged. if (!(isCommon || isCombo)) { @@ -5579,8 +5579,8 @@ if(_global.BI.prepares == null) { */ var difference = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) - : []; + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) + : []; }); /** @@ -5708,8 +5708,8 @@ if(_global.BI.prepares == null) { if (fromIndex !== undefined) { index = toInteger(fromIndex); index = fromIndex < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1); + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1); } return baseFindIndex(array, baseIteratee(predicate, 3), index, true); } @@ -5848,8 +5848,8 @@ if(_global.BI.prepares == null) { var intersection = baseRest(function(arrays) { var mapped = arrayMap(arrays, castArrayLikeObject); return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped) - : []; + ? baseIntersection(mapped) + : []; }); /** @@ -6124,8 +6124,8 @@ if(_global.BI.prepares == null) { */ var without = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, values) - : []; + ? baseDifference(array, values) + : []; }); /** @@ -7195,8 +7195,8 @@ if(_global.BI.prepares == null) { timeWaiting = wait - timeSinceLastCall; return maxing - ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) - : timeWaiting; + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; } function shouldInvoke(time) { @@ -7207,7 +7207,7 @@ if(_global.BI.prepares == null) { // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { @@ -7646,7 +7646,7 @@ if(_global.BI.prepares == null) { */ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); + !propertyIsEnumerable.call(value, 'callee'); }; /** @@ -7751,7 +7751,7 @@ if(_global.BI.prepares == null) { */ function isBoolean(value) { return value === true || value === false || - (isObjectLike(value) && baseGetTag(value) == boolTag); + (isObjectLike(value) && baseGetTag(value) == boolTag); } /** @@ -7831,7 +7831,7 @@ if(_global.BI.prepares == null) { } if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || - isBuffer(value) || isTypedArray(value) || isArguments(value))) { + isBuffer(value) || isTypedArray(value) || isArguments(value))) { return !value.length; } var tag = getTag(value); @@ -7966,7 +7966,7 @@ if(_global.BI.prepares == null) { */ function isLength(value) { return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -8130,7 +8130,7 @@ if(_global.BI.prepares == null) { */ function isNumber(value) { return typeof value == 'number' || - (isObjectLike(value) && baseGetTag(value) == numberTag); + (isObjectLike(value) && baseGetTag(value) == numberTag); } /** @@ -8171,7 +8171,7 @@ if(_global.BI.prepares == null) { } var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && - funcToString.call(Ctor) == objectCtorString; + funcToString.call(Ctor) == objectCtorString; } /** @@ -8231,7 +8231,7 @@ if(_global.BI.prepares == null) { */ function isString(value) { return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); } /** @@ -8253,7 +8253,7 @@ if(_global.BI.prepares == null) { */ function isSymbol(value) { return typeof value == 'symbol' || - (isObjectLike(value) && baseGetTag(value) == symbolTag); + (isObjectLike(value) && baseGetTag(value) == symbolTag); } /** @@ -8443,8 +8443,8 @@ if(_global.BI.prepares == null) { value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); } /** @@ -9355,8 +9355,8 @@ if(_global.BI.prepares == null) { function escape(string) { string = toString(string); return (string && reHasUnescapedHtml.test(string)) - ? string.replace(reUnescapedHtml, escapeHtmlChar) - : string; + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; } /** @@ -9782,8 +9782,8 @@ if(_global.BI.prepares == null) { */ function max(array) { return (array && array.length) - ? baseExtremum(array, identity, baseGt) - : undefined; + ? baseExtremum(array, identity, baseGt) + : undefined; } /** @@ -9806,8 +9806,8 @@ if(_global.BI.prepares == null) { */ function min(array) { return (array && array.length) - ? baseExtremum(array, identity, baseLt) - : undefined; + ? baseExtremum(array, identity, baseLt) + : undefined; } /*------------------------------------------------------------------------*/ @@ -9953,8 +9953,8 @@ if(_global.BI.prepares == null) { n = n === undefined ? 1 : nativeMax(toInteger(n), 0); var result = (this.__filtered__ && !index) - ? new LazyWrapper(this) - : this.clone(); + ? new LazyWrapper(this) + : this.clone(); if (result.__filtered__) { result.__takeCount__ = nativeMin(n, result.__takeCount__); @@ -11317,7 +11317,7 @@ if (!_global.BI) { // 数组相关的方法 _.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection", - "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) { + "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) { BI[name] = _apply(name); }); _.each(["findIndex", "findLastIndex"], function (name) { diff --git a/dist/widget.js b/dist/widget.js index 85c8aca7f..af724dc8f 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -6653,7 +6653,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { attributes: { tabIndex: 0 }, - allowEdit: false + allowEdit: false, + allowSearchValue: false }); }, @@ -6733,6 +6734,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { return { el: { type: "bi.multilayer_select_tree_trigger", + allowSearchValue: o.allowSearchValue, allowEdit: o.allowEdit, cls: "multilayer-select-tree-trigger", ref: function (_ref) { @@ -7090,7 +7092,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { this.tree = new BI.Tree(); - this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items)))); + this.tree.initTree(BI.Tree.treeFormat(o.items)); } var content = { type: "bi.htape", @@ -7144,9 +7146,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { onSearch: function (obj, callback) { var keyword = obj.keyword; if(o.itemsCreator === BI.emptyFn) { - var finding = BI.Func.getSearchResult(o.items, keyword); - var matched = finding.match, find = finding.find; - callback(self._fillTreeStructure4Search(find.concat(matched))); + callback(self._getSearchItems(keyword)); } else { callback(); } @@ -7188,27 +7188,59 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _getSearchItems: function(keyword) { + var o = this.options; + var findingText = BI.Func.getSearchResult(o.items, keyword, "text"); + var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []}; + var textItems = findingText.find.concat(findingText.match); + var valueItems = findingValue.find.concat(findingValue.match); + return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + }, + + _createJson: function(node, open) { + return { + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + isParent: BI.isNotEmptyArray(node.children), + open: open + } + }, + + _getChildren: function(node) { + var self = this; + node.children = node.children || []; + var nodes = []; + BI.each(node.children, function (idx, child) { + var children = self._getChildren(child); + nodes = nodes.concat(children); + }); + return node.children.concat(nodes); + }, + // 将搜索到的节点进行补充,构造成一棵完整的树 _fillTreeStructure4Search: function (leaves) { - var result = BI.map(leaves, "id"); - var queue = leaves.reverse() || []; + var self = this; + var result = []; + var queue = []; + BI.each(leaves, function (idx, node) { + queue.push({pId: node.pId}); + result.push(node); + result = result.concat(self._getChildren(node)); + }); while (BI.isNotEmptyArray(queue)) { var node = queue.pop(); var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { - queue.push(pNode); - result.push(pNode.id); + pNode.open = true; + queue.push({pId: pNode.pId}); + result.push(pNode); } } - var nodes = []; - BI.each(this.options.items, function (idx, item) { - if(BI.contains(result, item.id)) { - nodes.push(BI.extend({}, item, { - open: true - })) - } - }); - return nodes; + return BI.uniqBy(BI.map(result, function (idx, node) { + return self._createJson(node, node.open); + }), "id"); }, _digest: function (v) { @@ -7754,6 +7786,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { return { el: { type: "bi.multilayer_single_tree_trigger", + allowSearchValue: o.allowSearchValue, allowEdit: o.allowEdit, cls: "multilayer-single-tree-trigger", ref: function (_ref) { @@ -8102,7 +8135,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { return v; }, itemsCreator: BI.emptyFn, - watermark: BI.i18nText("BI-Basic_Search") + watermark: BI.i18nText("BI-Basic_Search"), + allowSearchValue: false }; }, @@ -8110,7 +8144,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { this.tree = new BI.Tree(); - this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items)))); + this.tree.initTree(BI.Tree.treeFormat(o.items)); } var content = { type: "bi.htape", @@ -8164,9 +8198,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { onSearch: function (obj, callback) { var keyword = obj.keyword; if(o.itemsCreator === BI.emptyFn) { - var finding = BI.Func.getSearchResult(o.items, keyword); - var matched = finding.match, find = finding.find; - callback(self._fillTreeStructure4Search(find.concat(matched))); + callback(self._getSearchItems(keyword)); } else { callback(); } @@ -8208,27 +8240,59 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _getSearchItems: function(keyword) { + var o = this.options; + var findingText = BI.Func.getSearchResult(o.items, keyword, "text"); + var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []}; + var textItems = findingText.find.concat(findingText.match); + var valueItems = findingValue.find.concat(findingValue.match); + return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + }, + + _createJson: function(node, open) { + return { + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + isParent: BI.isNotEmptyArray(node.children), + open: open + } + }, + + _getChildren: function(node) { + var self = this; + node.children = node.children || []; + var nodes = []; + BI.each(node.children, function (idx, child) { + var children = self._getChildren(child); + nodes = nodes.concat(children); + }); + return node.children.concat(nodes); + }, + // 将搜索到的节点进行补充,构造成一棵完整的树 _fillTreeStructure4Search: function (leaves) { - var result = BI.map(leaves, "id"); - var queue = leaves.reverse() || []; + var self = this; + var result = []; + var queue = []; + BI.each(leaves, function (idx, node) { + queue.push({pId: node.pId}); + result.push(node); + result = result.concat(self._getChildren(node)); + }); while (BI.isNotEmptyArray(queue)) { var node = queue.pop(); var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { - queue.push(pNode); - result.push(pNode.id); + pNode.open = true; + queue.push({pId: pNode.pId}); + result.push(pNode); } } - var nodes = []; - BI.each(this.options.items, function (idx, item) { - if(BI.contains(result, item.id)) { - nodes.push(BI.extend({}, item, { - open: true - })) - } - }); - return nodes; + return BI.uniqBy(BI.map(result, function (idx, node) { + return self._createJson(node, node.open); + }), "id"); }, _digest: function (v) { @@ -25897,11 +25961,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, { }, _isMatch: function (parentValues, value, keyword) { + var o = this.options; var node = this._getTreeNode(parentValues, value); if (!node) { return false; } var find = BI.Func.getSearchResult([node.text || node.value], keyword); + if(o.allowSearchValue && node.value) { + var valueFind = BI.Func.getSearchResult([node.value], keyword); + return valueFind.find.length > 0 || valueFind.match.length > 0 || + find.find.length > 0 || find.match.length > 0; + } return find.find.length > 0 || find.match.length > 0; }, diff --git a/lodash.md b/lodash.md index b7a0b4648..3de867ed2 100644 --- a/lodash.md +++ b/lodash.md @@ -1 +1 @@ -lodash core plus="debounce,throttle,get,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" \ No newline at end of file +lodash core plus="debounce,throttle,get,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" \ No newline at end of file diff --git a/src/component/treevaluechooser/abstract.treevaluechooser.js b/src/component/treevaluechooser/abstract.treevaluechooser.js index 98081dbef..dbdedfcad 100644 --- a/src/component/treevaluechooser/abstract.treevaluechooser.js +++ b/src/component/treevaluechooser/abstract.treevaluechooser.js @@ -694,11 +694,17 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, { }, _isMatch: function (parentValues, value, keyword) { + var o = this.options; var node = this._getTreeNode(parentValues, value); if (!node) { return false; } var find = BI.Func.getSearchResult([node.text || node.value], keyword); + if(o.allowSearchValue && node.value) { + var valueFind = BI.Func.getSearchResult([node.value], keyword); + return valueFind.find.length > 0 || valueFind.match.length > 0 || + find.find.length > 0 || find.match.length > 0; + } return find.find.length > 0 || find.match.length > 0; }, diff --git a/src/core/base.js b/src/core/base.js index 2b1da3685..a79b4eca4 100644 --- a/src/core/base.js +++ b/src/core/base.js @@ -359,7 +359,7 @@ if (!_global.BI) { // 数组相关的方法 _.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection", - "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight"], function (name) { + "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range", "take", "takeRight", "uniqBy"], function (name) { BI[name] = _apply(name); }); _.each(["findIndex", "findLastIndex"], function (name) { diff --git a/src/core/lodash.js b/src/core/lodash.js index d853c5ce6..3f012a8ad 100644 --- a/src/core/lodash.js +++ b/src/core/lodash.js @@ -1,7 +1,7 @@ /** * @license * Lodash (Custom Build) - * Build: `lodash core plus="debounce,throttle,get,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"` + * Build: `lodash core plus="debounce,throttle,get,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"` * Copyright JS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 @@ -194,34 +194,34 @@ /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = - typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = - typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = - typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = - typedArrayTags[uint32Tag] = true; + typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = + typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = + typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = + typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = - typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = - typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = - typedArrayTags[errorTag] = typedArrayTags[funcTag] = - typedArrayTags[mapTag] = typedArrayTags[numberTag] = - typedArrayTags[objectTag] = typedArrayTags[regexpTag] = - typedArrayTags[setTag] = typedArrayTags[stringTag] = - typedArrayTags[weakMapTag] = false; + typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = + typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = + typedArrayTags[errorTag] = typedArrayTags[funcTag] = + typedArrayTags[mapTag] = typedArrayTags[numberTag] = + typedArrayTags[objectTag] = typedArrayTags[regexpTag] = + typedArrayTags[setTag] = typedArrayTags[stringTag] = + typedArrayTags[weakMapTag] = false; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = - cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = - cloneableTags[boolTag] = cloneableTags[dateTag] = - cloneableTags[float32Tag] = cloneableTags[float64Tag] = - cloneableTags[int8Tag] = cloneableTags[int16Tag] = - cloneableTags[int32Tag] = cloneableTags[mapTag] = - cloneableTags[numberTag] = cloneableTags[objectTag] = - cloneableTags[regexpTag] = cloneableTags[setTag] = - cloneableTags[stringTag] = cloneableTags[symbolTag] = - cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = - cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; + cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = + cloneableTags[boolTag] = cloneableTags[dateTag] = + cloneableTags[float32Tag] = cloneableTags[float64Tag] = + cloneableTags[int8Tag] = cloneableTags[int16Tag] = + cloneableTags[int32Tag] = cloneableTags[mapTag] = + cloneableTags[numberTag] = cloneableTags[objectTag] = + cloneableTags[regexpTag] = cloneableTags[setTag] = + cloneableTags[stringTag] = cloneableTags[symbolTag] = + cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = + cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = - cloneableTags[weakMapTag] = false; + cloneableTags[weakMapTag] = false; /** Used to map characters to HTML entities. */ var htmlEscapes = { @@ -578,8 +578,8 @@ */ function baseIndexOf(array, value, fromIndex) { return value === value - ? strictIndexOf(array, value, fromIndex) - : baseFindIndex(array, baseIsNaN, fromIndex); + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); } /** @@ -635,8 +635,8 @@ function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { eachFunc(collection, function(value, index, collection) { accumulator = initAccum - ? (initAccum = false, value) - : iteratee(accumulator, value, index, collection); + ? (initAccum = false, value) + : iteratee(accumulator, value, index, collection); }); return accumulator; } @@ -889,8 +889,8 @@ */ function safeGet(object, key) { return key == '__proto__' - ? undefined - : object[key]; + ? undefined + : object[key]; } /** @@ -941,8 +941,8 @@ */ function stringSize(string) { return hasUnicode(string) - ? unicodeSize(string) - : asciiSize(string); + ? unicodeSize(string) + : asciiSize(string); } /** @@ -954,8 +954,8 @@ */ function stringToArray(string) { return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); + ? unicodeToArray(string) + : asciiToArray(string); } /** @@ -1024,8 +1024,8 @@ /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ @@ -1362,30 +1362,30 @@ var result = []; outer: - while (length-- && resIndex < takeCount) { - index += dir; - - var iterIndex = -1, - value = array[index]; - - while (++iterIndex < iterLength) { - var data = iteratees[iterIndex], - iteratee = data.iteratee, - type = data.type, - computed = iteratee(value); - - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } - } + while (length-- && resIndex < takeCount) { + index += dir; + + var iterIndex = -1, + value = array[index]; + + while (++iterIndex < iterLength) { + var data = iteratees[iterIndex], + iteratee = data.iteratee, + type = data.type, + computed = iteratee(value); + + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; } - result[resIndex++] = value; } + } + result[resIndex++] = value; + } return result; } @@ -1893,14 +1893,14 @@ for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) ))) { result.push(key); } @@ -2115,8 +2115,8 @@ result = (isFlat || isFunc) ? {} : initCloneObject(value); if (!isDeep) { return isFlat - ? copySymbolsIn(value, baseAssignIn(result, value)) - : copySymbols(value, baseAssign(result, value)); + ? copySymbolsIn(value, baseAssignIn(result, value)) + : copySymbols(value, baseAssign(result, value)); } } else { if (!cloneableTags[tag]) { @@ -2150,8 +2150,8 @@ } var keysFunc = isFull - ? (isFlat ? getAllKeysIn : getAllKeys) - : (isFlat ? keysIn : keys); + ? (isFlat ? getAllKeysIn : getAllKeys) + : (isFlat ? keysIn : keys); var props = isArr ? undefined : keysFunc(value); arrayEach(props || value, function(subValue, key) { @@ -2217,24 +2217,24 @@ values = new SetCache(values); } outer: - while (++index < length) { - var value = array[index], - computed = iteratee == null ? value : iteratee(value); - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var valuesIndex = valuesLength; - while (valuesIndex--) { - if (values[valuesIndex] === computed) { - continue outer; - } - } - result.push(value); - } - else if (!includes(values, computed, comparator)) { - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee == null ? value : iteratee(value); + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var valuesIndex = valuesLength; + while (valuesIndex--) { + if (values[valuesIndex] === computed) { + continue outer; } } + result.push(value); + } + else if (!includes(values, computed, comparator)) { + result.push(value); + } + } return result; } @@ -2285,9 +2285,9 @@ current = iteratee(value); if (current != null && (computed === undefined - ? (current === current && !isSymbol(current)) - : comparator(current, computed) - )) { + ? (current === current && !isSymbol(current)) + : comparator(current, computed) + )) { var computed = current, result = value; } @@ -2459,8 +2459,8 @@ return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); + ? getRawTag(value) + : objectToString(value); } /** @@ -2526,8 +2526,8 @@ } maxLength = nativeMin(array.length, maxLength); caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120)) - ? new SetCache(othIndex && array) - : undefined; + ? new SetCache(othIndex && array) + : undefined; } array = arrays[0]; @@ -2535,31 +2535,31 @@ seen = caches[0]; outer: - while (++index < length && result.length < maxLength) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (!(seen - ? cacheHas(seen, computed) - : includes(result, computed, comparator) + while (++index < length && result.length < maxLength) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (!(seen + ? cacheHas(seen, computed) + : includes(result, computed, comparator) )) { - othIndex = othLength; - while (--othIndex) { - var cache = caches[othIndex]; - if (!(cache - ? cacheHas(cache, computed) - : includes(arrays[othIndex], computed, comparator)) + othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if (!(cache + ? cacheHas(cache, computed) + : includes(arrays[othIndex], computed, comparator)) ) { - continue outer; - } - } - if (seen) { - seen.push(computed); - } - result.push(value); + continue outer; } } + if (seen) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -2681,8 +2681,8 @@ if (isSameTag && !objIsObj) { stack || (stack = new Stack); return (objIsArr || isTypedArray(object)) - ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) - : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) + : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), @@ -2736,9 +2736,9 @@ while (index--) { var data = matchData[index]; if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { return false; } } @@ -2758,9 +2758,9 @@ var result = customizer(objValue, srcValue, key, object, source, stack); } if (!(result === undefined - ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) - : result - )) { + ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) + : result + )) { return false; } } @@ -2815,7 +2815,7 @@ */ function baseIsTypedArray(value) { return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } /** @@ -2836,8 +2836,8 @@ } if (typeof value == 'object') { return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); } return property(value); } @@ -2947,8 +2947,8 @@ return function(object) { var objValue = get(object, path); return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); }; } @@ -2974,8 +2974,8 @@ } else { var newValue = customizer - ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) + : undefined; if (newValue === undefined) { newValue = srcValue; @@ -3010,8 +3010,8 @@ return; } var newValue = customizer - ? customizer(objValue, srcValue, (key + ''), object, source, stack) - : undefined; + ? customizer(objValue, srcValue, (key + ''), object, source, stack) + : undefined; var isCommon = newValue === undefined; @@ -3218,8 +3218,8 @@ newValue = customizer ? customizer(objValue, key, nested) : undefined; if (newValue === undefined) { newValue = isObject(objValue) - ? objValue - : (isIndex(path[index + 1]) ? [] : {}); + ? objValue + : (isIndex(path[index + 1]) ? [] : {}); } } assignValue(nested, key, newValue); @@ -3365,30 +3365,30 @@ seen = iteratee ? [] : result; } outer: - while (++index < length) { - var value = array[index], - computed = iteratee ? iteratee(value) : value; - - value = (comparator || value !== 0) ? value : 0; - if (isCommon && computed === computed) { - var seenIndex = seen.length; - while (seenIndex--) { - if (seen[seenIndex] === computed) { - continue outer; - } - } - if (iteratee) { - seen.push(computed); - } - result.push(value); - } - else if (!includes(seen, computed, comparator)) { - if (seen !== result) { - seen.push(computed); - } - result.push(value); + while (++index < length) { + var value = array[index], + computed = iteratee ? iteratee(value) : value; + + value = (comparator || value !== 0) ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while (seenIndex--) { + if (seen[seenIndex] === computed) { + continue outer; } } + if (iteratee) { + seen.push(computed); + } + result.push(value); + } + else if (!includes(seen, computed, comparator)) { + if (seen !== result) { + seen.push(computed); + } + result.push(value); + } + } return result; } @@ -3762,8 +3762,8 @@ var key = props[index]; var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; + ? customizer(object[key], source[key], key, object, source) + : undefined; if (newValue === undefined) { newValue = source[key]; @@ -3833,8 +3833,8 @@ guard = length > 2 ? sources[2] : undefined; customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; + ? (length--, customizer) + : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; @@ -3980,14 +3980,14 @@ args[index] = arguments[index]; } var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder) - ? [] - : replaceHolders(args, placeholder); + ? [] + : replaceHolders(args, placeholder); length -= holders.length; if (length < arity) { return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, undefined, - args, holders, undefined, undefined, arity - length); + func, bitmask, createHybrid, wrapper.placeholder, undefined, + args, holders, undefined, undefined, arity - length); } var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; return apply(fn, this, args); @@ -4064,8 +4064,8 @@ if (isCurried && length < arity) { var newHolders = replaceHolders(args, placeholder); return createRecurry( - func, bitmask, createHybrid, wrapper.placeholder, thisArg, - args, newHolders, argPos, ary, arity - length + func, bitmask, createHybrid, wrapper.placeholder, thisArg, + args, newHolders, argPos, ary, arity - length ); } var thisBinding = isBind ? thisArg : this, @@ -4277,8 +4277,8 @@ partials = newData[3]; holders = newData[4]; arity = newData[9] = newData[9] === undefined - ? (isBindKey ? 0 : func.length) - : nativeMax(newData[9] - length, 0); + ? (isBindKey ? 0 : func.length) + : nativeMax(newData[9] - length, 0); if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); @@ -4373,8 +4373,8 @@ if (customizer) { var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { @@ -4386,18 +4386,18 @@ // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { - if (!cacheHas(seen, othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { - return seen.push(othIndex); - } - })) { + if (!cacheHas(seen, othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + return seen.push(othIndex); + } + })) { result = false; break; } } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, bitmask, customizer, stack) - )) { + arrValue === othValue || + equalFunc(arrValue, othValue, bitmask, customizer, stack) + )) { result = false; break; } @@ -4536,14 +4536,14 @@ if (customizer) { var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) - : compared - )) { + ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) + : compared + )) { result = false; break; } @@ -4557,7 +4557,7 @@ if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { + typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } @@ -4656,8 +4656,8 @@ function getMapData(map, key) { var data = map.__data__; return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; } /** @@ -4854,7 +4854,7 @@ } length = object == null ? 0 : object.length; return !!length && isLength(length) && isIndex(key, length) && - (isArray(object) || isArguments(object)); + (isArray(object) || isArguments(object)); } /** @@ -4885,8 +4885,8 @@ */ function initCloneObject(object) { return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; + ? baseCreate(getPrototype(object)) + : {}; } /** @@ -4965,7 +4965,7 @@ */ function isFlattenable(value) { return isArray(value) || isArguments(value) || - !!(spreadableSymbol && value && value[spreadableSymbol]); + !!(spreadableSymbol && value && value[spreadableSymbol]); } /** @@ -4981,9 +4981,9 @@ length = length == null ? MAX_SAFE_INTEGER : length; return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); } /** @@ -5002,9 +5002,9 @@ } var type = typeof index; if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object) + ) { return eq(object[index], value); } return false; @@ -5028,7 +5028,7 @@ return true; } return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object)); + (object != null && value in Object(object)); } /** @@ -5041,8 +5041,8 @@ function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); + ? (value !== '__proto__') + : (value === null); } /** @@ -5119,7 +5119,7 @@ return false; } return object[key] === srcValue && - (srcValue !== undefined || (key in Object(object))); + (srcValue !== undefined || (key in Object(object))); }; } @@ -5166,9 +5166,9 @@ isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); var isCombo = - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || - ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || - ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) || + ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) || + ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG)); // Exit early if metadata can't be merged. if (!(isCommon || isCombo)) { @@ -5558,8 +5558,8 @@ */ var difference = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) - : []; + ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) + : []; }); /** @@ -5687,8 +5687,8 @@ if (fromIndex !== undefined) { index = toInteger(fromIndex); index = fromIndex < 0 - ? nativeMax(length + index, 0) - : nativeMin(index, length - 1); + ? nativeMax(length + index, 0) + : nativeMin(index, length - 1); } return baseFindIndex(array, baseIteratee(predicate, 3), index, true); } @@ -5827,8 +5827,8 @@ var intersection = baseRest(function(arrays) { var mapped = arrayMap(arrays, castArrayLikeObject); return (mapped.length && mapped[0] === arrays[0]) - ? baseIntersection(mapped) - : []; + ? baseIntersection(mapped) + : []; }); /** @@ -6103,8 +6103,8 @@ */ var without = baseRest(function(array, values) { return isArrayLikeObject(array) - ? baseDifference(array, values) - : []; + ? baseDifference(array, values) + : []; }); /** @@ -7174,8 +7174,8 @@ timeWaiting = wait - timeSinceLastCall; return maxing - ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) - : timeWaiting; + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; } function shouldInvoke(time) { @@ -7186,7 +7186,7 @@ // trailing edge, the system time has gone backwards and we're treating // it as the trailing edge, or we've hit the `maxWait` limit. return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } function timerExpired() { @@ -7625,7 +7625,7 @@ */ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); + !propertyIsEnumerable.call(value, 'callee'); }; /** @@ -7730,7 +7730,7 @@ */ function isBoolean(value) { return value === true || value === false || - (isObjectLike(value) && baseGetTag(value) == boolTag); + (isObjectLike(value) && baseGetTag(value) == boolTag); } /** @@ -7810,7 +7810,7 @@ } if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || - isBuffer(value) || isTypedArray(value) || isArguments(value))) { + isBuffer(value) || isTypedArray(value) || isArguments(value))) { return !value.length; } var tag = getTag(value); @@ -7945,7 +7945,7 @@ */ function isLength(value) { return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** @@ -8109,7 +8109,7 @@ */ function isNumber(value) { return typeof value == 'number' || - (isObjectLike(value) && baseGetTag(value) == numberTag); + (isObjectLike(value) && baseGetTag(value) == numberTag); } /** @@ -8150,7 +8150,7 @@ } var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && - funcToString.call(Ctor) == objectCtorString; + funcToString.call(Ctor) == objectCtorString; } /** @@ -8210,7 +8210,7 @@ */ function isString(value) { return typeof value == 'string' || - (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); + (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag); } /** @@ -8232,7 +8232,7 @@ */ function isSymbol(value) { return typeof value == 'symbol' || - (isObjectLike(value) && baseGetTag(value) == symbolTag); + (isObjectLike(value) && baseGetTag(value) == symbolTag); } /** @@ -8422,8 +8422,8 @@ value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); } /** @@ -9334,8 +9334,8 @@ function escape(string) { string = toString(string); return (string && reHasUnescapedHtml.test(string)) - ? string.replace(reUnescapedHtml, escapeHtmlChar) - : string; + ? string.replace(reUnescapedHtml, escapeHtmlChar) + : string; } /** @@ -9761,8 +9761,8 @@ */ function max(array) { return (array && array.length) - ? baseExtremum(array, identity, baseGt) - : undefined; + ? baseExtremum(array, identity, baseGt) + : undefined; } /** @@ -9785,8 +9785,8 @@ */ function min(array) { return (array && array.length) - ? baseExtremum(array, identity, baseLt) - : undefined; + ? baseExtremum(array, identity, baseLt) + : undefined; } /*------------------------------------------------------------------------*/ @@ -9932,8 +9932,8 @@ n = n === undefined ? 1 : nativeMax(toInteger(n), 0); var result = (this.__filtered__ && !index) - ? new LazyWrapper(this) - : this.clone(); + ? new LazyWrapper(this) + : this.clone(); if (result.__filtered__) { result.__takeCount__ = nativeMin(n, result.__takeCount__); diff --git a/src/widget/multilayerselecttree/multilayerselecttree.combo.js b/src/widget/multilayerselecttree/multilayerselecttree.combo.js index c583070b5..272fa43d6 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.combo.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.combo.js @@ -16,7 +16,8 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { attributes: { tabIndex: 0 }, - allowEdit: false + allowEdit: false, + allowSearchValue: false }); }, @@ -96,6 +97,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { return { el: { type: "bi.multilayer_select_tree_trigger", + allowSearchValue: o.allowSearchValue, allowEdit: o.allowEdit, cls: "multilayer-select-tree-trigger", ref: function (_ref) { diff --git a/src/widget/multilayerselecttree/multilayerselecttree.trigger.js b/src/widget/multilayerselecttree/multilayerselecttree.trigger.js index 149fe4d9c..94c506e4d 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.trigger.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.trigger.js @@ -19,7 +19,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { this.tree = new BI.Tree(); - this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items)))); + this.tree.initTree(BI.Tree.treeFormat(o.items)); } var content = { type: "bi.htape", @@ -73,9 +73,7 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { onSearch: function (obj, callback) { var keyword = obj.keyword; if(o.itemsCreator === BI.emptyFn) { - var finding = BI.Func.getSearchResult(o.items, keyword); - var matched = finding.match, find = finding.find; - callback(self._fillTreeStructure4Search(find.concat(matched))); + callback(self._getSearchItems(keyword)); } else { callback(); } @@ -117,27 +115,59 @@ BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _getSearchItems: function(keyword) { + var o = this.options; + var findingText = BI.Func.getSearchResult(o.items, keyword, "text"); + var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []}; + var textItems = findingText.find.concat(findingText.match); + var valueItems = findingValue.find.concat(findingValue.match); + return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + }, + + _createJson: function(node, open) { + return { + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + isParent: BI.isNotEmptyArray(node.children), + open: open + } + }, + + _getChildren: function(node) { + var self = this; + node.children = node.children || []; + var nodes = []; + BI.each(node.children, function (idx, child) { + var children = self._getChildren(child); + nodes = nodes.concat(children); + }); + return node.children.concat(nodes); + }, + // 将搜索到的节点进行补充,构造成一棵完整的树 _fillTreeStructure4Search: function (leaves) { - var result = BI.map(leaves, "id"); - var queue = leaves.reverse() || []; + var self = this; + var result = []; + var queue = []; + BI.each(leaves, function (idx, node) { + queue.push({pId: node.pId}); + result.push(node); + result = result.concat(self._getChildren(node)); + }); while (BI.isNotEmptyArray(queue)) { var node = queue.pop(); var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { - queue.push(pNode); - result.push(pNode.id); + pNode.open = true; + queue.push({pId: pNode.pId}); + result.push(pNode); } } - var nodes = []; - BI.each(this.options.items, function (idx, item) { - if(BI.contains(result, item.id)) { - nodes.push(BI.extend({}, item, { - open: true - })) - } - }); - return nodes; + return BI.uniqBy(BI.map(result, function (idx, node) { + return self._createJson(node, node.open); + }), "id"); }, _digest: function (v) { diff --git a/src/widget/multilayersingletree/multilayersingletree.combo.js b/src/widget/multilayersingletree/multilayersingletree.combo.js index 3bac26da8..9297d10d7 100644 --- a/src/widget/multilayersingletree/multilayersingletree.combo.js +++ b/src/widget/multilayersingletree/multilayersingletree.combo.js @@ -99,6 +99,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { return { el: { type: "bi.multilayer_single_tree_trigger", + allowSearchValue: o.allowSearchValue, allowEdit: o.allowEdit, cls: "multilayer-single-tree-trigger", ref: function (_ref) { diff --git a/src/widget/multilayersingletree/multilayersingletree.trigger.js b/src/widget/multilayersingletree/multilayersingletree.trigger.js index 192a87f36..6be8ad1cb 100644 --- a/src/widget/multilayersingletree/multilayersingletree.trigger.js +++ b/src/widget/multilayersingletree/multilayersingletree.trigger.js @@ -11,7 +11,8 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { return v; }, itemsCreator: BI.emptyFn, - watermark: BI.i18nText("BI-Basic_Search") + watermark: BI.i18nText("BI-Basic_Search"), + allowSearchValue: false }; }, @@ -19,7 +20,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options; if(o.itemsCreator === BI.emptyFn) { this.tree = new BI.Tree(); - this.tree.initTree(BI.deepClone(BI.Tree.treeFormat(BI.deepClone(o.items)))); + this.tree.initTree(BI.Tree.treeFormat(o.items)); } var content = { type: "bi.htape", @@ -73,9 +74,7 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { onSearch: function (obj, callback) { var keyword = obj.keyword; if(o.itemsCreator === BI.emptyFn) { - var finding = BI.Func.getSearchResult(o.items, keyword); - var matched = finding.match, find = finding.find; - callback(self._fillTreeStructure4Search(find.concat(matched))); + callback(self._getSearchItems(keyword)); } else { callback(); } @@ -117,27 +116,59 @@ BI.MultiLayerSingleTreeTrigger = BI.inherit(BI.Trigger, { }; }, + _getSearchItems: function(keyword) { + var o = this.options; + var findingText = BI.Func.getSearchResult(o.items, keyword, "text"); + var findingValue = o.allowSearchValue ? BI.Func.getSearchResult(o.items, keyword, "value") : {find: [], match: []}; + var textItems = findingText.find.concat(findingText.match); + var valueItems = findingValue.find.concat(findingValue.match); + return this._fillTreeStructure4Search(BI.uniqBy(textItems.concat(valueItems), "id")); + }, + + _createJson: function(node, open) { + return { + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + isParent: BI.isNotEmptyArray(node.children), + open: open + } + }, + + _getChildren: function(node) { + var self = this; + node.children = node.children || []; + var nodes = []; + BI.each(node.children, function (idx, child) { + var children = self._getChildren(child); + nodes = nodes.concat(children); + }); + return node.children.concat(nodes); + }, + // 将搜索到的节点进行补充,构造成一棵完整的树 _fillTreeStructure4Search: function (leaves) { - var result = BI.map(leaves, "id"); - var queue = leaves.reverse() || []; + var self = this; + var result = []; + var queue = []; + BI.each(leaves, function (idx, node) { + queue.push({pId: node.pId}); + result.push(node); + result = result.concat(self._getChildren(node)); + }); while (BI.isNotEmptyArray(queue)) { var node = queue.pop(); var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); if (pNode != null) { - queue.push(pNode); - result.push(pNode.id); + pNode.open = true; + queue.push({pId: pNode.pId}); + result.push(pNode); } } - var nodes = []; - BI.each(this.options.items, function (idx, item) { - if(BI.contains(result, item.id)) { - nodes.push(BI.extend({}, item, { - open: true - })) - } - }); - return nodes; + return BI.uniqBy(BI.map(result, function (idx, node) { + return self._createJson(node, node.open); + }), "id"); }, _digest: function (v) {