UNPKG

fastlion-amis

Version:

一种MIS页面生成工具

41 lines (40 loc) 1.65 kB
"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, _c, _d; return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { var component; return (0, tslib_1.__generator)(this, function (_e) { switch (_e.label) { case 0: component = renderer.props.$schema.id !== action.componentId ? (_a = event.context.scoped) === null || _a === void 0 ? void 0 : _a.getComponentById(action.componentId) : renderer; return [4 /*yield*/, ((_c = (_b = component.props).onAction) === null || _c === void 0 ? void 0 : _c.call(_b, event, action, action.args))]; case 1: // 执行组件动作 (_e.sent()) || ((_d = component.doAction) === null || _d === void 0 ? void 0 : _d.call(component, action, action.args)); return [2 /*return*/]; } }); }); }; return CmptAction; }()); exports.CmptAction = CmptAction; (0, Action_1.registerAction)('component', new CmptAction()); //# sourceMappingURL=./actions/CmptAction.js.map