@pronto-tools-and-more/components-renderer 10.0.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,30 @@
|
|
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 condition = {
|
16
|
+
value: "$context.context.type",
|
17
|
+
operation: "EQUALS",
|
18
|
+
compareValue: "author",
|
19
|
+
};
|
20
|
+
const final = {
|
21
|
+
...renderElement(node),
|
22
|
+
condition,
|
23
|
+
};
|
24
|
+
return {
|
25
|
+
...rest,
|
26
|
+
content: final,
|
27
|
+
};
|
28
|
+
}
|
29
|
+
return undefined;
|
30
|
+
};
|
@@ -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,
|