git 3 years ago
parent
commit
9e2d3a92c0
  1. 6
      src/base/single/1.text.js
  2. 13
      src/core/platform/web/jquery/fn.js
  3. 8
      src/widget/multiselect/trigger/searcher.multiselect.insert.js
  4. 8
      src/widget/multiselect/trigger/searcher.multiselect.js
  5. 2
      src/widget/multitree/trigger/searcher.list.multi.tree.js
  6. 4
      src/widget/multitree/trigger/searcher.multi.tree.js

6
src/base/single/1.text.js

@ -77,6 +77,7 @@
} }
var text = this._getShowText(); var text = this._getShowText();
// 只要不是undefined就可以显示text值,否则显示value
if (!BI.isUndefined(text)) { if (!BI.isUndefined(text)) {
this.setText(text); this.setText(text);
} else if (BI.isKey(o.value)) { } else if (BI.isKey(o.value)) {
@ -111,7 +112,7 @@
_doRedMark: function (keyword) { _doRedMark: function (keyword) {
var o = this.options; var o = this.options;
// render之后做的doredmark,这个时候虽然标红了,但是之后text mounted执行的时候并没有keyword // render之后做的doRedMark,这个时候虽然标红了,但是之后text mounted执行的时候并没有keyword
o.keyword = keyword; o.keyword = keyword;
this.text.element.__textKeywordMarked__(this._getShowText(), keyword, o.py); this.text.element.__textKeywordMarked__(this._getShowText(), keyword, o.py);
}, },
@ -149,8 +150,7 @@
setText: function (text) { setText: function (text) {
BI.Text.superclass.setText.apply(this, arguments); BI.Text.superclass.setText.apply(this, arguments);
// 为textContext赋值为undefined时在ie和edge下会真的显示undefined this.options.text = text;
this.options.text = BI.isNotNull(text) ? text : "";
this._doRedMark(this.options.keyword); this._doRedMark(this.options.keyword);
} }
}); });

13
src/core/platform/web/jquery/fn.js vendored

