fineui是帆软报表和BI产品线所使用的前端框架。
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.

81 lines
2.2 KiB

8 years ago
/**
* guy
* 加载条
* @type {*|void|Object}
*/
BI.LoadingBar = BI.inherit(BI.Single, {
7 years ago
_defaultConfig: function () {
8 years ago
var conf = BI.LoadingBar.superclass._defaultConfig.apply(this, arguments);
return BI.extend( conf, {
7 years ago
baseCls: (conf.baseCls || "") + " bi-loading-bar bi-tips",
8 years ago
height: 30,
handler: BI.emptyFn
7 years ago
});
8 years ago
},
render: function () {
8 years ago
var self = this;
this.loaded = BI.createWidget({
type: "bi.text_button",
8 years ago
cls: "loading-text bi-list-item-simple",
text: BI.i18nText("BI-Load_More"),
8 years ago
width: 120,
handler: this.options.handler
7 years ago
});
this.loaded.on(BI.Controller.EVENT_CHANGE, function (type) {
8 years ago
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
7 years ago
});
8 years ago
this.loading = BI.createWidget({
type: "bi.layout",
8 years ago
width: this.options.height,
7 years ago
height: this.options.height,
8 years ago
cls: "loading-background cursor-default"
7 years ago
});
8 years ago
var loaded = BI.createWidget({
type: "bi.center_adapt",
items: [this.loaded]
7 years ago
});
8 years ago
var loading = BI.createWidget({
type: "bi.center_adapt",
items: [this.loading]
7 years ago
});
8 years ago
this.cardLayout = BI.createWidget({
type: "bi.card",
8 years ago
element: this,
8 years ago
items: [{
el: loaded,
cardName: "loaded"
}, {
el: loading,
cardName: "loading"
}]
7 years ago
});
8 years ago
this.invisible();
},
7 years ago
_reset: function () {
8 years ago
this.visible();
this.loaded.setText(BI.i18nText("BI-Load_More"));
8 years ago
this.loaded.enable();
},
7 years ago
setLoaded: function () {
8 years ago
this._reset();
this.cardLayout.showCardByName("loaded");
},
7 years ago
setEnd: function () {
8 years ago
this.setLoaded();
this.loaded.setText(BI.i18nText("BI-No_More_Data"));
8 years ago
this.loaded.disable();
},
7 years ago
setLoading: function () {
8 years ago
this._reset();
this.cardLayout.showCardByName("loading");
}
});
BI.shortcut("bi.loading_bar", BI.LoadingBar);