From 174b9bdf82f96f2674103e399ef67b99fb3a1f1b Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Tue, 7 May 2019 09:40:17 +0800 Subject: [PATCH] =?UTF-8?q?BI-44302=20feat:=20label=E6=94=AF=E6=8C=81text?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E4=BC=A0function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/2.0/fineui.ie.js | 19 ++++++++++++------- dist/2.0/fineui.js | 19 ++++++++++++------- dist/base.js | 19 ++++++++++++------- dist/bundle.ie.js | 19 ++++++++++++------- dist/bundle.js | 19 ++++++++++++------- dist/fineui.ie.js | 19 ++++++++++++------- dist/fineui.js | 19 ++++++++++++------- dist/fineui_without_jquery_polyfill.js | 19 ++++++++++++------- src/base/single/text.js | 19 ++++++++++++------- 9 files changed, 108 insertions(+), 63 deletions(-) diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js index 909d9cff5..8b49eaee0 100644 --- a/dist/2.0/fineui.ie.js +++ b/dist/2.0/fineui.ie.js @@ -36069,16 +36069,21 @@ BI.Text = BI.inherit(BI.Single, { } }, - mounted: function () { + _getShowText: function () { var o = this.options; + return BI.isFunction(o.text) ? o.text() : o.text; + }, - if (BI.isKey(o.text)) { - this.setText(o.text); + mounted: function () { + var o = this.options; + var text = this._getShowText(); + if (BI.isKey(text)) { + this.setText(text); } else if (BI.isKey(o.value)) { this.setText(o.value); } if (BI.isKey(o.keyword)) { - this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); + this.text.element.__textKeywordMarked__(text, o.keyword, o.py); } if (o.highLight) { this.doHighLight(); @@ -36089,13 +36094,13 @@ BI.Text = BI.inherit(BI.Single, { var o = this.options; // render之后做的doredmark,这个时候虽然标红了,但是之后text mounted执行的时候并没有keyword o.keyword = keyword; - this.text.element.__textKeywordMarked__(o.text || o.value, keyword, o.py); + this.text.element.__textKeywordMarked__(this._getShowText() || o.value, keyword, o.py); }, unRedMark: function () { var o = this.options; o.keyword = ""; - this.text.element.__textKeywordMarked__(o.text || o.value, "", o.py); + this.text.element.__textKeywordMarked__(this._getShowText() || o.value, "", o.py); }, doHighLight: function () { @@ -36120,7 +36125,7 @@ BI.Text = BI.inherit(BI.Single, { setText: function (text) { BI.Text.superclass.setText.apply(this, arguments); this.options.text = text; - this.text.element.html(BI.htmlEncode(text)); + this.text.element.html(BI.htmlEncode(this._getShowText())); } }); diff --git a/dist/2.0/fineui.js b/dist/2.0/fineui.js index c676efe66..4db3d4247 100644 --- a/dist/2.0/fineui.js +++ b/dist/2.0/fineui.js @@ -36473,16 +36473,21 @@ BI.Text = BI.inherit(BI.Single, { } }, - mounted: function () { + _getShowText: function () { var o = this.options; + return BI.isFunction(o.text) ? o.text() : o.text; + }, - if (BI.isKey(o.text)) { - this.setText(o.text); + mounted: function () { + var o = this.options; + var text = this._getShowText(); + if (BI.isKey(text)) { + this.setText(text); } else if (BI.isKey(o.value)) { this.setText(o.value); } if (BI.isKey(o.keyword)) { - this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); + this.text.element.__textKeywordMarked__(text, o.keyword, o.py); } if (o.highLight) { this.doHighLight(); @@ -36493,13 +36498,13 @@ BI.Text = BI.inherit(BI.Single, { var o = this.options; // render之后做的doredmark,这个时候虽然标红了,但是之后text mounted执行的时候并没有keyword o.keyword = keyword; - this.text.element.__textKeywordMarked__(o.text || o.value, keyword, o.py); + this.text.element.__textKeywordMarked__(this._getShowText() || o.value, keyword, o.py); }, unRedMark: function () { var o = this.options; o.keyword = ""; - this.text.element.__textKeywordMarked__(o.text || o.value, "", o.py); + this.text.element.__textKeywordMarked__(this._getShowText() || o.value, "", o.py); }, doHighLight: function () { @@ -36524,7 +36529,7 @@ BI.Text = BI.inherit(BI.Single, { setText: function (text) { BI.Text.superclass.setText.apply(this, arguments); this.options.text = text; - this.text.element.html(BI.htmlEncode(text)); + this.text.element.html(BI.htmlEncode(this._getShowText())); } }); diff --git a/dist/base.js b/dist/base.js index de1160b11..48342a1ca 100644 --- a/dist/base.js +++ b/dist/base.js @@ -602,16 +602,21 @@ BI.Text = BI.inherit(BI.Single, { } }, - mounted: function () { + _getShowText: function () { var o = this.options; + return BI.isFunction(o.text) ? o.text() : o.text; + }, - if (BI.isKey(o.text)) { - this.setText(o.text); + mounted: function () { + var o = this.options; + var text = this._getShowText(); + if (BI.isKey(text)) { + this.setText(text); } else if (BI.isKey(o.value)) { this.setText(o.value); } if (BI.isKey(o.keyword)) { - this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); + this.text.element.__textKeywordMarked__(text, o.keyword, o.py); } if (o.highLight) { this.doHighLight(); @@ -622,13 +627,13 @@ BI.Text = BI.inherit(BI.Single, { var o = this.options; // render之后做的doredmark,这个时候虽然标红了,但是之后text mounted执行的时候并没有keyword o.keyword = keyword; - this.text.element.__textKeywordMarked__(o.text || o.value, keyword, o.py); + this.text.element.__textKeywordMarked__(this._getShowText() || o.value, keyword, o.py); }, unRedMark: function () { var o = this.options; o.keyword = ""; - this.text.element.__textKeywordMarked__(o.text || o.value, "", o.py); + this.text.element.__textKeywordMarked__(this._getShowText() || o.value, "", o.py); }, doHighLight: function () { @@ -653,7 +658,7 @@ BI.Text = BI.inherit(BI.Single, { setText: function (text) { BI.Text.superclass.setText.apply(this, arguments); this.options.text = text; - this.text.element.html(BI.htmlEncode(text)); + this.text.element.html(BI.htmlEncode(this._getShowText())); } }); diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js index 909d9cff5..8b49eaee0 100644 --- a/dist/bundle.ie.js +++ b/dist/bundle.ie.js @@ -36069,16 +36069,21 @@ BI.Text = BI.inherit(BI.Single, { } }, - mounted: function () { + _getShowText: function () { var o = this.options; + return BI.isFunction(o.text) ? o.text() : o.text; + }, - if (BI.isKey(o.text)) { - this.setText(o.text); + mounted: function () { + var o = this.options; + var text = this._getShowText(); + if (BI.isKey(text)) { + this.setText(text); } else if (BI.isKey(o.value)) { this.setText(o.value); } if (BI.isKey(o.keyword)) { - this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); + this.text.element.__textKeywordMarked__(text, o.keyword, o.py); } if (o.highLight) { this.doHighLight(); @@ -36089,13 +36094,13 @@ BI.Text = BI.inherit(BI.Single, { var o = this.options; // render之后做的doredmark,这个时候虽然标红了,但是之后text mounted执行的时候并没有keyword o.keyword = keyword; - this.text.element.__textKeywordMarked__(o.text || o.value, keyword, o.py); + this.text.element.__textKeywordMarked__(this._getShowText() || o.value, keyword, o.py); }, unRedMark: function () { var o = this.options; o.keyword = ""; - this.text.element.__textKeywordMarked__(o.text || o.value, "", o.py); + this.text.element.__textKeywordMarked__(this._getShowText() || o.value, "", o.py); }, doHighLight: function () { @@ -36120,7 +36125,7 @@ BI.Text = BI.inherit(BI.Single, { setText: function (text) { BI.Text.superclass.setText.apply(this, arguments); this.options.text = text; - this.text.element.html(BI.htmlEncode(text)); + this.text.element.html(BI.htmlEncode(this._getShowText())); } }); diff --git a/dist/bundle.js b/dist/bundle.js index c676efe66..4db3d4247 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -36473,16 +36473,21 @@ BI.Text = BI.inherit(BI.Single, { } }, - mounted: function () { + _getShowText: function () { var o = this.options; + return BI.isFunction(o.text) ? o.text() : o.text; + }, - if (BI.isKey(o.text)) { - this.setText(o.text); + mounted: function () { + var o = this.options; + var text = this._getShowText(); + if (BI.isKey(text)) { + this.setText(text); } else if (BI.isKey(o.value)) { this.setText(o.value); } if (BI.isKey(o.keyword)) { - this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); + this.text.element.__textKeywordMarked__(text, o.keyword, o.py); } if (o.highLight) { this.doHighLight(); @@ -36493,13 +36498,13 @@ BI.Text = BI.inherit(BI.Single, { var o = this.options; // render之后做的doredmark,这个时候虽然标红了,但是之后text mounted执行的时候并没有keyword o.keyword = keyword; - this.text.element.__textKeywordMarked__(o.text || o.value, keyword, o.py); + this.text.element.__textKeywordMarked__(this._getShowText() || o.value, keyword, o.py); }, unRedMark: function () { var o = this.options; o.keyword = ""; - this.text.element.__textKeywordMarked__(o.text || o.value, "", o.py); + this.text.element.__textKeywordMarked__(this._getShowText() || o.value, "", o.py); }, doHighLight: function () { @@ -36524,7 +36529,7 @@ BI.Text = BI.inherit(BI.Single, { setText: function (text) { BI.Text.superclass.setText.apply(this, arguments); this.options.text = text; - this.text.element.html(BI.htmlEncode(text)); + this.text.element.html(BI.htmlEncode(this._getShowText())); } }); diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js index 90d1a52c6..8cd5d108e 100644 --- a/dist/fineui.ie.js +++ b/dist/fineui.ie.js @@ -36314,16 +36314,21 @@ BI.Text = BI.inherit(BI.Single, { } }, - mounted: function () { + _getShowText: function () { var o = this.options; + return BI.isFunction(o.text) ? o.text() : o.text; + }, - if (BI.isKey(o.text)) { - this.setText(o.text); + mounted: function () { + var o = this.options; + var text = this._getShowText(); + if (BI.isKey(text)) { + this.setText(text); } else if (BI.isKey(o.value)) { this.setText(o.value); } if (BI.isKey(o.keyword)) { - this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); + this.text.element.__textKeywordMarked__(text, o.keyword, o.py); } if (o.highLight) { this.doHighLight(); @@ -36334,13 +36339,13 @@ BI.Text = BI.inherit(BI.Single, { var o = this.options; // render之后做的doredmark,这个时候虽然标红了,但是之后text mounted执行的时候并没有keyword o.keyword = keyword; - this.text.element.__textKeywordMarked__(o.text || o.value, keyword, o.py); + this.text.element.__textKeywordMarked__(this._getShowText() || o.value, keyword, o.py); }, unRedMark: function () { var o = this.options; o.keyword = ""; - this.text.element.__textKeywordMarked__(o.text || o.value, "", o.py); + this.text.element.__textKeywordMarked__(this._getShowText() || o.value, "", o.py); }, doHighLight: function () { @@ -36365,7 +36370,7 @@ BI.Text = BI.inherit(BI.Single, { setText: function (text) { BI.Text.superclass.setText.apply(this, arguments); this.options.text = text; - this.text.element.html(BI.htmlEncode(text)); + this.text.element.html(BI.htmlEncode(this._getShowText())); } }); diff --git a/dist/fineui.js b/dist/fineui.js index cc65f6301..cd7b4a997 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -36718,16 +36718,21 @@ BI.Text = BI.inherit(BI.Single, { } }, - mounted: function () { + _getShowText: function () { var o = this.options; + return BI.isFunction(o.text) ? o.text() : o.text; + }, - if (BI.isKey(o.text)) { - this.setText(o.text); + mounted: function () { + var o = this.options; + var text = this._getShowText(); + if (BI.isKey(text)) { + this.setText(text); } else if (BI.isKey(o.value)) { this.setText(o.value); } if (BI.isKey(o.keyword)) { - this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); + this.text.element.__textKeywordMarked__(text, o.keyword, o.py); } if (o.highLight) { this.doHighLight(); @@ -36738,13 +36743,13 @@ BI.Text = BI.inherit(BI.Single, { var o = this.options; // render之后做的doredmark,这个时候虽然标红了,但是之后text mounted执行的时候并没有keyword o.keyword = keyword; - this.text.element.__textKeywordMarked__(o.text || o.value, keyword, o.py); + this.text.element.__textKeywordMarked__(this._getShowText() || o.value, keyword, o.py); }, unRedMark: function () { var o = this.options; o.keyword = ""; - this.text.element.__textKeywordMarked__(o.text || o.value, "", o.py); + this.text.element.__textKeywordMarked__(this._getShowText() || o.value, "", o.py); }, doHighLight: function () { @@ -36769,7 +36774,7 @@ BI.Text = BI.inherit(BI.Single, { setText: function (text) { BI.Text.superclass.setText.apply(this, arguments); this.options.text = text; - this.text.element.html(BI.htmlEncode(text)); + this.text.element.html(BI.htmlEncode(this._getShowText())); } }); diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js index 1859128d1..a166b606b 100644 --- a/dist/fineui_without_jquery_polyfill.js +++ b/dist/fineui_without_jquery_polyfill.js @@ -25149,16 +25149,21 @@ BI.Text = BI.inherit(BI.Single, { } }, - mounted: function () { + _getShowText: function () { var o = this.options; + return BI.isFunction(o.text) ? o.text() : o.text; + }, - if (BI.isKey(o.text)) { - this.setText(o.text); + mounted: function () { + var o = this.options; + var text = this._getShowText(); + if (BI.isKey(text)) { + this.setText(text); } else if (BI.isKey(o.value)) { this.setText(o.value); } if (BI.isKey(o.keyword)) { - this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); + this.text.element.__textKeywordMarked__(text, o.keyword, o.py); } if (o.highLight) { this.doHighLight(); @@ -25169,13 +25174,13 @@ BI.Text = BI.inherit(BI.Single, { var o = this.options; // render之后做的doredmark,这个时候虽然标红了,但是之后text mounted执行的时候并没有keyword o.keyword = keyword; - this.text.element.__textKeywordMarked__(o.text || o.value, keyword, o.py); + this.text.element.__textKeywordMarked__(this._getShowText() || o.value, keyword, o.py); }, unRedMark: function () { var o = this.options; o.keyword = ""; - this.text.element.__textKeywordMarked__(o.text || o.value, "", o.py); + this.text.element.__textKeywordMarked__(this._getShowText() || o.value, "", o.py); }, doHighLight: function () { @@ -25200,7 +25205,7 @@ BI.Text = BI.inherit(BI.Single, { setText: function (text) { BI.Text.superclass.setText.apply(this, arguments); this.options.text = text; - this.text.element.html(BI.htmlEncode(text)); + this.text.element.html(BI.htmlEncode(this._getShowText())); } }); diff --git a/src/base/single/text.js b/src/base/single/text.js index 0ed1123c2..0a1f9c306 100644 --- a/src/base/single/text.js +++ b/src/base/single/text.js @@ -75,16 +75,21 @@ BI.Text = BI.inherit(BI.Single, { } }, - mounted: function () { + _getShowText: function () { var o = this.options; + return BI.isFunction(o.text) ? o.text() : o.text; + }, - if (BI.isKey(o.text)) { - this.setText(o.text); + mounted: function () { + var o = this.options; + var text = this._getShowText(); + if (BI.isKey(text)) { + this.setText(text); } else if (BI.isKey(o.value)) { this.setText(o.value); } if (BI.isKey(o.keyword)) { - this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); + this.text.element.__textKeywordMarked__(text, o.keyword, o.py); } if (o.highLight) { this.doHighLight(); @@ -95,13 +100,13 @@ BI.Text = BI.inherit(BI.Single, { var o = this.options; // render之后做的doredmark,这个时候虽然标红了,但是之后text mounted执行的时候并没有keyword o.keyword = keyword; - this.text.element.__textKeywordMarked__(o.text || o.value, keyword, o.py); + this.text.element.__textKeywordMarked__(this._getShowText() || o.value, keyword, o.py); }, unRedMark: function () { var o = this.options; o.keyword = ""; - this.text.element.__textKeywordMarked__(o.text || o.value, "", o.py); + this.text.element.__textKeywordMarked__(this._getShowText() || o.value, "", o.py); }, doHighLight: function () { @@ -126,7 +131,7 @@ BI.Text = BI.inherit(BI.Single, { setText: function (text) { BI.Text.superclass.setText.apply(this, arguments); this.options.text = text; - this.text.element.html(BI.htmlEncode(text)); + this.text.element.html(BI.htmlEncode(this._getShowText())); } });