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.
 
 
 

84 lines
2.3 KiB

import { TextButton } from "../button";
import { Layout, CenterAdaptLayout, CardLayout, shortcut, emptyFn, createWidget, i18nText, Controller } from "@/core";
import { Single } from "../0.single";
@shortcut()
export class LoadingBar extends Single {
static xtype = "bi.loading_bar";
_defaultConfig() {
const conf = super._defaultConfig.apply(this, arguments);
return {
...conf,
baseCls: `${conf.baseCls || ""} bi-loading-bar bi-tips`,
height: 30,
handler: emptyFn,
};
}
render() {
this.loaded = createWidget({
type: TextButton.xtype,
cls: "loading-text bi-list-item-simple",
text: i18nText("BI-Load_More"),
width: 120,
handler: this.options.handler,
});
this.loaded.on(Controller.EVENT_CHANGE, (...args) => {
this.fireEvent(Controller.EVENT_CHANGE, ...args);
});
this.loading = createWidget({
type: Layout.xtype,
width: this.options.height,
height: this.options.height,
cls: "loading-background cursor-default",
});
const loaded = createWidget({
type: CenterAdaptLayout.xtype,
items: [this.loaded],
});
const loading = createWidget({
type: CenterAdaptLayout.xtype,
items: [this.loading],
});
this.cardLayout = createWidget({
type: CardLayout.xtype,
element: this,
items: [
{
el: loaded,
cardName: "loaded",
},
{
el: loading,
cardName: "loading",
}
],
});
this.invisible();
}
_reset() {
this.visible();
this.loaded.setText(i18nText("BI-Load_More"));
this.loaded.enable();
}
setLoaded() {
this._reset();
this.cardLayout.showCardByName("loaded");
}
setEnd() {
this.setLoaded();
this.loaded.setText(i18nText("BI-No_More_Data"));
this.loaded.disable();
}
setLoading() {
this._reset();
this.cardLayout.showCardByName("loading");
}
}