import { DashboardViewBase } from '../../../view/dashboardview-base';
import { AppLayoutService } from '../../../app-service';

/**
 * 应用实体数据看板视图基类
 *
 * @export
 * @class AppDePortalViewBase
 * @extends {DashboardViewBase}
 */
export class AppDePortalViewBase extends DashboardViewBase {
  /**
   * 实体数据看板视图渲染
   *
   * @memberof AppDePortalViewBase
   */
  render(h: any) {
    if (!this.viewIsLoaded) {
      return null;
    }
    const targetViewLayoutComponent: any = AppLayoutService.getLayoutComponent(`${this.viewInstance?.viewType}-${this.viewInstance?.viewStyle}`);
    return h(
      targetViewLayoutComponent,
      {
        props: { viewInstance: this.viewInstance, model: this.model, modelService: this.modelService, viewparams: this.viewparams, context: this.context },
      },
      [this.renderTopMessage(), this.renderCaptionInfo(), this.renderToolBar(), this.renderBodyMessage(), this.renderMainContent(), this.renderBottomMessage()],
    );
  }
}
