@pronto-tools-and-more/components-renderer 8.18.0 → 8.20.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": "8.18.0",
3
+ "version": "8.20.0",
4
4
  "description": "",
5
5
  "main": "src/componentsRendererMain.js",
6
6
  "type": "module",
@@ -1,9 +1,14 @@
1
1
  import * as RenderCustomElementList from "../RenderCustomElementList/RenderCustomElementList.js";
2
2
  import * as RenderCustomElementSearchResults from "../RenderCustomElementSearchResults/RenderCustomElementSearchResults.js";
3
3
  import * as RenderCustomElementUnknown from "../RenderCustomElementUnknown/RenderCustomElementUnknown.js";
4
+ import * as RenderCustomElementCollection from "../RenderCustomElementCollection/RenderCustomElementCollection.js";
4
5
 
5
6
  export const renderCustomElement = (element, renderElement) => {
6
7
  return (
8
+ RenderCustomElementCollection.renderCustomElementCollection(
9
+ element,
10
+ renderElement
11
+ ) ||
7
12
  RenderCustomElementList.renderCustomElementList(element, renderElement) ||
8
13
  RenderCustomElementSearchResults.renderCustomElementSearchResults(
9
14
  element,
@@ -0,0 +1,20 @@
1
+ export const renderCustomElementCollection = (element, renderElement) => {
2
+ if (
3
+ element.type === "list" &&
4
+ element.class &&
5
+ element.class.includes("data-custom-collection")
6
+ ) {
7
+ const { render, ...rest } = element;
8
+ const node = render({
9
+ name: `$functions.id($context, 'collection-content', 'name')`,
10
+ description: `$functions.id($context, 'collection-content', 'description')`,
11
+ imageSrc: `$functions.id($context, 'collection-content', 'thumbnails', 'default')`,
12
+ });
13
+ const final = renderElement(node);
14
+ return {
15
+ ...rest,
16
+ content: final,
17
+ };
18
+ }
19
+ return undefined;
20
+ };
@@ -6,9 +6,9 @@ export const renderCustomElementList = (element, renderElement) => {
6
6
  ) {
7
7
  const { render, ...rest } = element;
8
8
  const node = render({
9
- name: `$functions.id($context, 'collection-content', 'name')`,
10
- description: `$functions.id($context, 'collection-content', 'description')`,
11
- imageSrc: `$functions.id($context, 'collection-content', 'thumbnails', 'default')`,
9
+ name: `$functions.id($context, 'content', 'name')`,
10
+ description: `$functions.id($context, 'content', 'description')`,
11
+ imageSrc: `$functions.id($context, 'content', 'thumbnails', 'default')`,
12
12
  });
13
13
  const final = renderElement(node);
14
14
  return {