import { TreeExpViewEngine, ModelTool } from '@ibizstudio/runtime';
import { ExpViewBase } from './expview-base';
/**
 * 树导航视图基类
 *
 * @export
 * @class TreeExpViewBase
 * @extends {ExpViewBase}
 * @implements {TreeExpViewInterface}
 */
export class TreeExpViewBase extends ExpViewBase {
    constructor() {
        super(...arguments);
        /**
         * 视图引擎
         *
         * @public
         * @type {ChartViewEngine}
         * @memberof TreeExpViewBase
         */
        this.engine = new TreeExpViewEngine();
    }
    /**
     * 引擎初始化
     *
     * @public
     * @memberof TreeExpViewBase
     */
    engineInit() {
        var _a, _b;
        if (this.Environment && this.Environment.isPreviewMode) {
            return;
        }
        this.engine.init({
            view: this,
            parentContainer: this.$parent,
            p2k: '0',
            treeexpbar: this.$refs[(_a = this.expBarInstance) === null || _a === void 0 ? void 0 : _a.name].ctrl,
            keyPSDEField: this.appDeCodeName.toLowerCase(),
            majorPSDEField: this.appDeMajorFieldName.toLowerCase(),
            isLoadDefault: (_b = this.viewInstance) === null || _b === void 0 ? void 0 : _b.loadDefault,
        });
    }
    /**
     * 初始化列表视图实例
     *
     * @memberof TreeExpViewBase
     */
    async viewModelInit() {
        var _a;
        this.viewInstance = ((_a = this.staticProps) === null || _a === void 0 ? void 0 : _a.modeldata);
        await super.viewModelInit();
        this.expBarInstance = ModelTool.findPSControlByType('TREEEXPBAR', this.viewInstance.getPSControls() || []);
    }
}
