import { AppLayoutService } from '../../../app-service/common-service/app-layout-service';
import { DeIndexViewBase } from '../../../view';
/**
 * 应用实体首页视图
 *
 * @export
 * @class AppDEIndexViewBase
 * @extends {DeIndexViewBase}
 */
export class AppDEIndexViewBase extends DeIndexViewBase {
    /**
     * @description 渲染表单部件
     * @return {*}
     * @memberof AppDEIndexViewBase
     */
    renderForm() {
        var _a;
        if (!this.formInstance) {
            return;
        }
        const { targetCtrlName, targetCtrlParam, targetCtrlEvent } = this.computeTargetCtrlData(this.formInstance);
        return this.$createElement(targetCtrlName, { props: targetCtrlParam, ref: (_a = this.formInstance) === null || _a === void 0 ? void 0 : _a.name, on: targetCtrlEvent });
    }
    /**
     * @description 渲染数据关系栏部件
     * @return {*}
     * @memberof AppDEIndexViewBase
     */
    renderDrBar() {
        var _a;
        if (!this.drBarInstance) {
            return;
        }
        const { targetCtrlName, targetCtrlParam, targetCtrlEvent } = this.computeTargetCtrlData(this.drBarInstance);
        Object.assign(targetCtrlParam.staticProps, {
            showMode: 'INDEXMODE',
        });
        return this.$createElement(targetCtrlName, { props: targetCtrlParam, ref: (_a = this.drBarInstance) === null || _a === void 0 ? void 0 : _a.name, on: targetCtrlEvent });
    }
    /**
     * @description 渲染主体内容
     * @return {*}
     * @memberof AppDEIndexViewBase
     */
    renderMainContent() {
        return (<div slot='default' class='ctrl-container'>
        <div class='form-container'>{this.renderForm()}</div>
        <div class='drbar-container'>{this.renderDrBar()}</div>
      </div>);
    }
    /**
     * @description 渲染实体首页视图
     * @param {CreateElement} h
     * @return {*}
     * @memberof AppDEIndexViewBase
     */
    render(h) {
        if (!this.viewIsLoaded) {
            return null;
        }
        const targetViewLayoutComponent = 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.renderDataPanelInfo(),
            this.renderTopMessage(),
            this.renderCaptionInfo(),
            this.renderBodyMessage(),
            this.renderToolBar(),
            this.renderMainContent(),
            this.renderBottomMessage(),
            ...this.renderViewControls(),
        ]);
    }
}
