@gravity-ui/page-constructor 1.15.0-alpha.14 → 1.15.0-alpha.15
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.
|
@@ -6,10 +6,10 @@ const react_1 = tslib_1.__importStar(require("react"));
|
|
|
6
6
|
const innerContext_1 = require("../../../../context/innerContext");
|
|
7
7
|
const ConstructorItem = ({ data, children, context = '', }) => {
|
|
8
8
|
const { itemMap } = (0, react_1.useContext)(innerContext_1.InnerContext);
|
|
9
|
-
const { type } = data;
|
|
10
|
-
const localContext = context
|
|
9
|
+
const { type } = data, rest = tslib_1.__rest(data, ["type"]);
|
|
10
|
+
const localContext = context ? `${context}_${type}` : type;
|
|
11
11
|
const Component = itemMap[type];
|
|
12
|
-
return (react_1.default.createElement(Component, Object.assign({},
|
|
12
|
+
return (react_1.default.createElement(Component, Object.assign({}, rest, { context: localContext }), children));
|
|
13
13
|
};
|
|
14
14
|
exports.ConstructorItem = ConstructorItem;
|
|
15
15
|
const ConstructorHeader = ({ data }) => (react_1.default.createElement(exports.ConstructorItem, { data: data, key: data.type }));
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
1
2
|
import React, { useContext } from 'react';
|
|
2
3
|
import { InnerContext } from '../../../../context/innerContext';
|
|
3
4
|
export const ConstructorItem = ({ data, children, context = '', }) => {
|
|
4
5
|
const { itemMap } = useContext(InnerContext);
|
|
5
|
-
const { type } = data;
|
|
6
|
-
const localContext = context
|
|
6
|
+
const { type } = data, rest = __rest(data, ["type"]);
|
|
7
|
+
const localContext = context ? `${context}_${type}` : type;
|
|
7
8
|
const Component = itemMap[type];
|
|
8
|
-
return (React.createElement(Component, Object.assign({},
|
|
9
|
+
return (React.createElement(Component, Object.assign({}, rest, { context: localContext }), children));
|
|
9
10
|
};
|
|
10
11
|
export const ConstructorHeader = ({ data }) => (React.createElement(ConstructorItem, { data: data, key: data.type }));
|