Browse Source

KERNEL-11911 feat: label组件默认使用text作为tooltip

es6
zsmj 2 years ago
parent
commit
b1742aaefe
  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,
warningTitle: null,
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);
}) : o.value;
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)) {
this.enableHover({
belowMouse: o.belowMouse,

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

@ -18,10 +18,27 @@
tgap: 0,
bgap: 0,
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 () {
var o = this.options;
return {
@ -374,6 +391,7 @@
setValue: function (v) {
BI.AbstractLabel.superclass.setValue.apply(this, arguments);
if (!this.isReadOnly()) {
this.options.text = v;
this.text.setValue(v);
}
}

Loading…
Cancel
Save