import { __decorate } from "tslib";
import Vue from 'vue';
import { AppCtrlEventEngine, AppCustomEngine, AppServiceBase, AppTimerEngine, CounterService, GetModelService, LogUtil, Util } from '@ibizstudio/runtime';
import { PluginService } from '../app-service';
import { Emit, Prop } from 'vue-property-decorator';
import { Watch } from '../decorators';
/**
 * 部件基类
 *
 * @export
 * @class ControlBase
 * @extends {Vue}
 */
export class ControlBase extends Vue {
    constructor() {
        super(...arguments);
        /**
         * 环境文件
         *
         * @type {any}
         * @protected
         * @memberof ControlBase
         */
        this.Environment = AppServiceBase.getInstance().getAppEnvironment();
        /**
         * 部件UI是否存在权限
         *
         * @type {boolean}
         * @memberof ControlBase
         */
        this.enableControlUIAuth = true;
        /**
         * 原生引用控件名称
         *
         * @memberof ControlBase
         */
        this.realCtrlRefName = '';
        /**
         * 插件工厂
         *
         * @type {*}
         * @memberof ControlBase
         */
        this.PluginFactory = PluginService.getInstance();
        /**
         * 显示处理提示
         *
         * @type {boolean}
         * @memberof ControlBase
         */
        this.showBusyIndicator = true;
        /**
         * 应用上下文
         *
         * @type {*}
         * @memberof ControlBase
         */
        this.context = {};
        /**
         * 视图参数
         *
         * @type {*}
         * @memberof ControlBase
         */
        this.viewparams = {};
        /**
         * 拷贝应用上下文
         *
         * @type {*}
         * @memberof ControlBase
         */
        this.copyContext = {};
        /**
         * 拷贝视图参数
         *
         * @type {*}
         * @memberof ControlBase
         */
        this.copyViewparams = {};
        /**
         * 模型数据是否加载完成
         *
         * @memberof ControlBase
         */
        this.controlIsLoaded = false;
        /**
         * 绘制参数
         *
         * @type {*}
         * @memberof AppDefaultSearchForm
         */
        this.renderOptions = {
            controlClassNames: {},
        };
        /**
         * 计数器服务对象集合
         *
         * @type {Array<*>}
         * @memberof ControlBase
         */
        this.counterServiceArray = [];
        /**
         * 部件是否加载完成(判断是否加载中)
         *
         * @readonly
         * @memberof ControlBase
         */
        this.isControlLoaded = false;
        /**
         * 部件ID
         *
         * @memberof ControlBase
         */
        this.controlId = '';
        /**
         * 界面触发逻辑Map
         *
         * @memberof ControlBase
         */
        this.ctrlTriggerLogicMap = new Map();
        /**
         * 原生界面触发逻辑集合
         *
         * @memberof ControlBase
         */
        this.realCtrlTriggerLogicArray = [];
        /**
         * 原生界面触发逻辑分隔符
         *
         * @memberof ControlBase
         */
        this.realCtrlSeparator = 'ibiz_';
        /**
         * 注册事件逻辑分隔符
         *
         * @memberof ControlBase
         */
        this.registerEventSeparator = 'ibiz__';
        /**
         * 挂载状态集合
         *
         * @type {Map<string,boolean>}
         * @memberof ControlBase
         */
        this.mountedMap = new Map();
        /**
         * 是否部件已经完成ctrlMounted
         *
         * @type {boolean}
         * @memberof ControlBase
         */
        this.hasCtrlMounted = false;
    }
    /**
     * 监听动态参数变化
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof AppDefaultNotSupportedControl
     */
    watchDynamicPropsChange(newVal, oldVal) {
        if (newVal && !Util.isFieldsSame(newVal, oldVal)) {
            this.onDynamicPropsChange(newVal, oldVal);
        }
    }
    /**
     * 监听静态参数变化
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof AppDefaultNotSupportedControl
     */
    watchStaticPropsChange(newVal, oldVal) {
        if (newVal && !Util.isFieldsSame(newVal, oldVal)) {
            this.onStaticPropsChange(newVal, oldVal);
        }
    }
    /**
     * 部件事件抛出方法
     *
     * @param {{ controlname: string; action: string; data: any }} { controlname, action, data }
     * @memberof ControlBase
     */
    ctrlEvent({ controlname, action, data }) { }
    /**
     * 部件销毁
     *
     * @author chitanda
     * @date 2022-06-20 12:06:50
     */
    destroyed() {
        this.ctrlDestroyed();
    }
    /**
     * 部件事件
     * @param ctrl 部件
     * @param action  行为
     * @param data 数据
     *
     * @memberof ViewBase
     */
    onCtrlEvent(controlname, action, data) {
        if (action == 'controlIsMounted') {
            this.setIsMounted(controlname);
        }
        else {
            this.ctrlEvent({ controlname, action, data });
        }
    }
    /**
     * 初始化部件的绘制参数
     *
     * @type {Array<*>}
     * @memberof ViewBase
     */
    initRenderOptions(opts) {
        var _a, _b, _c, _d;
        this.renderOptions = {};
        const { controlType, codeName } = this.controlInstance;
        // 部件类名
        const controlClassNames = {
            'control-container': true,
            [controlType === null || controlType === void 0 ? void 0 : controlType.toLowerCase()]: true,
            [Util.srfFilePath2(codeName)]: true,
        };
        Object.assign(controlClassNames, opts);
        if ((_c = (_b = (_a = this.controlInstance) === null || _a === void 0 ? void 0 : _a.getPSSysCss) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c.cssName) {
            Object.assign(controlClassNames, { [(_d = this.controlInstance.getPSSysCss()) === null || _d === void 0 ? void 0 : _d.cssName]: true });
        }
        this.$set(this.renderOptions, 'controlClassNames', controlClassNames);
    }
    /**
     * 计算目标部件所需参数
     *
     * @param {*} controlInstance 要绘制的部件实例
     * @param {*} [otherParam] 其他参数
     * @returns
     * @memberof ControlBase
     */
    computeTargetCtrlData(controlInstance) {
        const targetCtrlName = `app-control-shell`;
        const targetCtrlParam = {
            dynamicProps: {
                viewparams: Util.deepCopy(this.viewparams),
                context: Util.deepCopy(this.context),
                viewCtx: this.viewCtx,
            },
            staticProps: {
                viewState: this.viewState,
                viewtag: this.viewtag,
                modelData: controlInstance,
                viewDefaultUsage: this.viewDefaultUsage,
            },
        };
        Object.defineProperty(targetCtrlParam.staticProps, 'modelData', { enumerable: false, writable: true });
        const targetCtrlEvent = {
            'ctrl-event': ({ controlname, action, data }) => {
                this.onCtrlEvent(controlname, action, data);
            },
            closeView: ($event) => {
                this.closeView($event);
            },
        };
        return { targetCtrlName: targetCtrlName, targetCtrlParam: targetCtrlParam, targetCtrlEvent: targetCtrlEvent };
    }
    /**
     * 获取部件类型
     *
     * @returns {string}
     * @memberof ControlBase
     */
    getControlType() {
        return this.controlInstance.controlType;
    }
    /**
     * 获取多项数据
     *
     * @returns {any[]}
     * @memberof ControlBase
     */
    getDatas() {
        return [];
    }
    /**
     * 获取单项数据
     *
     * @returns {*}
     * @memberof ControlBase
     */
    getData() {
        return null;
    }
    /**
     * 监听动态参数变化
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof ControlBase
     */
    onDynamicPropsChange(newVal, oldVal) {
        if ((newVal === null || newVal === void 0 ? void 0 : newVal.context) && newVal.context !== (oldVal === null || oldVal === void 0 ? void 0 : oldVal.context)) {
            this.context = newVal.context;
            this.copyContext = Util.deepCopy(newVal.context);
        }
        if ((newVal === null || newVal === void 0 ? void 0 : newVal.viewparams) && newVal.viewparams !== (oldVal === null || oldVal === void 0 ? void 0 : oldVal.viewparams)) {
            this.viewparams = newVal.viewparams;
            this.copyViewparams = Util.deepCopy(newVal.viewparams);
        }
        if ((newVal === null || newVal === void 0 ? void 0 : newVal.navdatas) && newVal.navdatas !== (oldVal === null || oldVal === void 0 ? void 0 : oldVal.navdatas)) {
            this.navdatas = newVal.navdatas;
        }
        if ((newVal === null || newVal === void 0 ? void 0 : newVal.viewCtx) && newVal.viewCtx !== (oldVal === null || oldVal === void 0 ? void 0 : oldVal.viewCtx)) {
            this.viewCtx = newVal.viewCtx;
        }
    }
    /**
     * 监听导航数据参数变化
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof ControlBase
     */
    setNavdatas(args) {
        this.navdatas = args;
        if (Util.isExistData(this.navdatas)) {
            this.handleCustomCtrlData();
        }
        else {
            this.context = Util.deepCopy(this.copyContext);
            this.viewparams = Util.deepCopy(this.copyViewparams);
        }
    }
    /**
     * 初始化挂载状态集合
     *
     * @memberof ControlBase
     */
    initMountedMap() {
        var _a, _b;
        let controls = (_b = (_a = this.controlInstance) === null || _a === void 0 ? void 0 : _a.getPSControls) === null || _b === void 0 ? void 0 : _b.call(_a);
        controls === null || controls === void 0 ? void 0 : controls.forEach((item) => {
            if (item.controlType == 'CONTEXTMENU' || item.controlType == 'TOOLBAR') {
                this.mountedMap.set(item.name, true);
            }
            else {
                this.mountedMap.set(item.name, false);
            }
        });
        this.mountedMap.set('self', false);
    }
    /**
     * 设置已经绘制完成状态
     *
     * @memberof ControlBase
     */
    setIsMounted(name = 'self') {
        this.mountedMap.set(name, true);
        if ([...this.mountedMap.values()].indexOf(false) == -1) {
            // 执行ctrlMounted
            if (!this.hasCtrlMounted) {
                this.$nextTick(() => {
                    this.ctrlMounted();
                });
            }
        }
    }
    /**
     * 监听静态参数变化
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof ControlBase
     */
    onStaticPropsChange(newVal, oldVal) {
        this.controlInstance = this.staticProps.modelData;
        this.viewState = this.staticProps.viewState;
        this.viewtag = this.staticProps.viewtag;
        this.controlId = this.staticProps.controlId;
        this.viewDefaultUsage = this.staticProps.viewDefaultUsage;
        this.ctrlModelInit().then(() => {
            this.ctrlInit();
            this.controlIsLoaded = true;
            this.$nextTick(() => {
                this.setIsMounted();
            });
        });
    }
    /**
     * 初始化模型服务
     *
     * @memberof ControlBase
     */
    async initModelService() {
        this.modelService = await GetModelService(this.context);
    }
    /**
     * 部件模型数据加载
     *
     * @memberof ControlBase
     */
    async ctrlModelLoad() {
        var _a, _b;
        // 部件子部件数据加载
        if ((_b = (_a = this.controlInstance) === null || _a === void 0 ? void 0 : _a.getPSControls) === null || _b === void 0 ? void 0 : _b.call(_a)) {
            for (const control of this.controlInstance.getPSControls()) {
                await control.fill();
            }
        }
    }
    /**
     * 处理部件UI请求
     *
     * @memberof ControlBase
     */
    onControlRequset(action, context, viewparam) { }
    /**
     * 处理部件UI响应
     *
     * @memberof ControlBase
     */
    onControlResponse(action, response) { }
    /**
     * 部件模型数据初始化实例
     *
     * @memberof ControlBase
     */
    async ctrlModelInit(args) {
        await this.initModelService();
        await this.ctrlModelLoad();
        this.initMountedMap();
        this.name = this.controlInstance.name ? this.controlInstance.name : this.controlInstance.codeName;
        this.showBusyIndicator = this.controlInstance.showBusyIndicator;
        this.initRenderOptions();
        await this.initCounterService(this.controlInstance);
        await this.initControlLogic(this.controlInstance);
    }
    /**
     * 部件初始化
     *
     * @memberof ControlBase
     */
    ctrlInit(args) {
        if (this.viewState) {
            this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
                this.viewStateAction(tag, action, data);
            });
        }
        // 处理部件定时器逻辑
        this.handleTimerLogic();
    }
    /**
     * @description 视图状态触发行为
     * @param {string} tag 标识
     * @param {string} action 行为
     * @param {*} data 行为数据
     * @memberof ControlBase
     */
    viewStateAction(tag, action, data) {
        if (!Object.is(tag, this.name)) {
            return;
        }
        if (Object.is('reset', action)) {
            this.onReset();
        }
    }
    /**
     * 部件挂载
     *
     * @memberof ControlBase
     */
    ctrlMounted(args) {
        this.hasCtrlMounted = true;
        this.ctrlEvent({
            controlname: this.controlInstance.name,
            action: 'controlIsMounted',
            data: true,
        });
        if (this.realCtrlRefName && this.realCtrlTriggerLogicArray.length > 0) {
            let timer = setInterval(() => {
                if (this.$refs && this.$refs[this.realCtrlRefName]) {
                    clearInterval(timer);
                    for (const item of this.realCtrlTriggerLogicArray) {
                        this.$refs[this.realCtrlRefName].$on(item, (...args) => {
                            this.handleRealCtrlEvent(item, this.getData(), args);
                        });
                    }
                }
            }, 100);
        }
    }
    /**
     * 部件销毁
     *
     * @memberof ControlBase
     */
    ctrlDestroyed(args) {
        if (this.viewStateEvent) {
            this.viewStateEvent.unsubscribe();
        }
        // 销毁计数器定时器
        if (this.counterServiceArray && this.counterServiceArray.length > 0) {
            this.counterServiceArray.forEach((item) => {
                let counterService = item.service;
                if (counterService && counterService.destroyCounter && counterService.destroyCounter instanceof Function) {
                    counterService.destroyCounter();
                }
            });
        }
        // 销毁部件定时器逻辑
        this.destroyLogicTimer();
    }
    /**
     *  计数器刷新
     *
     * @memberof ControlBase
     */
    counterRefresh(arg) {
        if (this.counterServiceArray && this.counterServiceArray.length > 0) {
            this.counterServiceArray.forEach((item) => {
                let counterService = item.service;
                if (counterService && counterService.refreshCounterData && counterService.refreshCounterData instanceof Function) {
                    const tempParams = Util.deepCopy(this.viewparams);
                    if (arg && Object.keys(arg).length > 0) {
                        Object.assign(tempParams, arg);
                    }
                    counterService.refreshCounterData(this.context, tempParams);
                }
            });
        }
    }
    /**
     * 关闭视图
     *
     * @param {any} args
     * @memberof ControlBase
     */
    closeView(args) {
        this.$emit('closeView', [args]);
    }
    /**
     * 初始化计数器服务
     *
     * @memberof ControlBase
     */
    async initCounterService(param) {
        var _a, _b;
        if (!param) {
            return;
        }
        const appCounterRef = ((_a = param.getPSAppCounterRefs) === null || _a === void 0 ? void 0 : _a.call(param)) || [];
        if (appCounterRef && appCounterRef.length > 0) {
            for (const counterRef of appCounterRef) {
                const counter = (_b = counterRef.getPSAppCounter) === null || _b === void 0 ? void 0 : _b.call(counterRef);
                if (counter) {
                    await counter.fill(true);
                    const counterService = new CounterService();
                    await counterService.loaded(counter, { context: this.context, viewparams: this.viewparams });
                    const tempData = { id: counterRef.id, path: counter.modelPath, service: counterService };
                    this.counterServiceArray.push(tempData);
                }
            }
        }
    }
    /**
     * 初始化部件逻辑
     *
     * @memberof ControlBase
     */
    async initControlLogic(opts) {
        if (opts.getPSControlLogics() && opts.getPSControlLogics().length > 0) {
            this.realCtrlTriggerLogicArray = [];
            opts.getPSControlLogics().forEach((element) => {
                // 目标逻辑类型类型为实体界面逻辑、系统预置界面逻辑、前端扩展插件、脚本代码
                if (element &&
                    element.triggerType &&
                    (Object.is(element.logicType, 'DEUILOGIC') || Object.is(element.logicType, 'SYSVIEWLOGIC') || Object.is(element.logicType, 'PFPLUGIN') || Object.is(element.logicType, 'SCRIPT'))) {
                    switch (element.triggerType) {
                        case 'CUSTOM':
                            this.ctrlTriggerLogicMap.set(element.name.toLowerCase(), new AppCustomEngine(element));
                            break;
                        case 'CTRLEVENT':
                            if (element.eventNames.startsWith(this.registerEventSeparator)) {
                                this.ctrlTriggerLogicMap.set(element.eventNames.toLowerCase(), new AppCtrlEventEngine(element));
                            }
                            else {
                                if (element.eventNames.startsWith(this.realCtrlSeparator)) {
                                    let eventNames = element.eventNames.slice(this.realCtrlSeparator.length);
                                    eventNames = eventNames.replace(/_/g, '-');
                                    eventNames = `${this.realCtrlSeparator}${eventNames}`;
                                    this.ctrlTriggerLogicMap.set(eventNames.toLowerCase(), new AppCtrlEventEngine(element));
                                }
                                else {
                                    this.ctrlTriggerLogicMap.set(element.eventNames.toLowerCase(), new AppCtrlEventEngine(element));
                                }
                            }
                            break;
                        case 'TIMER':
                            this.ctrlTriggerLogicMap.set(element.name.toLowerCase(), new AppTimerEngine(element));
                            break;
                        default:
                            console.log(`${element.triggerType}类型暂未支持`);
                            break;
                    }
                }
                // 初始化原生界面触发逻辑
                if (element.eventNames && element.eventNames.startsWith(this.realCtrlSeparator)) {
                    let eventNames = element.eventNames.slice(this.realCtrlSeparator.length);
                    eventNames = eventNames.replace(/_/g, '-');
                    this.realCtrlTriggerLogicArray.push(eventNames);
                }
                // 绑定用户自定义事件
                if (element.eventNames && element.eventNames.startsWith(this.registerEventSeparator)) {
                    this.$on(element.eventNames, (...args) => {
                        this.handleCtrlCustomEvent(element.eventNames.toLowerCase(), this.getData(), args);
                    });
                }
            });
        }
    }
    /**
     * 处理自定义部件导航数据
     *
     * @memberof ControlBase
     */
    handleCustomCtrlData() {
        const customCtrlNavContexts = this.controlInstance.getPSControlNavContexts();
        const customCtrlParams = this.controlInstance.getPSControlNavParams();
        if (customCtrlNavContexts && customCtrlNavContexts.length > 0) {
            customCtrlNavContexts.forEach((item) => {
                let tempContext = {};
                let curNavContext = item;
                this.handleCustomDataLogic(curNavContext, tempContext, item.key);
                Object.assign(this.context, tempContext);
            });
        }
        if (customCtrlParams && customCtrlParams.length > 0) {
            customCtrlParams.forEach((item) => {
                let tempParam = {};
                let curNavParam = item;
                this.handleCustomDataLogic(curNavParam, tempParam, item.key);
                Object.assign(this.viewparams, tempParam);
            });
        }
    }
    /**
     * 处理部件自定义导航参数逻辑
     *
     * @memberof ControlBase
     */
    handleCustomDataLogic(curNavData, tempData, item) {
        const navDatas = Array.isArray(this.navdatas) ? this.navdatas[0] : this.navdatas;
        // 直接值直接赋值
        if (curNavData.rawValue) {
            if (Object.is(curNavData.value, 'null') || Object.is(curNavData.value, '')) {
                Object.defineProperty(tempData, item.toLowerCase(), {
                    value: null,
                    writable: true,
                    enumerable: true,
                    configurable: true,
                });
            }
            else {
                Object.defineProperty(tempData, item.toLowerCase(), {
                    value: curNavData.value,
                    writable: true,
                    enumerable: true,
                    configurable: true,
                });
            }
        }
        else {
            // 先从导航上下文取数，没有再从导航参数（URL）取数，如果导航上下文和导航参数都没有则为null
            if (this.context[curNavData.value.toLowerCase()] != null) {
                Object.defineProperty(tempData, item.toLowerCase(), {
                    value: this.context[curNavData.value.toLowerCase()],
                    writable: true,
                    enumerable: true,
                    configurable: true,
                });
                return;
            }
            else if (this.viewparams[curNavData.value.toLowerCase()] != null) {
                Object.defineProperty(tempData, item.toLowerCase(), {
                    value: this.viewparams[curNavData.value.toLowerCase()],
                    writable: true,
                    enumerable: true,
                    configurable: true,
                });
                return;
            }
            else if (navDatas[curNavData.value.toLowerCase()] != null) {
                Object.defineProperty(tempData, item.toLowerCase(), {
                    value: navDatas[curNavData.value.toLowerCase()],
                    writable: true,
                    enumerable: true,
                    configurable: true,
                });
                return;
            }
            else {
                Object.defineProperty(tempData, item.toLowerCase(), {
                    value: null,
                    writable: true,
                    enumerable: true,
                    configurable: true,
                });
            }
        }
    }
    /**
     * 重置
     *
     * @memberof ControlBase
     */
    onReset() {
        LogUtil.warn(`${this.controlInstance.name}重置功能暂未实现`);
    }
    /**
     * 执行部件事件逻辑
     *
     * @memberof ControlBase
     */
    async executeCtrlEventLogic(name, args) {
        if (this.ctrlTriggerLogicMap.get(name)) {
            await this.ctrlTriggerLogicMap.get(name).executeAsyncUILogic({ arg: args, utils: this.viewCtx, app: this.viewCtx.app, view: this.viewCtx.view, ctrl: this });
            return args;
        }
    }
    /**
     * 调用控件逻辑
     *
     * @memberof ControlBase
     */
    invoke(methodName, args) {
        if (!methodName) {
            LogUtil.warn('方法名不能为空');
            return;
        }
        if (methodName.startsWith(this.realCtrlSeparator)) {
            // 原生控件方法
            if (this.realCtrlRefName && this.$refs && this.$refs[this.realCtrlRefName]) {
                let realCtrl = this.$refs[this.realCtrlRefName];
                let realMethodName = methodName.slice(this.realCtrlSeparator.length);
                if (realCtrl[realMethodName] && realCtrl[realMethodName] instanceof Function) {
                    realCtrl[realMethodName](args);
                }
                else {
                    LogUtil.warn(`当前控件未找到指定方法${methodName}`);
                }
            }
            else {
                LogUtil.warn('原生控件未找到');
            }
        }
        else {
            // 代理层控件方法
            let proxyCtrl = this;
            if (proxyCtrl[methodName] && proxyCtrl[methodName] instanceof Function) {
                proxyCtrl[methodName](args);
            }
            else {
                LogUtil.warn(`当前控件未找到指定方法${methodName}`);
            }
        }
    }
    /**
     * 处理原生控件事件
     *
     * @memberof ControlBase
     */
    handleRealCtrlEvent(name, data, args) {
        if (this.ctrlTriggerLogicMap.get(`${this.realCtrlSeparator}${name}`)) {
            this.ctrlTriggerLogicMap.get(`${this.realCtrlSeparator}${name}`).executeAsyncUILogic({
                arg: { sender: this.$refs[this.realCtrlRefName], navContext: this.context, navParam: this.viewparams, navData: this.navdatas, data: data, args: args },
                utils: this.viewCtx,
                app: this.viewCtx.app,
                view: this.viewCtx.view,
                ctrl: this,
            });
        }
    }
    /**
     * 处理控件自定义事件
     *
     * @memberof ControlBase
     */
    handleCtrlCustomEvent(name, data, args) {
        if (this.ctrlTriggerLogicMap.get(`${name}`)) {
            this.ctrlTriggerLogicMap.get(`${name}`).executeAsyncUILogic({
                arg: { sender: this, navContext: this.context, navParam: this.viewparams, navData: this.navdatas, data: data, args: args },
                utils: this.viewCtx,
                app: this.viewCtx.app,
                view: this.viewCtx.view,
                ctrl: this,
            });
        }
    }
    /**
     * 处理部件定时器逻辑
     *
     * @memberof ControlBase
     */
    handleTimerLogic() {
        if (this.ctrlTriggerLogicMap && this.ctrlTriggerLogicMap.size > 0) {
            for (let item of this.ctrlTriggerLogicMap.values()) {
                if (item && item instanceof AppTimerEngine) {
                    item.executeAsyncUILogic({
                        arg: { sender: this, navContext: this.context, navParam: this.viewparams, navData: this.navdatas, data: this.getData() },
                        utils: this.viewCtx,
                        app: this.viewCtx.app,
                        view: this.viewCtx.view,
                        ctrl: this,
                    });
                }
            }
        }
    }
    /**
     * 销毁部件定时器逻辑
     *
     * @memberof ControlBase
     */
    destroyLogicTimer() {
        if (this.ctrlTriggerLogicMap && this.ctrlTriggerLogicMap.size > 0) {
            for (let item of this.ctrlTriggerLogicMap.values()) {
                if (item && item instanceof AppTimerEngine) {
                    item.destroyTimer();
                }
            }
        }
    }
}
__decorate([
    Prop()
], ControlBase.prototype, "staticProps", void 0);
__decorate([
    Prop()
], ControlBase.prototype, "dynamicProps", void 0);
__decorate([
    Watch('dynamicProps', {
        immediate: true,
    })
], ControlBase.prototype, "watchDynamicPropsChange", null);
__decorate([
    Watch('staticProps', {
        immediate: true,
    })
], ControlBase.prototype, "watchStaticPropsChange", null);
__decorate([
    Emit('ctrl-event')
], ControlBase.prototype, "ctrlEvent", null);
