|
|
|
@ -30,34 +30,33 @@ export const attachChildren = initialiseOpts => (htmlElement, options) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const contextArray = Array.isArray(context) ? context : [context] |
|
|
|
|
|
|
|
const childNodes = [] |
|
|
|
for (let childProps of treeNode.props._children) { |
|
|
|
const { componentName, libName } = splitName(childProps._component) |
|
|
|
|
|
|
|
if (!componentName || !libName) return |
|
|
|
for (let context of contextArray) { |
|
|
|
for (let childProps of treeNode.props._children) { |
|
|
|
const { componentName, libName } = splitName(childProps._component) |
|
|
|
|
|
|
|
const ComponentConstructor = componentLibraries[libName][componentName] |
|
|
|
if (!componentName || !libName) return |
|
|
|
|
|
|
|
const prepareNodes = ctx => { |
|
|
|
const childNodesThisIteration = prepareRenderComponent({ |
|
|
|
props: childProps, |
|
|
|
parentNode: treeNode, |
|
|
|
ComponentConstructor, |
|
|
|
htmlElement, |
|
|
|
anchor, |
|
|
|
context: ctx, |
|
|
|
}) |
|
|
|
const ComponentConstructor = componentLibraries[libName][componentName] |
|
|
|
|
|
|
|
for (let childNode of childNodesThisIteration) { |
|
|
|
childNodes.push(childNode) |
|
|
|
} |
|
|
|
} |
|
|
|
const prepareNodes = ctx => { |
|
|
|
const childNodesThisIteration = prepareRenderComponent({ |
|
|
|
props: childProps, |
|
|
|
parentNode: treeNode, |
|
|
|
ComponentConstructor, |
|
|
|
htmlElement, |
|
|
|
anchor, |
|
|
|
context: ctx, |
|
|
|
}) |
|
|
|
|
|
|
|
if (Array.isArray(context)) { |
|
|
|
for (let singleCtx of context) { |
|
|
|
prepareNodes(singleCtx) |
|
|
|
for (let childNode of childNodesThisIteration) { |
|
|
|
childNodes.push(childNode) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
prepareNodes(context) |
|
|
|
} |
|
|
|
} |
|
|
|
|