|
|
|
@ -81,7 +81,7 @@
|
|
|
|
|
}, |
|
|
|
|
hgap: o.hgap, |
|
|
|
|
vgap: o.vgap, |
|
|
|
|
items: self.generateItems() |
|
|
|
|
items: self.generateItems(), |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 如果 options 对应的属性为 true 则给元素添加 class
|
|
|
|
@ -102,7 +102,7 @@
|
|
|
|
|
|
|
|
|
|
// 由于button默认情况下有个边框,所以要主动算行高
|
|
|
|
|
var lineHeight, textHeight = o.textHeight; |
|
|
|
|
var hasBorder = false |
|
|
|
|
var hasBorder = false; |
|
|
|
|
if (BI.isNumber(o.height)) { |
|
|
|
|
if (!isVertical(o.iconPosition)) { |
|
|
|
|
if (!(o.clear && o.block && o.light)) { |
|
|
|
@ -121,12 +121,12 @@
|
|
|
|
|
|
|
|
|
|
var iconInvisible = !(o.loading || o.iconCls || o.icon || defaultRenderIcon); |
|
|
|
|
|
|
|
|
|
var textWidth = o.textWidth; |
|
|
|
|
if (BI.isNull(o.textWidth)) { |
|
|
|
|
textWidth = (o.minWidth > 0 && o.width < o.minWidth) ? o.minWidth : o.width; |
|
|
|
|
textWidth -= (o.hgap * 2 + o.iconGap) |
|
|
|
|
textWidth -= iconInvisible || isVertical(o.iconPosition) ? 0 : this._const.iconWidth |
|
|
|
|
} |
|
|
|
|
var maxTextWidth = Math.max(o.minWidth, o.width); |
|
|
|
|
maxTextWidth -= (o.hgap * 2 + o.iconGap); |
|
|
|
|
// 减去图标水平占位宽度
|
|
|
|
|
maxTextWidth -= iconInvisible || isVertical(o.iconPosition) ? 0 : this._const.iconWidth; |
|
|
|
|
var textWidth = BI.isNull(o.textWidth) ? maxTextWidth : Math.min(o.textWidth, maxTextWidth); |
|
|
|
|
|
|
|
|
|
this.text = BI.createWidget({ |
|
|
|
|
type: "bi.label", |
|
|
|
|
text: o.text, |
|
|
|
@ -140,7 +140,7 @@
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if (iconInvisible) { |
|
|
|
|
return [this.text] |
|
|
|
|
return [this.text]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this._iconRendered = true; |
|
|
|
|