@ -77,6 +77,17 @@ if (BI.jQuery) {
* 3text和py各自取tidx/pidx + keyword.length索引开始的子串作为新的text和py, 重复1, 直到text和py有一个为"" * 3text和py各自取tidx/pidx + keyword.length索引开始的子串作为新的text和py, 重复1, 直到text和py有一个为""
*/ */
__textKeywordMarked__: function (text, keyword, py) { __textKeywordMarked__: function (text, keyword, py) {
if (text === null) {
if (BI.isIE9Below()) {
return this.html("(null)");
}
// textContent性能更好,并且原生防xss
this[0].textContent = "(null)";
return this;
}
if (BI.isUndefined(text)) {
text = "";
}
if (!BI.isKey(keyword) || (text + "").length > 100) { if (!BI.isKey(keyword) || (text + "").length > 100) {
if (BI.isIE9Below()) { if (BI.isIE9Below()) {
return this.html(BI.htmlEncode(text)); return this.html(BI.htmlEncode(text));
@ -87,7 +98,7 @@ if (BI.jQuery) {
} }
keyword = keyword + ""; keyword = keyword + "";
keyword = BI.toUpperCase(keyword); keyword = BI.toUpperCase(keyword);
var textLeft = (text || "") + ""; var textLeft = text + "";
py = (py || BI.makeFirstPY(text, { py = (py || BI.makeFirstPY(text, {
splitChar: "\u200b" splitChar: "\u200b"
})) + ""; })) + "";

8
src/widget/multiselect/trigger/searcher.multiselect.insert.js

@ -135,9 +135,9 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
var state = ""; var state = "";
BI.each(ob.assist, function (i, v) { BI.each(ob.assist, function (i, v) {
if (i === 0) { if (i === 0) {
state += "" + (v === null ? "" : (o.valueFormatter(v + "") || v)); state += "" + (v === null ? "(null)" : (o.valueFormatter(v + "") || v));
} else { } else {
state += "," + (v === null ? "" : (o.valueFormatter(v + "") || v)); state += "," + (v === null ? "(null)" : (o.valueFormatter(v + "") || v));
} }
}); });
this.editor.setState(state); this.editor.setState(state);
@ -151,9 +151,9 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
var state = ""; var state = "";
BI.each(ob.value, function (i, v) { BI.each(ob.value, function (i, v) {
if (i === 0) { if (i === 0) {
state += "" + (v === null ? "" : (o.valueFormatter(v + "") || v)); state += "" + (v === null ? "(null)" : (o.valueFormatter(v + "") || v));
} else { } else {
state += "," + (v === null ? "" : (o.valueFormatter(v + "") || v)); state += "," + (v === null ? "(null)" : (o.valueFormatter(v + "") || v));
} }
}); });
this.editor.setState(state); this.editor.setState(state);

8
src/widget/multiselect/trigger/searcher.multiselect.js

@ -133,9 +133,9 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
var state = ""; var state = "";
BI.each(ob.assist, function (i, v) { BI.each(ob.assist, function (i, v) {
if (i === 0) { if (i === 0) {
state += "" + (v === null ? "" : (o.valueFormatter(v + "") || v)); state += "" + (v === null ? "(null)" : (o.valueFormatter(v + "") || v));
} else { } else {
state += "," + (v === null ? "" : (o.valueFormatter(v + "") || v)); state += "," + (v === null ? "(null)" : (o.valueFormatter(v + "") || v));
} }
}); });
this.editor.setState(state); this.editor.setState(state);
@ -149,9 +149,9 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
var state = ""; var state = "";
BI.each(ob.value, function (i, v) { BI.each(ob.value, function (i, v) {
if (i === 0) { if (i === 0) {
state += "" + (v === null ? "" : (o.valueFormatter(v + "") || v)); state += "" + (v === null ? "(null)" : (o.valueFormatter(v + "") || v));
} else { } else {
state += "," + (v === null ? "" : (o.valueFormatter(v + "") || v)); state += "," + (v === null ? "(null)" : (o.valueFormatter(v + "") || v));
} }
}); });
this.editor.setState(state); this.editor.setState(state);

2
src/widget/multitree/trigger/searcher.list.multi.tree.js

@ -122,7 +122,7 @@ BI.MultiListTreeSearcher = BI.inherit(BI.Widget, {
var text = ""; var text = "";
BI.each(ob.value, function (idx, path) { BI.each(ob.value, function (idx, path) {
var childValue = BI.last(path); var childValue = BI.last(path);
text += (path === "null" ? "" : (o.valueFormatter(childValue + "") || childValue) + "; "); text += (path === "null" ? "(null)" : (o.valueFormatter(childValue + "") || childValue) + "; ");
count++; count++;
}); });

4
src/widget/multitree/trigger/searcher.multi.tree.js

@ -136,7 +136,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
var names = BI.Func.getSortedResult(BI.keys(value)); var names = BI.Func.getSortedResult(BI.keys(value));
BI.each(names, function (idx, name) { BI.each(names, function (idx, name) {
var childNodes = getChildrenNode(value[name]); var childNodes = getChildrenNode(value[name]);
text += (name === "null" ? "" : (o.valueFormatter(name + "") || name)) + (childNodes === "" ? "" : (":" + childNodes)) + "; "; text += (name === "null" ? "(null)" : (o.valueFormatter(name + "") || name)) + (childNodes === "" ? "" : (":" + childNodes)) + "; ";
if (childNodes === "") { if (childNodes === "") {
count++; count++;
} }
@ -156,7 +156,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
BI.each(names, function (idx, name) { BI.each(names, function (idx, name) {
index++; index++;
var childNodes = getChildrenNode(ob[name]); var childNodes = getChildrenNode(ob[name]);
text += (name === "null" ? "" : (o.valueFormatter(name + "") || name)) + (childNodes === "" ? "" : (":" + childNodes)) + (index === size ? "" : ","); text += (name === "null" ? "(null)" : (o.valueFormatter(name + "") || name)) + (childNodes === "" ? "" : (":" + childNodes)) + (index === size ? "" : ",");
if (childNodes === "") { if (childNodes === "") {
count++; count++;
} }

Loading…
Cancel
Save