"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CmptAction = void 0;
var tslib_1 = require("tslib");
var Action_1 = require("./Action");
/**
 * 组件动作
 *
 * @export
 * @class CmptAction
 * @implements {Action}
 */
var CmptAction = /** @class */ (function () {
    function CmptAction() {
    }
    CmptAction.prototype.run = function (action, renderer, event) {
        var _a, _b;
        return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
            var component;
            return (0, tslib_1.__generator)(this, function (_c) {
                component = action.componentId && renderer.props.$schema.id !== action.componentId
                    ? (_a = event.context.scoped) === null || _a === void 0 ? void 0 : _a.getComponentById(action.componentId)
                    : renderer;
                // 执行组件动作
                return [2 /*return*/, (_b = component.doAction) === null || _b === void 0 ? void 0 : _b.call(component, action, action.args)];
            });
        });
    };
    return CmptAction;
}());
exports.CmptAction = CmptAction;
(0, Action_1.registerAction)('component', new CmptAction());
//# sourceMappingURL=./actions/CmptAction.js.map
