import { throttle } from '@ibizstudio/runtime';
import { PickupView2Base } from '../../../view/pickupview2-base';
import { AppLayoutService } from '../../..';
export class AppPickupView2Base extends PickupView2Base {
    /**
     * 渲染选择视图面板
     *
     * @memberof AppPickupView2Base
     */
    renderMainContent() {
        var _a;
        let { targetCtrlName, targetCtrlParam, targetCtrlEvent } = this.computeTargetCtrlData(this.treeExpBarInstance);
        Object.assign(targetCtrlParam.staticProps, { pickupviewpanel: this.pickupViewInstance });
        return this.$createElement(targetCtrlName, { slot: 'default', props: targetCtrlParam, ref: (_a = this.treeExpBarInstance) === null || _a === void 0 ? void 0 : _a.name, on: targetCtrlEvent });
    }
    /**
     * 渲染选择视图按钮
     *
     * @memberof AppPickupView2Base
     */
    renderPickButton() {
        var _a, _b, _c, _d;
        if (this.isShowButton) {
            return (<card dis-hover={true} bordered={false} class='footer'>
          <row style={{ textAlign: 'right' }}>
            <i-button type='primary' disabled={this.viewSelections.length > 0 ? false : true} on-click={(...params) => throttle(this.onClickOk, params, this)}>
              {(_b = (_a = this.containerModel) === null || _a === void 0 ? void 0 : _a.view_okbtn) === null || _b === void 0 ? void 0 : _b.text}
            </i-button>
            &nbsp;&nbsp;
            <i-button on-click={(...params) => throttle(this.onClickCancel, params, this)}>{(_d = (_c = this.containerModel) === null || _c === void 0 ? void 0 : _c.view_cancelbtn) === null || _d === void 0 ? void 0 : _d.text}</i-button>
          </row>
        </card>);
        }
    }
    /**
     * 数据视图渲染
     *
     * @memberof AppPickupView2Base
     */
    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.renderTopMessage(), this.renderBodyMessage(), this.renderToolBar(), this.renderMainContent(), this.renderPickButton(), this.renderBottomMessage()]);
    }
}
