Browse Source

Pull request #1590: 无JIRA任务 增加纯文本组件bi.pure_text

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

* commit '0a78cb61bfebdfcfe6785dd79753c98b08aab463':
  增加纯文本组件bi.pure_text
  增加一个纯文本组件
master
guy 4 years ago
parent
commit
8e8d1011ee
  1. 1
      changelog.md
  2. 43
      src/base/single/text.pure.js
  3. 3
      src/core/widget.js

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志
2.0(2020-11)
- 增加纯文本组件bi.pure_text
- store支持webworker,引入多线程机制
- 修复了Popover小屏幕上看不完整的问题
- 颜色选择器支持输入16进制颜色编号

43
src/base/single/text.pure.js

@ -0,0 +1,43 @@
/**
* 没有html标签的纯文本
*/
!(function () {
BI.PureText = BI.inherit(BI.Widget, {
props: {
tagName: null
},
render: function () {
var self = this, o = this.options;
var text = this._getShowText();
if (BI.isKey(text)) {
this.setText(text);
} else if (BI.isKey(o.value)) {
this.setText(o.value);
}
},
_getShowText: function () {
var o = this.options;
var text = BI.isFunction(o.text) ? o.text() : o.text;
text = BI.isKey(text) ? text : o.value;
if (!BI.isKey(text)) {
return "";
}
return BI.Text.formatText(text + "");
},
setValue: function (value) {
this.options.value = value;
this.setText(value);
},
setText: function (text) {
this.options.text = BI.isNotNull(text) ? text : "";
this.element.__textKeywordMarked__(this._getShowText());
}
});
BI.shortcut("bi.pure_text", BI.PureText);
}());

3
src/core/widget.js

@ -610,8 +610,11 @@
if (o.element) {
return BI.$(o.element);
}
if (o.tagName) {
return BI.$(document.createElement(o.tagName));
}
return BI.$(document.createDocumentFragment());
}
return BI.$(widget);
},
createFragment: function () {

Loading…
Cancel
Save