@pronto-tools-and-more/components-renderer 5.4.0 → 5.6.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pronto-tools-and-more/components-renderer",
3
- "version": "5.4.0",
3
+ "version": "5.6.0",
4
4
  "description": "",
5
5
  "main": "src/componentsRendererMain.js",
6
6
  "type": "module",
@@ -13,23 +13,26 @@ export const renderElement = (element) => {
13
13
  if (typeof element.tag === "function") {
14
14
  const vnode = element.tag({
15
15
  ...element.props,
16
- children: element.children,
17
16
  });
18
- return renderElement(vnode);
17
+ const rendered = renderElement(vnode);
18
+ return rendered;
19
19
  }
20
20
  const hasComplexChildren = HasComplexChildren.hasComplexChildren(element);
21
21
  const renderedChildren = hasComplexChildren
22
22
  ? element.children.map(renderElement)
23
23
  : [];
24
24
  const content = hasComplexChildren ? "" : element.children[0] || "";
25
- const className =
26
- element.props && element.props.className
27
- ? element.props.className
28
- : undefined;
25
+ const props = element.props ? element.props : {};
26
+ const { className, ...rest } = props;
27
+ let attributes;
28
+ if (Object.keys(rest).length > 0) {
29
+ attributes = rest;
30
+ }
29
31
  return CreateFakeSection.createFakeSection([
30
32
  {
31
33
  type: "html",
32
34
  tag: element.tag,
35
+ attributes,
33
36
  class: className,
34
37
  content,
35
38
  },