Browse Source

Merge pull request #103300 in DEC/fineui from master to feature/x

* commit 'dd00621140520dddbd8ad4a6e25c3d946556b239':
  KERNEL-11911 feat: label组件默认使用text作为tooltip
es6
superman 2 years ago
parent
commit
53ba55cd3a
  1. 5
      src/base/single/0.single.js
  2. 20
      src/base/single/label/abstract.label.js

5
src/base/single/0.single.js

@ -17,7 +17,8 @@ BI.Single = BI.inherit(BI.Widget, {
title: null, title: null,
warningTitle: null, warningTitle: null,
tipType: null, // success或warning tipType: null, // success或warning
belowMouse: false // title是否跟随鼠标 belowMouse: false, // title是否跟随鼠标
enableHover: false
}); });
}, },
@ -57,7 +58,7 @@ BI.Single = BI.inherit(BI.Widget, {
self.setValue(newValue); self.setValue(newValue);
}) : o.value; }) : o.value;
BI.Single.superclass._init.apply(this, arguments); BI.Single.superclass._init.apply(this, arguments);
if (BI.isKey(o.title) || BI.isKey(o.warningTitle) if (o.enableHover || BI.isKey(o.title) || BI.isKey(o.warningTitle)
|| BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) { || BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) {
this.enableHover({ this.enableHover({
belowMouse: o.belowMouse, belowMouse: o.belowMouse,

20
src/base/single/label/abstract.label.js

@ -18,10 +18,27 @@
tgap: 0, tgap: 0,
bgap: 0, bgap: 0,
highLight: false, highLight: false,
handler: null handler: null,
enableHover: props.title !== null,
}); });
}, },
getTitle: function () {
var title = this.options.title;
var text = this.options.text;
if (BI.isFunction(title)) {
return title();
}
if (BI.isNotNull(title)) {
return title;
}
if (BI.isFunction(text)) {
return text();
}
return text;
},
_createJson: function () { _createJson: function () {
var o = this.options; var o = this.options;
return { return {
@ -374,6 +391,7 @@
setValue: function (v) { setValue: function (v) {
BI.AbstractLabel.superclass.setValue.apply(this, arguments); BI.AbstractLabel.superclass.setValue.apply(this, arguments);
if (!this.isReadOnly()) { if (!this.isReadOnly()) {
this.options.text = v;
this.text.setValue(v); this.text.setValue(v);
} }
} }

Loading…
Cancel
Save