@pronto-tools-and-more/components-renderer 8.5.0 → 8.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +3 -3
- package/src/parts/RenderCustomElement/RenderCustomElement.js +17 -0
- package/src/parts/RenderCustomElementList/RenderCustomElementList.js +20 -0
- package/src/parts/RenderCustomElementSearchResults/RenderCustomElementSearchResults.js +19 -0
- package/src/parts/RenderCustomElementUnknown/RenderCustomElementUnknown.js +6 -0
- package/src/parts/RenderElement/RenderElement.js +2 -21
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pronto-tools-and-more/components-renderer",
|
3
|
-
"version": "8.
|
3
|
+
"version": "8.7.0",
|
4
4
|
"description": "",
|
5
5
|
"main": "src/componentsRendererMain.js",
|
6
6
|
"type": "module",
|
@@ -14,8 +14,8 @@
|
|
14
14
|
"license": "MIT",
|
15
15
|
"dependencies": {
|
16
16
|
"@lvce-editor/assert": "^1.3.0",
|
17
|
-
"@lvce-editor/ipc": "^11.0
|
18
|
-
"@lvce-editor/json-rpc": "^
|
17
|
+
"@lvce-editor/ipc": "^11.1.0",
|
18
|
+
"@lvce-editor/json-rpc": "^5.0.0",
|
19
19
|
"@lvce-editor/verror": "^1.4.0",
|
20
20
|
"@swc-node/register": "^1.10.9"
|
21
21
|
},
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import * as RenderCustomElementList from "../RenderCustomElementList/RenderCustomElementList.js";
|
2
|
+
import * as RenderCustomElementSearchResults from "../RenderCustomElementSearchResults/RenderCustomElementSearchResults.js";
|
3
|
+
import * as RenderCustomElementUnknown from "../RenderCustomElementUnknown/RenderCustomElementUnknown.js";
|
4
|
+
|
5
|
+
export const renderCustomElement = (element, renderElement) => {
|
6
|
+
return (
|
7
|
+
RenderCustomElementList.renderCustomElementList(element, renderElement) ||
|
8
|
+
RenderCustomElementSearchResults.renderCustomElementSearchResults(
|
9
|
+
element,
|
10
|
+
renderElement
|
11
|
+
) ||
|
12
|
+
RenderCustomElementUnknown.renderCustomElementUnknown(
|
13
|
+
element,
|
14
|
+
renderElement
|
15
|
+
)
|
16
|
+
);
|
17
|
+
};
|
@@ -0,0 +1,20 @@
|
|
1
|
+
export const renderCustomElementList = (element, renderElement) => {
|
2
|
+
if (
|
3
|
+
element.type === "list" &&
|
4
|
+
element.class &&
|
5
|
+
element.class.includes("data-custom-list")
|
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
|
+
};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
export const renderCustomElementSearchResults = (element, renderElement) => {
|
2
|
+
if (
|
3
|
+
element.type === "list" &&
|
4
|
+
element.class &&
|
5
|
+
element.class.includes("data-custom-search-results")
|
6
|
+
) {
|
7
|
+
const { render, ...rest } = element;
|
8
|
+
const node = render({
|
9
|
+
title: "abc",
|
10
|
+
name: "abc",
|
11
|
+
description: "def",
|
12
|
+
});
|
13
|
+
const final = renderElement(node);
|
14
|
+
return {
|
15
|
+
...rest,
|
16
|
+
content: final,
|
17
|
+
};
|
18
|
+
}
|
19
|
+
};
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import * as CreateFakeSection from "../CreateFakeSection/CreateFakeSection.js";
|
2
2
|
import * as HasComplexChildren from "../HasComplexChildren/HasComplexChildren.js";
|
3
|
+
import * as RenderCustomElement from "../RenderCustomElement/RenderCustomElement.js";
|
3
4
|
|
4
5
|
export const renderElement = (element) => {
|
5
6
|
if (typeof element === "string") {
|
@@ -40,25 +41,5 @@ export const renderElement = (element) => {
|
|
40
41
|
...renderedChildren,
|
41
42
|
]);
|
42
43
|
}
|
43
|
-
|
44
|
-
element.type === "list" &&
|
45
|
-
element.class &&
|
46
|
-
element.class.includes("data-custom-list")
|
47
|
-
) {
|
48
|
-
const { render, ...rest } = element;
|
49
|
-
const node = render({
|
50
|
-
name: `$functions.id($context, 'collection-content', 'name')`,
|
51
|
-
description: `$functions.id($context, 'collection-content', 'description')`,
|
52
|
-
imageSrc: `$functions.id($context, 'collection-content', 'thumbnails', 'default')`,
|
53
|
-
});
|
54
|
-
const final = renderElement(node);
|
55
|
-
return {
|
56
|
-
...rest,
|
57
|
-
content: final,
|
58
|
-
};
|
59
|
-
}
|
60
|
-
if (element.type) {
|
61
|
-
return element;
|
62
|
-
}
|
63
|
-
return {};
|
44
|
+
return RenderCustomElement.renderCustomElement(element, renderElement);
|
64
45
|
};
|