import { ChartExpViewEngine, ModelTool } from '@ibizstudio/runtime';
import { ExpViewBase } from './expview-base';
export class ChartExpViewBase extends ExpViewBase {
    constructor() {
        super(...arguments);
        /**
         * 图表导航视图引擎对象
         *
         * @type {ChartExpViewEngine}
         * @memberof ChartExpViewBase
         */
        this.engine = new ChartExpViewEngine();
    }
    /**
     * 视图模型初始化
     *
     * @memberof ChartExpViewBase
     */
    async viewModelInit() {
        var _a, _b, _c;
        await super.viewModelInit();
        this.viewInstance = ((_a = this.staticProps) === null || _a === void 0 ? void 0 : _a.modeldata);
        this.expBarInstance = ModelTool.findPSControlByType('CHARTEXPBAR', ((_c = (_b = this.viewInstance) === null || _b === void 0 ? void 0 : _b.getPSControls) === null || _c === void 0 ? void 0 : _c.call(_b)) || []);
    }
    /**
     * 引擎初始化
     *
     * @memberof ChartExpViewBase
     */
    engineInit() {
        if (this.Environment && this.Environment.isPreviewMode) {
            return;
        }
        let engineOpts = ({
            view: this,
            parentContainer: this.$parent,
            p2k: '0',
            chartexpbar: this.$refs[this.expBarInstance.name].ctrl,
            keyPSDEField: this.appDeCodeName.toLowerCase(),
            majorPSDEField: this.appDeMajorFieldName.toLowerCase(),
            isLoadDefault: this.viewInstance.loadDefault,
        });
        this.engine.init(engineOpts);
    }
    /**
     * 计算图表导航栏部件参数
     *
     * @memberof CalendarExpViewBase
     */
    computeTargetCtrlData(controlInstance) {
        const { targetCtrlName, targetCtrlParam, targetCtrlEvent } = super.computeTargetCtrlData(controlInstance);
        Object.assign(targetCtrlParam.staticProps, {
            sideBarLayout: this.viewInstance.sideBarLayout
        });
        return { targetCtrlName: targetCtrlName, targetCtrlParam: targetCtrlParam, targetCtrlEvent: targetCtrlEvent };
    }
}
