import { ModelTool } from '@ibizstudio/runtime';
import { ViewBase } from './view-base';
/**
 * 应用视图基类
 *
 * @export
 * @class PortalViewBase
 * @extends {ViewBase}
 * @implements {PortalViewInterface}
 */
export class PortalViewBase extends ViewBase {
    /**
     * 初始化列表视图实例
     *
     * @memberof PortalViewBase
     */
    async viewModelInit() {
        await super.viewModelInit();
        this.dashboardInstance = ModelTool.findPSControlByName('dashboard', this.viewInstance.getPSControls());
    }
    /**
     *  视图挂载
     *
     * @memberof ViewBase
     */
    viewMounted() {
        this.viewState.next({ tag: 'dashboard', action: 'load', data: {} });
    }
    /**
     * 渲染视图主体内容区
     *
     * @memberof PortalViewBase
     */
    renderMainContent() {
        let { targetCtrlName, targetCtrlParam, targetCtrlEvent } = this.computeTargetCtrlData(this.dashboardInstance);
        return this.$createElement(targetCtrlName, {
            props: targetCtrlParam,
            ref: this.dashboardInstance.name,
            on: targetCtrlEvent,
        });
    }
    /**
     * 部件事件
     * @param ctrl 部件
     * @param action  行为
     * @param data 数据
     *
     * @memberof ViewBase
     */
    onCtrlEvent(controlname, action, data) {
        super.onCtrlEvent(controlname, action, data);
    }
}
