@alilc/lowcode-rax-renderer
Version:
Rax renderer for Ali lowCode engine
48 lines (47 loc) • 2.04 kB
JavaScript
exports.__esModule = true;
exports.default = void 0;
var _lowcodeRendererCore = require("@alilc/lowcode-renderer-core");
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var raxComponentRendererFactory = function () {
var OriginComponent = (0, _lowcodeRendererCore.componentRendererFactory)();
return /*#__PURE__*/function (_OriginComponent) {
_inheritsLoose(ComponentRenderer, _OriginComponent);
function ComponentRenderer() {
return _OriginComponent.apply(this, arguments) || this;
}
var _proto = ComponentRenderer.prototype;
_proto.render = function render() {
// @ts-ignore
var that = this;
var _that$props = that.props,
__schema = _that$props.__schema,
__components = _that$props.__components;
if (that.__checkSchema(__schema)) {
return '自定义组件 schema 结构异常!';
}
that.__debug("render - " + __schema.fileName);
var _that$__parseData = that.__parseData(__schema.props),
noContainer = _that$__parseData.noContainer;
var content = that.__renderContextConsumer(function children(context) {
that.context = context;
that.__generateCtx({
component: that
});
that.__render();
// 传 null,使用内置的 div 来渲染,解决在页面中渲染 vc-component 报错的问题
return that.__renderComp(null, {
compContext: that,
blockContext: that
});
});
if (noContainer) {
return content;
}
return that.__renderContent(content);
};
return ComponentRenderer;
}(OriginComponent);
};
var _default = exports.default = raxComponentRendererFactory;
;