|
|
@ -40,11 +40,13 @@ BI._.extend(BI.Func, { |
|
|
|
* @param items |
|
|
|
* @param items |
|
|
|
* @param keyword |
|
|
|
* @param keyword |
|
|
|
* @param param 搜索哪个属性 |
|
|
|
* @param param 搜索哪个属性 |
|
|
|
|
|
|
|
* @param opt 额外配置,caseSensitive: 大小写敏感 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
getSearchResult: function (items, keyword, param) { |
|
|
|
getSearchResult: function (items, keyword, param, opt) { |
|
|
|
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"); |
|
|
|
|
|
|
|
opt || (opt = {caseSensitive: false}); |
|
|
|
if (!BI.isKey(keyword)) { |
|
|
|
if (!BI.isKey(keyword)) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
find: items, |
|
|
|
find: items, |
|
|
@ -69,8 +71,10 @@ BI._.extend(BI.Func, { |
|
|
|
py = BI.makeFirstPY(text, { |
|
|
|
py = BI.makeFirstPY(text, { |
|
|
|
splitChar: "\u200b" |
|
|
|
splitChar: "\u200b" |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
if (!opt.caseSensitive) { |
|
|
|
text = BI.toUpperCase(text); |
|
|
|
text = BI.toUpperCase(text); |
|
|
|
py = BI.toUpperCase(py); |
|
|
|
py = BI.toUpperCase(py); |
|
|
|
|
|
|
|
} |
|
|
|
var pidx; |
|
|
|
var pidx; |
|
|
|
if (text.indexOf(keyword) > -1) { |
|
|
|
if (text.indexOf(keyword) > -1) { |
|
|
|
if (text === keyword) { |
|
|
|
if (text === keyword) { |
|
|
|