@gravity-ui/page-constructor 1.20.2 → 1.20.4
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.20.4](https://github.com/gravity-ui/page-constructor/compare/v1.20.3...v1.20.4) (2023-03-03)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* add unique key to BlockIdContext ([#199](https://github.com/gravity-ui/page-constructor/issues/199)) ([05b0a88](https://github.com/gravity-ui/page-constructor/commit/05b0a88fe9b996d7728afa49ade3a0a5cae85713))
|
|
9
|
+
|
|
10
|
+
## [1.20.3](https://github.com/gravity-ui/page-constructor/compare/v1.20.2...v1.20.3) (2023-03-02)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* add uniqueness to children key prop ([#192](https://github.com/gravity-ui/page-constructor/issues/192)) ([8cbb720](https://github.com/gravity-ui/page-constructor/commit/8cbb720a4e60ccab8a3440141b3e4f5998c26a9b))
|
|
16
|
+
|
|
3
17
|
## [1.20.2](https://github.com/gravity-ui/page-constructor/compare/v1.20.1...v1.20.2) (2023-03-01)
|
|
4
18
|
|
|
5
19
|
|
package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js
CHANGED
|
@@ -20,7 +20,7 @@ const ConstructorBlocks = ({ items, shouldRenderBlock }) => {
|
|
|
20
20
|
let itemElement;
|
|
21
21
|
const key = (0, utils_1.getBlockKey)(item, index);
|
|
22
22
|
const blockId = parentId ? `${parentId}_${key}` : key;
|
|
23
|
-
if (shouldRenderBlock && !shouldRenderBlock(item,
|
|
23
|
+
if (shouldRenderBlock && !shouldRenderBlock(item, blockId)) {
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
26
|
if ('loadable' in item && item.loadable) {
|
|
@@ -29,16 +29,16 @@ const ConstructorBlocks = ({ items, shouldRenderBlock }) => {
|
|
|
29
29
|
if (!config) {
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
|
-
itemElement = (react_1.default.createElement(ConstructorLoadable_1.ConstructorLoadable, { block: item, key:
|
|
32
|
+
itemElement = (react_1.default.createElement(ConstructorLoadable_1.ConstructorLoadable, { block: item, key: blockId, blockKey: blockId, config: config, serviceId: serviceId, params: params }));
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
35
|
if ('children' in item && item.children) {
|
|
36
36
|
children = item.children.map(renderer.bind(null, blockId));
|
|
37
37
|
}
|
|
38
|
-
itemElement = (react_1.default.createElement(blockIdContext_1.BlockIdContext.Provider, { value: blockId },
|
|
39
|
-
react_1.default.createElement(ConstructorItem_1.ConstructorItem, { data: item
|
|
38
|
+
itemElement = (react_1.default.createElement(blockIdContext_1.BlockIdContext.Provider, { value: blockId, key: blockId },
|
|
39
|
+
react_1.default.createElement(ConstructorItem_1.ConstructorItem, { data: item }, children)));
|
|
40
40
|
}
|
|
41
|
-
return blockTypes.includes(item.type) ? (react_1.default.createElement(ConstructorBlock_1.ConstructorBlock, { data: item, key:
|
|
41
|
+
return blockTypes.includes(item.type) ? (react_1.default.createElement(ConstructorBlock_1.ConstructorBlock, { data: item, key: blockId, Component: itemElement })) : (itemElement);
|
|
42
42
|
};
|
|
43
43
|
return react_1.default.createElement(react_1.Fragment, null, items.map(renderer.bind(null, '')));
|
|
44
44
|
};
|
package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js
CHANGED
|
@@ -16,7 +16,7 @@ export const ConstructorBlocks = ({ items, shouldRenderBlock }) => {
|
|
|
16
16
|
let itemElement;
|
|
17
17
|
const key = getBlockKey(item, index);
|
|
18
18
|
const blockId = parentId ? `${parentId}_${key}` : key;
|
|
19
|
-
if (shouldRenderBlock && !shouldRenderBlock(item,
|
|
19
|
+
if (shouldRenderBlock && !shouldRenderBlock(item, blockId)) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
22
|
if ('loadable' in item && item.loadable) {
|
|
@@ -25,16 +25,16 @@ export const ConstructorBlocks = ({ items, shouldRenderBlock }) => {
|
|
|
25
25
|
if (!config) {
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
|
-
itemElement = (React.createElement(ConstructorLoadable, { block: item, key:
|
|
28
|
+
itemElement = (React.createElement(ConstructorLoadable, { block: item, key: blockId, blockKey: blockId, config: config, serviceId: serviceId, params: params }));
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
31
|
if ('children' in item && item.children) {
|
|
32
32
|
children = item.children.map(renderer.bind(null, blockId));
|
|
33
33
|
}
|
|
34
|
-
itemElement = (React.createElement(BlockIdContext.Provider, { value: blockId },
|
|
35
|
-
React.createElement(ConstructorItem, { data: item
|
|
34
|
+
itemElement = (React.createElement(BlockIdContext.Provider, { value: blockId, key: blockId },
|
|
35
|
+
React.createElement(ConstructorItem, { data: item }, children)));
|
|
36
36
|
}
|
|
37
|
-
return blockTypes.includes(item.type) ? (React.createElement(ConstructorBlock, { data: item, key:
|
|
37
|
+
return blockTypes.includes(item.type) ? (React.createElement(ConstructorBlock, { data: item, key: blockId, Component: itemElement })) : (itemElement);
|
|
38
38
|
};
|
|
39
39
|
return React.createElement(Fragment, null, items.map(renderer.bind(null, '')));
|
|
40
40
|
};
|