|
|
@ -41,12 +41,28 @@ BI.Button = BI.inherit(BI.BasicButton, { |
|
|
|
|
|
|
|
|
|
|
|
render: function () { |
|
|
|
render: function () { |
|
|
|
var o = this.options, self = this; |
|
|
|
var o = this.options, self = this; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 由于button默认情况下有个边框,所以要主动算行高
|
|
|
|
|
|
|
|
var lineHeight, textHeight = o.textHeight; |
|
|
|
|
|
|
|
if (BI.isNumber(o.height)) { |
|
|
|
|
|
|
|
if (o.clear || o.block) { |
|
|
|
|
|
|
|
lineHeight = o.height; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
lineHeight = o.height - 2; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!textHeight) { |
|
|
|
|
|
|
|
if (o.whiteSpace === "nowrap") { |
|
|
|
|
|
|
|
textHeight = lineHeight; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (BI.isKey(o.iconCls)) { |
|
|
|
if (BI.isKey(o.iconCls)) { |
|
|
|
this.icon = BI.createWidget({ |
|
|
|
this.icon = BI.createWidget({ |
|
|
|
type: "bi.icon_label", |
|
|
|
type: "bi.icon_label", |
|
|
|
cls: o.iconCls, |
|
|
|
cls: o.iconCls, |
|
|
|
width: this._const.iconWidth, |
|
|
|
width: this._const.iconWidth, |
|
|
|
height: o.height - 2, |
|
|
|
height: o.height, |
|
|
|
|
|
|
|
lineHeight: lineHeight, |
|
|
|
iconWidth: o.iconWidth, |
|
|
|
iconWidth: o.iconWidth, |
|
|
|
iconHeight: o.iconHeight |
|
|
|
iconHeight: o.iconHeight |
|
|
|
}); |
|
|
|
}); |
|
|
@ -54,9 +70,9 @@ BI.Button = BI.inherit(BI.BasicButton, { |
|
|
|
type: "bi.label", |
|
|
|
type: "bi.label", |
|
|
|
text: o.text, |
|
|
|
text: o.text, |
|
|
|
textWidth: BI.isNotNull(o.textWidth) ? o.textWidth - this._const.iconWidth : null, |
|
|
|
textWidth: BI.isNotNull(o.textWidth) ? o.textWidth - this._const.iconWidth : null, |
|
|
|
textHeight: o.textHeight, |
|
|
|
textHeight: textHeight, |
|
|
|
value: o.value, |
|
|
|
height: o.height, |
|
|
|
height: o.height - 2 |
|
|
|
value: o.value |
|
|
|
}); |
|
|
|
}); |
|
|
|
BI.createWidget({ |
|
|
|
BI.createWidget({ |
|
|
|
type: "bi.center_adapt", |
|
|
|
type: "bi.center_adapt", |
|
|
@ -76,7 +92,7 @@ BI.Button = BI.inherit(BI.BasicButton, { |
|
|
|
textAlign: o.textAlign, |
|
|
|
textAlign: o.textAlign, |
|
|
|
whiteSpace: o.whiteSpace, |
|
|
|
whiteSpace: o.whiteSpace, |
|
|
|
textWidth: o.textWidth, |
|
|
|
textWidth: o.textWidth, |
|
|
|
textHeight: o.textHeight, |
|
|
|
textHeight: textHeight, |
|
|
|
hgap: o.hgap, |
|
|
|
hgap: o.hgap, |
|
|
|
vgap: o.vgap, |
|
|
|
vgap: o.vgap, |
|
|
|
tgap: o.tgap, |
|
|
|
tgap: o.tgap, |
|
|
@ -88,16 +104,6 @@ BI.Button = BI.inherit(BI.BasicButton, { |
|
|
|
value: o.value |
|
|
|
value: o.value |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
if (BI.isNumber(o.height) && !o.clear && !o.block) { |
|
|
|
|
|
|
|
this.element.css({ |
|
|
|
|
|
|
|
height: o.height / BI.pixRatio + BI.pixUnit, |
|
|
|
|
|
|
|
lineHeight: (o.height - 2) / BI.pixRatio + BI.pixUnit |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else if (o.clear || o.block) { |
|
|
|
|
|
|
|
this.element.css({lineHeight: o.height / BI.pixRatio + BI.pixUnit}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.element.css({lineHeight: (o.height - 2) / BI.pixRatio + BI.pixUnit}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (o.block === true) { |
|
|
|
if (o.block === true) { |
|
|
|
this.element.addClass("block"); |
|
|
|
this.element.addClass("block"); |
|
|
|
} |
|
|
|
} |
|
|
|