@pronto-tools-and-more/components-renderer 10.0.0 → 10.1.0
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -3,25 +3,25 @@ import * as RenderCustomElementCollection from "../RenderCustomElementCollection
|
|
3
3
|
import * as RenderCustomElementList from "../RenderCustomElementList/RenderCustomElementList.js";
|
4
4
|
import * as RenderCustomElementSearchResults from "../RenderCustomElementSearchResults/RenderCustomElementSearchResults.js";
|
5
5
|
import * as RenderCustomElementUnknown from "../RenderCustomElementUnknown/RenderCustomElementUnknown.js";
|
6
|
+
import * as RenderCustomElementAuthorList from "../RenderCustomElementAuthorList/RenderCustomElementAuthorList.js";
|
7
|
+
|
8
|
+
const renderers = [
|
9
|
+
RenderCustomElementAuthorList.renderCustomElementAuthorList,
|
10
|
+
RenderCustomElementCategoryList.renderCustomElementCategoryList,
|
11
|
+
RenderCustomElementCollection.renderCustomElementCollection,
|
12
|
+
RenderCustomElementList.renderCustomElementList,
|
13
|
+
RenderCustomElementSearchResults.renderCustomElementSearchResults,
|
14
|
+
];
|
6
15
|
|
7
16
|
export const renderCustomElement = (element, renderElement) => {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
) ||
|
18
|
-
RenderCustomElementSearchResults.renderCustomElementSearchResults(
|
19
|
-
element,
|
20
|
-
renderElement
|
21
|
-
) ||
|
22
|
-
RenderCustomElementUnknown.renderCustomElementUnknown(
|
23
|
-
element,
|
24
|
-
renderElement
|
25
|
-
)
|
17
|
+
for (const renderer of renderers) {
|
18
|
+
const result = renderer(element, renderElement);
|
19
|
+
if (result) {
|
20
|
+
return result;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
return RenderCustomElementUnknown.renderCustomElementUnknown(
|
24
|
+
element,
|
25
|
+
renderElement
|
26
26
|
);
|
27
27
|
};
|
@@ -0,0 +1,22 @@
|
|
1
|
+
export const renderCustomElementAuthorList = (element, renderElement) => {
|
2
|
+
if (
|
3
|
+
element.type === "list" &&
|
4
|
+
element.class &&
|
5
|
+
element.class.includes("data-custom-author-list")
|
6
|
+
) {
|
7
|
+
const { render, ...rest } = element;
|
8
|
+
const node = render({
|
9
|
+
id: `$functions.id($context, 'context', 'id')`,
|
10
|
+
name: `$functions.id($context, 'context', 'name')`,
|
11
|
+
type: `$functions.id($context, 'context', 'type')`,
|
12
|
+
language: `$functions.id($context, 'context', 'properties', 'lang')`,
|
13
|
+
imageSrc: `$functions.id($context, 'context', 'properties', 'thumbnails', 'default')`,
|
14
|
+
});
|
15
|
+
const final = renderElement(node);
|
16
|
+
return {
|
17
|
+
...rest,
|
18
|
+
content: final,
|
19
|
+
};
|
20
|
+
}
|
21
|
+
return undefined;
|
22
|
+
};
|
@@ -11,7 +11,15 @@ export const renderCustomElementCategoryList = (element, renderElement) => {
|
|
11
11
|
type: `$functions.id($context, 'context', 'type')`,
|
12
12
|
language: `$functions.id($context, 'context', 'properties', 'lang')`,
|
13
13
|
});
|
14
|
-
const
|
14
|
+
const condition = {
|
15
|
+
value: "$context.context.type",
|
16
|
+
operation: "EQUALS",
|
17
|
+
compareValue: "category",
|
18
|
+
};
|
19
|
+
const final = {
|
20
|
+
...renderElement(node),
|
21
|
+
condition,
|
22
|
+
};
|
15
23
|
return {
|
16
24
|
...rest,
|
17
25
|
content: final,
|