diff --git a/src/core/func/function.js b/src/core/func/function.js index 83d58c5ec..cc77b7798 100644 --- a/src/core/func/function.js +++ b/src/core/func/function.js @@ -40,11 +40,13 @@ BI._.extend(BI.Func, { * @param items * @param keyword * @param param 搜索哪个属性 + * @param opt 额外配置,caseSensitive: 大小写敏感 */ - getSearchResult: function (items, keyword, param) { + getSearchResult: function (items, keyword, param, opt) { var isArray = BI.isArray(items); items = isArray ? BI.flatten(items) : items; param || (param = "text"); + opt || (opt = {caseSensitive: false}); if (!BI.isKey(keyword)) { return { find: items, @@ -69,8 +71,10 @@ BI._.extend(BI.Func, { py = BI.makeFirstPY(text, { splitChar: "\u200b" }); - text = BI.toUpperCase(text); - py = BI.toUpperCase(py); + if (!opt.caseSensitive) { + text = BI.toUpperCase(text); + py = BI.toUpperCase(py); + } var pidx; if (text.indexOf(keyword) > -1) { if (text === keyword) { diff --git a/typescript/core/func/function.ts b/typescript/core/func/function.ts index 4da9ab104..12634e513 100644 --- a/typescript/core/func/function.ts +++ b/typescript/core/func/function.ts @@ -13,8 +13,9 @@ export type _function = { * @param items 待搜索的数据 * @param keyword 关键字 * @param param 搜索哪个属性 + * @param opt 额外配置,caseSensitive: 大小写敏感 */ - getSearchResult: (items: any, keyword: any, param?: string) => { find: any[], match: any[] }; + getSearchResult: (items: any, keyword: any, param?: string, opt?: {caseSensitive: boolean}) => { find: any[], match: any[] }; /** * 获取编码后的url