Budibase is an open-source low-code platform for creating internal apps in minutes. Supports PostgreSQL, MySQL, MSSQL, MongoDB, Rest API, Docker, K8s 🚀
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

46 lines
1.0 KiB

export const renderComponent = ({
componentConstructor, uiFunctions,
htmlElement, anchor, parentContext,
initialProps, bb, childIndex}) => {
const func = initialProps._id
? uiFunctions[componentProps._id]
: undefined;
let component;
let componentContext;
const render = (context) => {
if(context) {
componentContext = {...componentContext};
componentContext.$parent = parentContext;
} else {
componentContext = parentContext;
}
initialProps._bb = bb(initialProps, componentContext);
component = new componentConstructor({
target: htmlElement,
props: initialProps,
hydrate:false,
anchor
});
childIndex += 1;
}
if(func) {
func(render, parentContext);
} else {
render();
}
return ({
context: componentContext,
lastChildIndex: childIndex,
component
});
}