@alilc/lowcode-renderer-core
Version:
renderer core
43 lines • 1.79 kB
JavaScript
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import baseRendererFactory from './base';
export default function blockRendererFactory() {
var _BlockRenderer;
var BaseRenderer = baseRendererFactory();
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;
}
_inheritsLoose(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;
}