forked from fanruan/fineui
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.3 KiB
84 lines
2.3 KiB
/** |
|
* guy |
|
* 加载条 |
|
* @type {*|void|Object} |
|
*/ |
|
BI.LoadingBar = BI.inherit(BI.Single, { |
|
consts: { |
|
loadedText: BI.i18nText("BI-Load_More"), |
|
endText: BI.i18nText("BI-No_More_Data") |
|
}, |
|
_defaultConfig: function() { |
|
var conf = BI.LoadingBar.superclass._defaultConfig.apply(this, arguments); |
|
return BI.extend( conf, { |
|
baseCls : (conf.baseCls ||"")+' bi-loading-bar', |
|
height: 30, |
|
handler: BI.emptyFn |
|
}) |
|
}, |
|
_init : function() { |
|
BI.LoadingBar.superclass._init.apply(this, arguments); |
|
var self = this; |
|
this.loaded = BI.createWidget({ |
|
type: "bi.text_button", |
|
cls: "loading-text", |
|
text: this.consts.loadedText, |
|
width: 120, |
|
handler: this.options.handler |
|
}) |
|
this.loaded.on(BI.Controller.EVENT_CHANGE, function(type){ |
|
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
|
}) |
|
|
|
this.loading = BI.createWidget({ |
|
type: "bi.layout", |
|
width: this.options.height, |
|
height:this.options.height, |
|
cls: "loading-background cursor-default" |
|
}) |
|
var loaded = BI.createWidget({ |
|
type: "bi.center_adapt", |
|
items: [this.loaded] |
|
}) |
|
var loading = BI.createWidget({ |
|
type: "bi.center_adapt", |
|
items: [this.loading] |
|
}) |
|
this.cardLayout = BI.createWidget({ |
|
type: "bi.card", |
|
element: this, |
|
items: [{ |
|
el: loaded, |
|
cardName: "loaded" |
|
}, { |
|
el: loading, |
|
cardName: "loading" |
|
}] |
|
}) |
|
this.invisible(); |
|
}, |
|
|
|
_reset: function(){ |
|
this.visible(); |
|
this.loaded.setText(this.consts.loadedText); |
|
this.loaded.enable(); |
|
}, |
|
|
|
setLoaded: function(){ |
|
this._reset(); |
|
this.cardLayout.showCardByName("loaded"); |
|
}, |
|
|
|
setEnd: function(){ |
|
this.setLoaded(); |
|
this.loaded.setText(this.consts.endText); |
|
this.loaded.disable(); |
|
}, |
|
|
|
setLoading: function(){ |
|
this._reset(); |
|
this.cardLayout.showCardByName("loading"); |
|
} |
|
}); |
|
|
|
$.shortcut("bi.loading_bar", BI.LoadingBar); |