UNPKG

@alilc/lowcode-renderer-core

Version:
48 lines (47 loc) 2 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); exports.__esModule = true; exports["default"] = blockRendererFactory; var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose")); var _base = _interopRequireDefault(require("./base")); function blockRendererFactory() { var _BlockRenderer; var BaseRenderer = (0, _base["default"])(); return _BlockRenderer = /*#__PURE__*/function (_BaseRenderer) { function BlockRenderer() { var _this; for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _BaseRenderer.call.apply(_BaseRenderer, [this].concat(args)) || this; _this.__namespace = 'block'; return _this; } (0, _inheritsLoose2["default"])(BlockRenderer, _BaseRenderer); var _proto = BlockRenderer.prototype; _proto.__afterInit = function __afterInit(props) { this.__generateCtx({}); var schema = props.__schema || {}; this.state = this.__parseData(schema.state || {}); this.__initDataSource(props); this.__executeLifeCycleMethod('constructor', Array.prototype.slice.call(arguments)); }; _proto.render = function render() { var _this$props = this.props, __schema = _this$props.__schema, __components = _this$props.__components; if (this.__checkSchema(__schema, 'Div')) { return '区块 schema 结构异常!'; } this.__debug(BlockRenderer.displayName + " render - " + (__schema === null || __schema === void 0 ? void 0 : __schema.fileName)); this.__generateCtx({}); this.__render(); var Block = __components.Block; if (Block) { return this.__renderComp(Block, {}); } return this.__renderContent(this.__renderContextProvider()); }; return BlockRenderer; }(BaseRenderer), _BlockRenderer.displayName = 'BlockRenderer', _BlockRenderer; }