|
|
@ -62,6 +62,7 @@ |
|
|
|
bgap: 0, |
|
|
|
bgap: 0, |
|
|
|
lgap: 0, |
|
|
|
lgap: 0, |
|
|
|
rgap: 0, |
|
|
|
rgap: 0, |
|
|
|
|
|
|
|
icon: "", |
|
|
|
iconGap: 0, |
|
|
|
iconGap: 0, |
|
|
|
iconPosition: "left", |
|
|
|
iconPosition: "left", |
|
|
|
}); |
|
|
|
}); |
|
|
@ -90,9 +91,12 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var iconInvisible = !o.loading && !o.iconCls; |
|
|
|
var iconInvisible = !o.loading && !o.iconCls; |
|
|
|
|
|
|
|
if (BI.isPlainObject(o.icon) && !o.loading) { |
|
|
|
|
|
|
|
this.icon = BI.createWidget(o.icon); |
|
|
|
|
|
|
|
} else { |
|
|
|
this.icon = BI.createWidget({ |
|
|
|
this.icon = BI.createWidget({ |
|
|
|
type: "bi.icon_label", |
|
|
|
type: "bi.icon_label", |
|
|
|
cls: o.loading ? loadingCls : o.iconCls, |
|
|
|
cls: o.loading ? loadingCls : (o.iconCls || o.icon), |
|
|
|
width: this._const.iconWidth, |
|
|
|
width: this._const.iconWidth, |
|
|
|
height: lineHeight, |
|
|
|
height: lineHeight, |
|
|
|
lineHeight: lineHeight, |
|
|
|
lineHeight: lineHeight, |
|
|
@ -101,6 +105,8 @@ |
|
|
|
iconHeight: o.iconHeight, |
|
|
|
iconHeight: o.iconHeight, |
|
|
|
invisible: iconInvisible, |
|
|
|
invisible: iconInvisible, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 用于 whiteSpace
|
|
|
|
// 用于 whiteSpace
|
|
|
|
var textWidth = iconInvisible && o.width ? o.width - o.hgap * 2 : null; |
|
|
|
var textWidth = iconInvisible && o.width ? o.width - o.hgap * 2 : null; |
|
|
|
if (BI.isNotNull(o.textWidth)) { |
|
|
|
if (BI.isNotNull(o.textWidth)) { |
|
|
@ -179,23 +185,31 @@ |
|
|
|
return this.isLoading(); |
|
|
|
return this.isLoading(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
isLoading() { |
|
|
|
isLoading: function () { |
|
|
|
return this._loading === undefined ? this.options.loading : this._loading; |
|
|
|
return this._loading === undefined ? this.options.loading : this._loading; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
loading: function (loading) { |
|
|
|
loading: function () { |
|
|
|
this._loading = true; |
|
|
|
this._loading = true; |
|
|
|
this.element.addClass("loading"); |
|
|
|
this.element.addClass("loading"); |
|
|
|
|
|
|
|
if (this.icon.loading) { |
|
|
|
|
|
|
|
this.icon.loading(); |
|
|
|
|
|
|
|
} else { |
|
|
|
// loadingCls 可以覆盖 iconCls 所以不需要移除 iconCls
|
|
|
|
// loadingCls 可以覆盖 iconCls 所以不需要移除 iconCls
|
|
|
|
this.icon.element.addClass(loadingCls); |
|
|
|
this.icon.element.addClass(loadingCls); |
|
|
|
this.icon.setVisible(true); |
|
|
|
this.icon.setVisible(true); |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
loaded() { |
|
|
|
loaded: function () { |
|
|
|
this._loading = false; |
|
|
|
this._loading = false; |
|
|
|
this.element.removeClass("loading"); |
|
|
|
this.element.removeClass("loading"); |
|
|
|
|
|
|
|
if (this.icon.loaded) { |
|
|
|
|
|
|
|
this.icon.loaded(); |
|
|
|
|
|
|
|
} else { |
|
|
|
this.icon.element.removeClass(loadingCls); |
|
|
|
this.icon.element.removeClass(loadingCls); |
|
|
|
this.icon.setVisible(!!this.options.iconCls); |
|
|
|
this.icon.setVisible(!!this.options.iconCls); |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setText: function (text) { |
|
|
|
setText: function (text) { |
|
|
|