Browse Source

Pull request #1841: DEC-17509 fix: getSearchResult 添加是否需要deepClone属性,提升性能

Merge in VISUAL/fineui from ~DAILER/fineui:master to master

* commit '7013faf0b5cada56607f1cb9aba671b10a7377cf':
  DEC-17509 fix: getSearchResult 添加是否需要deepClone属性,提升性能
es6
parent
commit
d6ffa7d4f9
  1. 8
      src/core/func/function.js

8
src/core/func/function.js

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

Loading…
Cancel
Save