|
|
|
@ -62,6 +62,7 @@
|
|
|
|
|
bgap: 0, |
|
|
|
|
lgap: 0, |
|
|
|
|
rgap: 0, |
|
|
|
|
icon: "", |
|
|
|
|
iconGap: 0, |
|
|
|
|
iconPosition: "left", |
|
|
|
|
}); |
|
|
|
@ -90,17 +91,30 @@
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var iconInvisible = !o.loading && !o.iconCls; |
|
|
|
|
this.icon = BI.createWidget({ |
|
|
|
|
type: "bi.icon_label", |
|
|
|
|
cls: o.loading ? loadingCls : o.iconCls, |
|
|
|
|
width: this._const.iconWidth, |
|
|
|
|
height: lineHeight, |
|
|
|
|
lineHeight: lineHeight, |
|
|
|
|
// 不设置,自定义按钮无法居中
|
|
|
|
|
iconWidth: o.iconWidth, |
|
|
|
|
iconHeight: o.iconHeight, |
|
|
|
|
invisible: iconInvisible, |
|
|
|
|
}); |
|
|
|
|
if (BI.isObject(o.icon) && BI.isString(o.icon.type)) { |
|
|
|
|
// FineUI 自定义 icon
|
|
|
|
|
this.icon = BI.createWidget(o.icon); |
|
|
|
|
o.loading ? (this.icon.loading && this.icon.loading()) |
|
|
|
|
: (this.icon.loaded && this.icon.loaded()); |
|
|
|
|
} else { |
|
|
|
|
// ReactUI 自定义的 icon
|
|
|
|
|
if (!o.loading && BI.isObject(o.icon)) { |
|
|
|
|
this.icon = o.icon; |
|
|
|
|
} else { |
|
|
|
|
this.icon = BI.createWidget({ |
|
|
|
|
type: "bi.icon_label", |
|
|
|
|
cls: o.loading ? loadingCls : (o.iconCls || o.icon), |
|
|
|
|
width: this._const.iconWidth, |
|
|
|
|
height: lineHeight, |
|
|
|
|
lineHeight: lineHeight, |
|
|
|
|
// 不设置,自定义按钮无法居中
|
|
|
|
|
iconWidth: o.iconWidth, |
|
|
|
|
iconHeight: o.iconHeight, |
|
|
|
|
invisible: iconInvisible, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 用于 whiteSpace
|
|
|
|
|
var textWidth = iconInvisible && o.width ? o.width - o.hgap * 2 : null; |
|
|
|
|
if (BI.isNotNull(o.textWidth)) { |
|
|
|
@ -179,23 +193,31 @@
|
|
|
|
|
return this.isLoading(); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
isLoading() { |
|
|
|
|
isLoading: function () { |
|
|
|
|
return this._loading === undefined ? this.options.loading : this._loading; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
loading: function (loading) { |
|
|
|
|
loading: function () { |
|
|
|
|
this._loading = true; |
|
|
|
|
this.element.addClass("loading"); |
|
|
|
|
// loadingCls 可以覆盖 iconCls 所以不需要移除 iconCls
|
|
|
|
|
this.icon.element.addClass(loadingCls); |
|
|
|
|
this.icon.setVisible(true); |
|
|
|
|
if (this.icon.loading) { |
|
|
|
|
this.icon.loading(); |
|
|
|
|
} else { |
|
|
|
|
// loadingCls 可以覆盖 iconCls 所以不需要移除 iconCls
|
|
|
|
|
this.icon.element.addClass(loadingCls); |
|
|
|
|
this.icon.setVisible(true); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
loaded() { |
|
|
|
|
loaded: function () { |
|
|
|
|
this._loading = false; |
|
|
|
|
this.element.removeClass("loading"); |
|
|
|
|
this.icon.element.removeClass(loadingCls); |
|
|
|
|
this.icon.setVisible(!!this.options.iconCls); |
|
|
|
|
if (this.icon.loaded) { |
|
|
|
|
this.icon.loaded(); |
|
|
|
|
} else { |
|
|
|
|
this.icon.element.removeClass(loadingCls); |
|
|
|
|
this.icon.setVisible(!!this.options.iconCls); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
setText: function (text) { |
|
|
|
|