import { __decorate } from "tslib";
import { Component, Emit, Prop, Inject } from 'vue-property-decorator';
import { ViewContainerBase } from './view-container-base';
import { addGlobalHeader } from '@ibizstudio/api';
/**
 * 视图壳插件工具专用
 *
 * @export
 * @class AppIndexViewShell2
 * @extends {ViewContainerBase}
 */
let AppIndexViewShell2 = class AppIndexViewShell2 extends ViewContainerBase {
    /**
     * 数据变化
     *
     * @param {*} val
     * @returns {*}
     * @memberof AppIndexViewShell
     */
    viewDatasChange(val) {
        return val;
    }
    /**
     * Vue声明周期
     *
     * @memberof AppIndexViewShell
     */
    created() {
        if (this.$route && this.$route.matched && this.$route.matched.length > 0) {
            let indexRoute = this.$route.matched.find((item) => {
                var _a;
                return (_a = item === null || item === void 0 ? void 0 : item.meta) === null || _a === void 0 ? void 0 : _a.dynaModelFilePath;
            });
            if (indexRoute) {
                this.dynaModelFilePath = indexRoute.meta.dynaModelFilePath;
            }
        }
        if (this.$route.params) {
            const keys = Object.keys(this.$route.params);
            addGlobalHeader('srfcontainer', this.$route.params[keys[0]]);
            const appData = this.$store.getters.getAppData();
            Object.assign(appData.context, { srfcontainer: this.$route.params[keys[0]] });
            this.$store.commit('addAppData', appData);
        }
        this.loadDynamicModelData();
    }
    /**
     * 组件加载完成
     *
     * @memberof AppIndexViewShell
     */
    mounted() {
        this.appLoadingDestroyed();
    }
    /**
     *  应用loading销毁
     *
     * @memberof AppIndexViewShell
     */
    appLoadingDestroyed() {
        setTimeout(() => {
            const el = document.getElementById('app-loading-x');
            if (el) {
                el.style.display = 'none';
            }
        }, 300);
    }
    /**
     * 视图绘制
     *
     * @memberof AppIndexViewShell
     */
    render() {
        return <router-view></router-view>;
    }
};
__decorate([
    Emit()
], AppIndexViewShell2.prototype, "viewDatasChange", null);
__decorate([
    Prop()
], AppIndexViewShell2.prototype, "staticProps", void 0);
__decorate([
    Prop()
], AppIndexViewShell2.prototype, "dynamicProps", void 0);
__decorate([
    Inject({ from: 'navModel', default: 'tab' })
], AppIndexViewShell2.prototype, "navModel", void 0);
AppIndexViewShell2 = __decorate([
    Component({})
], AppIndexViewShell2);
export { AppIndexViewShell2 };
