|
|
@ -15,8 +15,8 @@ _.extend(BI.Func, { |
|
|
|
name = name || ""; |
|
|
|
name = name || ""; |
|
|
|
while (true) { |
|
|
|
while (true) { |
|
|
|
if (BI.every(array, function (i, item) { |
|
|
|
if (BI.every(array, function (i, item) { |
|
|
|
return BI.isKey(item) ? item !== name : item.name !== name; |
|
|
|
return BI.isKey(item) ? item !== name : item.name !== name; |
|
|
|
})) { |
|
|
|
})) { |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
name = src + (idx++); |
|
|
|
name = src + (idx++); |
|
|
@ -40,14 +40,16 @@ _.extend(BI.Func, { |
|
|
|
* @param items |
|
|
|
* @param items |
|
|
|
* @param keyword |
|
|
|
* @param keyword |
|
|
|
* @param param 搜索哪个属性 |
|
|
|
* @param param 搜索哪个属性 |
|
|
|
|
|
|
|
* @param clone 是否需要deepClone |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
getSearchResult: function (items, keyword, param) { |
|
|
|
getSearchResult: function (items, keyword, param, clone) { |
|
|
|
var isArray = BI.isArray(items); |
|
|
|
var isArray = BI.isArray(items); |
|
|
|
items = isArray ? BI.flatten(items) : items; |
|
|
|
items = isArray ? BI.flatten(items) : items; |
|
|
|
param || (param = "text"); |
|
|
|
param || (param = "text"); |
|
|
|
|
|
|
|
BI.isNull(clone) && (clone = true); |
|
|
|
if (!BI.isKey(keyword)) { |
|
|
|
if (!BI.isKey(keyword)) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
find: BI.deepClone(items), |
|
|
|
find: clone ? BI.deepClone(items) : items, |
|
|
|
match: isArray ? [] : {} |
|
|
|
match: isArray ? [] : {} |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
@ -59,7 +61,7 @@ _.extend(BI.Func, { |
|
|
|
if (BI.isNull(item)) { |
|
|
|
if (BI.isNull(item)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
item = BI.deepClone(item); |
|
|
|
clone && (item = BI.deepClone(item)); |
|
|
|
t = BI.stripEL(item); |
|
|
|
t = BI.stripEL(item); |
|
|
|
text = BI.find([t[param], t.text, t.value, t.name, t], function (index, val) { |
|
|
|
text = BI.find([t[param], t.text, t.value, t.name, t], function (index, val) { |
|
|
|
return BI.isNotNull(val); |
|
|
|
return BI.isNotNull(val); |
|
|
|