From af5d691195b8942f5cf54ce83cf19c7cc246aa04 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 23 Dec 2019 13:42:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?KERNEL-2638=20refactor:=20search=5Feditor?= =?UTF-8?q?=E7=9A=84getValue=E5=92=8Csearcher=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog.md | 1 + src/base/combination/searcher.js | 11 +++++++++-- src/widget/editor/editor.search.js | 3 +-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 384758d89..02c590507 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2019-12) +- bi.search_editor支持搜索中间含有空格的字符串 - 修复了监听日期下拉框before_popup_view事件,调用setMinDate无效的问题 - 修复了数值滑块逆向排列滑块后populate显示效果不对的问题 - 不影响父节点勾选状态的复选树支持自定义水印和默认值 diff --git a/src/base/combination/searcher.js b/src/base/combination/searcher.js index 07423dc24..2daad7077 100644 --- a/src/base/combination/searcher.js +++ b/src/base/combination/searcher.js @@ -164,7 +164,7 @@ BI.Searcher = BI.inherit(BI.Widget, { }, _search: function () { - var self = this, o = this.options, keyword = this.editor.getValue(); + var self = this, o = this.options, keyword = this.getLastSearchKeyword(); if (keyword === "" || this._stop) { return; } @@ -197,6 +197,13 @@ BI.Searcher = BI.inherit(BI.Widget, { }); }, + getLastSearchKeyword: function () { + if (this.isValid()) { + var res = this.editor.getValue().match(/[\S]+/g); + return BI.isNull(res) ? "" : res[res.length - 1]; + } + }, + setAdapter: function (adapter) { this.options.adapter = adapter; BI.Maskers.remove(this.getName()); @@ -258,7 +265,7 @@ BI.Searcher = BI.inherit(BI.Widget, { }, getKeyword: function () { - return this.editor.getValue(); + return this.getLastSearchKeyword(); }, getKeywords: function () { diff --git a/src/widget/editor/editor.search.js b/src/widget/editor/editor.search.js index f6079b67c..8eef89f2f 100644 --- a/src/widget/editor/editor.search.js +++ b/src/widget/editor/editor.search.js @@ -149,8 +149,7 @@ BI.SearchEditor = BI.inherit(BI.Widget, { getValue: function () { if (this.isValid()) { - var res = this.editor.getValue().match(/[\S]+/g); - return BI.isNull(res) ? "" : res[res.length - 1]; + return this.editor.getValue(); } }, From dd274282d3e45daa5c7b3099e2408817e9ecb6f1 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 23 Dec 2019 13:46:57 +0800 Subject: [PATCH 2/2] =?UTF-8?q?getLastKeyword=E5=8F=98=E6=88=90=E7=A7=81?= =?UTF-8?q?=E6=9C=89=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/combination/searcher.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/base/combination/searcher.js b/src/base/combination/searcher.js index 2daad7077..7d99209b4 100644 --- a/src/base/combination/searcher.js +++ b/src/base/combination/searcher.js @@ -164,7 +164,7 @@ BI.Searcher = BI.inherit(BI.Widget, { }, _search: function () { - var self = this, o = this.options, keyword = this.getLastSearchKeyword(); + var self = this, o = this.options, keyword = this._getLastSearchKeyword(); if (keyword === "" || this._stop) { return; } @@ -197,7 +197,7 @@ BI.Searcher = BI.inherit(BI.Widget, { }); }, - getLastSearchKeyword: function () { + _getLastSearchKeyword: function () { if (this.isValid()) { var res = this.editor.getValue().match(/[\S]+/g); return BI.isNull(res) ? "" : res[res.length - 1]; @@ -265,7 +265,7 @@ BI.Searcher = BI.inherit(BI.Widget, { }, getKeyword: function () { - return this.getLastSearchKeyword(); + return this._getLastSearchKeyword(); }, getKeywords: function () {