@gravity-ui/page-constructor 5.12.0 → 5.14.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/build/cjs/blocks/ContentLayout/schema.d.ts +4 -0
- package/build/cjs/blocks/Form/schema.d.ts +4 -0
- package/build/cjs/blocks/Info/schema.d.ts +8 -0
- package/build/cjs/blocks/Map/schema.d.ts +4 -0
- package/build/cjs/blocks/Media/schema.d.ts +8 -0
- package/build/cjs/blocks/Questions/schema.d.ts +4 -0
- package/build/cjs/blocks/Tabs/schema.d.ts +4 -0
- package/build/cjs/components/IconWrapper/IconWrapper.css +4 -2
- package/build/cjs/components/IconWrapper/IconWrapper.d.ts +2 -2
- package/build/cjs/components/IconWrapper/IconWrapper.js +3 -3
- package/build/cjs/constructor-items.d.ts +1 -1
- package/build/cjs/editor/components/AddBlock/AddBlock.css +1 -2
- package/build/cjs/editor/components/CodeEditor/CodeEditor.css +3 -1
- package/build/cjs/editor/components/ControlPanel/ControlPanel.css +2 -4
- package/build/cjs/editor/components/ControlPanel/ControlPanel.d.ts +4 -2
- package/build/cjs/editor/components/ControlPanel/ControlPanel.js +24 -15
- package/build/cjs/editor/components/ControlPanel/i18n/en.json +2 -1
- package/build/cjs/editor/components/ControlPanel/i18n/index.d.ts +1 -1
- package/build/cjs/editor/components/ControlPanel/i18n/ru.json +2 -1
- package/build/cjs/editor/components/Layout/Layout.css +10 -6
- package/build/cjs/editor/components/Layout/Layout.d.ts +4 -7
- package/build/cjs/editor/components/Layout/Layout.js +8 -10
- package/build/cjs/editor/components/PageSettings/PageSettings.css +26 -0
- package/build/cjs/editor/components/PageSettings/PageSettings.d.ts +11 -0
- package/build/cjs/editor/components/PageSettings/PageSettings.js +30 -0
- package/build/cjs/editor/components/PageSettings/i18n/en.json +3 -0
- package/build/cjs/editor/components/PageSettings/i18n/index.d.ts +1 -0
- package/build/cjs/editor/components/PageSettings/i18n/index.js +9 -0
- package/build/cjs/editor/components/PageSettings/i18n/ru.json +3 -0
- package/build/cjs/editor/containers/Editor/Editor.css +17 -0
- package/build/cjs/editor/containers/Editor/Editor.d.ts +1 -1
- package/build/cjs/editor/containers/Editor/Editor.js +17 -65
- package/build/cjs/editor/containers/Editor/hooks/useCode.d.ts +14 -0
- package/build/cjs/editor/containers/{Form/hooks.js → Editor/hooks/useCode.js} +4 -14
- package/build/cjs/editor/containers/Editor/hooks/useEditorState.d.ts +49 -0
- package/build/cjs/editor/containers/Editor/hooks/useEditorState.js +99 -0
- package/build/cjs/editor/containers/Form/Form.css +0 -10
- package/build/cjs/editor/containers/Form/Form.d.ts +1 -8
- package/build/cjs/editor/containers/Form/Form.js +14 -39
- package/build/cjs/editor/store/main/index.js +1 -1
- package/build/cjs/editor/store/settings/index.d.ts +3 -3
- package/build/cjs/editor/store/settings/index.js +4 -4
- package/build/cjs/editor/store/settings/reducer.d.ts +9 -9
- package/build/cjs/editor/store/settings/reducer.js +6 -6
- package/build/cjs/editor/types/index.d.ts +3 -4
- package/build/cjs/editor/types/index.js +7 -8
- package/build/cjs/models/constructor-items/blocks.d.ts +1 -0
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +3 -3
- package/build/cjs/schema/constants.d.ts +4 -0
- package/build/cjs/schema/validators/common.d.ts +6 -0
- package/build/cjs/schema/validators/common.js +8 -1
- package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.css +3 -6
- package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +2 -5
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -2
- package/build/cjs/sub-blocks/BasicCard/BasicCard.css +4 -4
- package/build/cjs/sub-blocks/BasicCard/BasicCard.js +3 -6
- package/build/cjs/sub-blocks/BasicCard/schema.js +2 -2
- package/build/cjs/sub-blocks/Content/Content.css +11 -0
- package/build/cjs/sub-blocks/Content/Content.js +2 -2
- package/build/cjs/sub-blocks/Content/schema.d.ts +8 -0
- package/build/cjs/sub-blocks/Content/schema.js +4 -0
- package/build/cjs/sub-blocks/ImageCard/ImageCard.css +2 -0
- package/build/cjs/sub-blocks/ImageCard/ImageCard.js +4 -2
- package/build/cjs/sub-blocks/ImageCard/schema.d.ts +4 -0
- package/build/cjs/sub-blocks/ImageCard/schema.js +2 -2
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.css +3 -2
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +4 -6
- package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +4 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.js +1 -4
- package/build/esm/blocks/ContentLayout/schema.d.ts +4 -0
- package/build/esm/blocks/Form/schema.d.ts +4 -0
- package/build/esm/blocks/Info/schema.d.ts +8 -0
- package/build/esm/blocks/Map/schema.d.ts +4 -0
- package/build/esm/blocks/Media/schema.d.ts +8 -0
- package/build/esm/blocks/Questions/schema.d.ts +4 -0
- package/build/esm/blocks/Tabs/schema.d.ts +4 -0
- package/build/esm/components/IconWrapper/IconWrapper.css +4 -2
- package/build/esm/components/IconWrapper/IconWrapper.d.ts +2 -2
- package/build/esm/components/IconWrapper/IconWrapper.js +3 -3
- package/build/esm/constructor-items.d.ts +1 -1
- package/build/esm/editor/components/AddBlock/AddBlock.css +1 -2
- package/build/esm/editor/components/CodeEditor/CodeEditor.css +3 -1
- package/build/esm/editor/components/ControlPanel/ControlPanel.css +2 -4
- package/build/esm/editor/components/ControlPanel/ControlPanel.d.ts +4 -2
- package/build/esm/editor/components/ControlPanel/ControlPanel.js +26 -17
- package/build/esm/editor/components/ControlPanel/i18n/en.json +2 -1
- package/build/esm/editor/components/ControlPanel/i18n/index.d.ts +1 -1
- package/build/esm/editor/components/ControlPanel/i18n/ru.json +2 -1
- package/build/esm/editor/components/Layout/Layout.css +10 -6
- package/build/esm/editor/components/Layout/Layout.d.ts +4 -7
- package/build/esm/editor/components/Layout/Layout.js +9 -11
- package/build/esm/editor/components/PageSettings/PageSettings.css +26 -0
- package/build/esm/editor/components/PageSettings/PageSettings.d.ts +12 -0
- package/build/esm/editor/components/PageSettings/PageSettings.js +27 -0
- package/build/esm/editor/components/PageSettings/i18n/en.json +3 -0
- package/build/esm/editor/components/PageSettings/i18n/index.d.ts +1 -0
- package/build/esm/editor/components/PageSettings/i18n/index.js +5 -0
- package/build/esm/editor/components/PageSettings/i18n/ru.json +3 -0
- package/build/esm/editor/containers/Editor/Editor.css +17 -0
- package/build/esm/editor/containers/Editor/Editor.d.ts +2 -1
- package/build/esm/editor/containers/Editor/Editor.js +18 -66
- package/build/esm/editor/containers/Editor/hooks/useCode.d.ts +14 -0
- package/build/esm/editor/containers/{Form/hooks.js → Editor/hooks/useCode.js} +4 -14
- package/build/esm/editor/containers/Editor/hooks/useEditorState.d.ts +49 -0
- package/build/esm/editor/containers/Editor/hooks/useEditorState.js +95 -0
- package/build/esm/editor/containers/Form/Form.css +0 -10
- package/build/esm/editor/containers/Form/Form.d.ts +1 -8
- package/build/esm/editor/containers/Form/Form.js +16 -42
- package/build/esm/editor/store/main/index.js +1 -1
- package/build/esm/editor/store/settings/index.d.ts +3 -3
- package/build/esm/editor/store/settings/index.js +5 -5
- package/build/esm/editor/store/settings/reducer.d.ts +9 -9
- package/build/esm/editor/store/settings/reducer.js +6 -6
- package/build/esm/editor/types/index.d.ts +3 -4
- package/build/esm/editor/types/index.js +6 -7
- package/build/esm/models/constructor-items/blocks.d.ts +1 -0
- package/build/esm/models/constructor-items/sub-blocks.d.ts +3 -3
- package/build/esm/schema/constants.d.ts +4 -0
- package/build/esm/schema/validators/common.d.ts +6 -0
- package/build/esm/schema/validators/common.js +6 -0
- package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.css +3 -6
- package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +3 -6
- package/build/esm/sub-blocks/BackgroundCard/schema.js +3 -3
- package/build/esm/sub-blocks/BasicCard/BasicCard.css +4 -4
- package/build/esm/sub-blocks/BasicCard/BasicCard.js +4 -7
- package/build/esm/sub-blocks/BasicCard/schema.js +3 -3
- package/build/esm/sub-blocks/Content/Content.css +11 -0
- package/build/esm/sub-blocks/Content/Content.js +2 -2
- package/build/esm/sub-blocks/Content/schema.d.ts +8 -0
- package/build/esm/sub-blocks/Content/schema.js +4 -0
- package/build/esm/sub-blocks/ImageCard/ImageCard.css +2 -0
- package/build/esm/sub-blocks/ImageCard/ImageCard.js +4 -2
- package/build/esm/sub-blocks/ImageCard/schema.d.ts +4 -0
- package/build/esm/sub-blocks/ImageCard/schema.js +3 -3
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.css +3 -2
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +5 -7
- package/build/esm/sub-blocks/LayoutItem/schema.d.ts +4 -0
- package/build/esm/sub-blocks/LayoutItem/schema.js +2 -5
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +1 -0
- package/server/models/constructor-items/sub-blocks.d.ts +3 -3
- package/widget/index.js +1 -1
- package/build/cjs/editor/components/PagePropsForm/PagePropsForm.d.ts +0 -10
- package/build/cjs/editor/components/PagePropsForm/PagePropsForm.js +0 -17
- package/build/cjs/editor/containers/Form/hooks.d.ts +0 -8
- package/build/esm/editor/components/PagePropsForm/PagePropsForm.d.ts +0 -10
- package/build/esm/editor/components/PagePropsForm/PagePropsForm.js +0 -13
- package/build/esm/editor/containers/Form/hooks.d.ts +0 -8
|
@@ -13,12 +13,9 @@ const BasicCard = (props) => {
|
|
|
13
13
|
const titleId = (0, uikit_1.useUniqId)();
|
|
14
14
|
const descriptionId = (0, uikit_1.useUniqId)();
|
|
15
15
|
const areControlsInFooter = controlPosition === 'footer';
|
|
16
|
-
return (react_1.default.createElement(components_1.CardBase, Object.assign({ className: b() }, cardParams, { extraProps: { 'aria-describedby': descriptionId, 'aria-labelledby': titleId } }),
|
|
16
|
+
return (react_1.default.createElement(components_1.CardBase, Object.assign({ className: b(), contentClassName: b('content') }, cardParams, { extraProps: { 'aria-describedby': descriptionId, 'aria-labelledby': titleId } }),
|
|
17
17
|
react_1.default.createElement(components_1.CardBase.Content, null,
|
|
18
|
-
react_1.default.createElement(components_1.IconWrapper, { icon: icon ? { value: icon, position: iconPosition } : undefined },
|
|
19
|
-
react_1.default.createElement(Content_1.default, { title: title, titleId: titleId, text: text, textId: descriptionId, additionalInfo: additionalInfo, links:
|
|
20
|
-
areControlsInFooter && (buttons || links) && (react_1.default.createElement(components_1.CardBase.Footer, { className: b('footer') },
|
|
21
|
-
react_1.default.createElement(components_1.Links, { className: b('links'), size: "s", links: links, titleId: titleId }),
|
|
22
|
-
react_1.default.createElement(components_1.Buttons, { className: b('buttons'), size: "s", buttons: buttons, titleId: titleId })))));
|
|
18
|
+
react_1.default.createElement(components_1.IconWrapper, { icon: icon ? { value: icon, position: iconPosition } : undefined, className: b('wrapper') },
|
|
19
|
+
react_1.default.createElement(Content_1.default, { title: title, titleId: titleId, text: text, textId: descriptionId, additionalInfo: additionalInfo, links: links, list: list, buttons: buttons, size: "s", colSizes: { all: 12, md: 12 }, controlPosition: areControlsInFooter ? 'bottom' : 'default' })))));
|
|
23
20
|
};
|
|
24
21
|
exports.default = BasicCard;
|
|
@@ -6,12 +6,12 @@ const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
|
6
6
|
const schema_1 = require("../../components/Image/schema");
|
|
7
7
|
const common_1 = require("../../schema/validators/common");
|
|
8
8
|
const schema_2 = require("../Content/schema");
|
|
9
|
-
const BasicCardContentProps = (0, omit_1.default)(schema_2.ContentBase, ['size', 'theme']);
|
|
9
|
+
const BasicCardContentProps = (0, omit_1.default)(schema_2.ContentBase, ['size', 'theme', 'controlPosition']);
|
|
10
10
|
exports.BasicCard = {
|
|
11
11
|
'basic-card': {
|
|
12
12
|
additionalProperties: false,
|
|
13
13
|
required: [],
|
|
14
|
-
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), common_1.CardBase), BasicCardContentProps), { url: {
|
|
14
|
+
properties: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), common_1.CardBase), common_1.CardLayoutProps), BasicCardContentProps), { url: {
|
|
15
15
|
type: 'string',
|
|
16
16
|
}, urlTitle: {
|
|
17
17
|
type: 'string',
|
|
@@ -9,6 +9,8 @@ unpredictable css rules order in build */
|
|
|
9
9
|
--pc-monochrome-button-background-color: #262626;
|
|
10
10
|
--pc-monochrome-button-background-color-hover: #393939;
|
|
11
11
|
--pc-monochrome-button-color: var(--g-color-text-light-primary);
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
12
14
|
}
|
|
13
15
|
.pc-content__notice .yfm ol,
|
|
14
16
|
.pc-content__notice .yfm ul, .pc-content__text .yfm ol,
|
|
@@ -145,4 +147,13 @@ unpredictable css rules order in build */
|
|
|
145
147
|
}
|
|
146
148
|
.pc-content_theme_light .pc-content__title a:hover {
|
|
147
149
|
color: var(--g-color-text-dark-secondary);
|
|
150
|
+
}
|
|
151
|
+
.pc-content_control-position_bottom .pc-content__notice:has(+ .pc-content__buttons), .pc-content_control-position_bottom .pc-content__notice:has(+ .pc-content__link),
|
|
152
|
+
.pc-content_control-position_bottom .pc-content__list:has(+ .pc-content__buttons),
|
|
153
|
+
.pc-content_control-position_bottom .pc-content__list:has(+ .pc-content__link),
|
|
154
|
+
.pc-content_control-position_bottom .pc-content__text:has(+ .pc-content__buttons),
|
|
155
|
+
.pc-content_control-position_bottom .pc-content__text:has(+ .pc-content__link),
|
|
156
|
+
.pc-content_control-position_bottom .pc-content__title:has(+ .pc-content__buttons),
|
|
157
|
+
.pc-content_control-position_bottom .pc-content__title:has(+ .pc-content__link) {
|
|
158
|
+
margin-bottom: auto;
|
|
148
159
|
}
|
|
@@ -18,7 +18,7 @@ function getTextSize(size) {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
const Content = (props) => {
|
|
21
|
-
const { title, titleId: titleIdFromProps, text, textId, additionalInfo, size = 'l', links, buttons, colSizes = { all: 12, sm: 8 }, centered, theme, className, list, qa, } = props;
|
|
21
|
+
const { title, titleId: titleIdFromProps, text, textId, additionalInfo, size = 'l', links, buttons, colSizes = { all: 12, sm: 8 }, centered, theme, className, list, qa, controlPosition, } = props;
|
|
22
22
|
const qaAttributes = (0, blocks_1.getQaAttrubutes)(qa, ['links', 'link', 'buttons', 'button', 'list']);
|
|
23
23
|
const titleProps = !title || typeof title === 'string'
|
|
24
24
|
? { text: title, textSize: getTextSize(size) }
|
|
@@ -26,7 +26,7 @@ const Content = (props) => {
|
|
|
26
26
|
const hasTitle = Boolean(title);
|
|
27
27
|
const defaultTitleId = (0, uikit_1.useUniqId)();
|
|
28
28
|
const titleId = titleIdFromProps || defaultTitleId;
|
|
29
|
-
return (react_1.default.createElement(grid_1.Col, { className: b({ size, centered, theme }, className), reset: true, sizes: colSizes, qa: qaAttributes.container },
|
|
29
|
+
return (react_1.default.createElement(grid_1.Col, { className: b({ size, centered, theme, 'control-position': controlPosition }, className), reset: true, sizes: colSizes, qa: qaAttributes.container },
|
|
30
30
|
title && (react_1.default.createElement(components_1.Title, { className: b('title'), title: titleProps, colSizes: { all: 12 }, id: titleId })),
|
|
31
31
|
text && (react_1.default.createElement("div", { className: b('text', { ['without-title']: !hasTitle }) },
|
|
32
32
|
react_1.default.createElement(components_1.YFMWrapper, { content: text, modifiers: { constructor: true, [`constructor-size-${size}`]: true }, id: textId }))),
|
|
@@ -119,6 +119,10 @@ export declare const ContentBase: {
|
|
|
119
119
|
};
|
|
120
120
|
};
|
|
121
121
|
};
|
|
122
|
+
controlPosition: {
|
|
123
|
+
type: string;
|
|
124
|
+
enum: string[];
|
|
125
|
+
};
|
|
122
126
|
};
|
|
123
127
|
export declare const ContentBlock: {
|
|
124
128
|
content: {
|
|
@@ -210,6 +214,10 @@ export declare const ContentBlock: {
|
|
|
210
214
|
};
|
|
211
215
|
};
|
|
212
216
|
};
|
|
217
|
+
controlPosition: {
|
|
218
|
+
type: string;
|
|
219
|
+
enum: string[];
|
|
220
|
+
};
|
|
213
221
|
};
|
|
214
222
|
};
|
|
215
223
|
};
|
|
@@ -17,7 +17,9 @@ unpredictable css rules order in build */
|
|
|
17
17
|
border: 1px solid var(--g-color-line-generic);
|
|
18
18
|
}
|
|
19
19
|
.pc-image-card .pc-image-card__content {
|
|
20
|
+
display: flex;
|
|
20
21
|
padding: 32px;
|
|
22
|
+
flex: auto;
|
|
21
23
|
}
|
|
22
24
|
.pc-image-card .pc-image-card__image_inner {
|
|
23
25
|
width: 100%;
|
|
@@ -9,8 +9,10 @@ const models_1 = require("../../models");
|
|
|
9
9
|
const utils_2 = require("../../utils");
|
|
10
10
|
const Content_1 = tslib_1.__importDefault(require("../Content/Content"));
|
|
11
11
|
const b = (0, utils_2.block)('image-card');
|
|
12
|
+
const CONTENT_COL_SIZES = { all: 12, md: 12 };
|
|
12
13
|
const ImageCard = (props) => {
|
|
13
|
-
const { border = 'shadow', title, text, image, enableImageBorderRadius = false, direction = models_1.ImageCardDirection.Direct, margins, backgroundColor, url, target, urlTitle, additionalInfo, links, buttons, list, theme: cardTheme = 'default', size = 's', } = props;
|
|
14
|
+
const { border = 'shadow', title, text, image, enableImageBorderRadius = false, direction = models_1.ImageCardDirection.Direct, margins, backgroundColor, url, target, urlTitle, additionalInfo, links, buttons, list, theme: cardTheme = 'default', size = 's', controlPosition = 'content', } = props;
|
|
15
|
+
const areControlsInFooter = controlPosition === 'footer';
|
|
14
16
|
const hasContent = Boolean(text || title || buttons || links || list);
|
|
15
17
|
const imageProps = (0, utils_1.getMediaImage)(image);
|
|
16
18
|
const titleId = (0, uikit_1.useUniqId)();
|
|
@@ -18,7 +20,7 @@ const ImageCard = (props) => {
|
|
|
18
20
|
react_1.default.createElement("div", { className: b('image', { margins }) },
|
|
19
21
|
react_1.default.createElement(components_1.Image, Object.assign({ className: b('image_inner', { radius: enableImageBorderRadius }) }, imageProps))),
|
|
20
22
|
hasContent && (react_1.default.createElement("div", { className: b('content') },
|
|
21
|
-
react_1.default.createElement(Content_1.default, { titleId: titleId, title: title, text: text, links: links, buttons: buttons, list: list, theme: cardTheme, additionalInfo: additionalInfo, size: size, colSizes:
|
|
23
|
+
react_1.default.createElement(Content_1.default, { titleId: titleId, title: title, text: text, links: links, buttons: buttons, list: list, theme: cardTheme, additionalInfo: additionalInfo, size: size, colSizes: CONTENT_COL_SIZES, controlPosition: areControlsInFooter ? 'bottom' : 'default' })))));
|
|
22
24
|
return url ? (react_1.default.createElement(uikit_1.Link, { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: b({ border, 'with-content': hasContent, direction }), title: urlTitle, extraProps: {
|
|
23
25
|
draggable: false,
|
|
24
26
|
onDragStart: (e) => e.preventDefault(),
|
|
@@ -6,12 +6,12 @@ const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
|
6
6
|
const common_1 = require("../../schema/validators/common");
|
|
7
7
|
const components_1 = require("../../schema/validators/components");
|
|
8
8
|
const schema_1 = require("../Content/schema");
|
|
9
|
-
const ImageCardBlockContentProps = (0, omit_1.default)(schema_1.ContentBase, ['centered', 'colSizes']);
|
|
9
|
+
const ImageCardBlockContentProps = (0, omit_1.default)(schema_1.ContentBase, ['centered', 'colSizes', 'controlPosition']);
|
|
10
10
|
exports.ImageCard = {
|
|
11
11
|
'image-card': {
|
|
12
12
|
additionalProperties: false,
|
|
13
13
|
required: ['image'],
|
|
14
|
-
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), common_1.CardBase), ImageCardBlockContentProps), { image: components_1.ImageProps, direction: {
|
|
14
|
+
properties: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), common_1.CardBase), common_1.CardLayoutProps), ImageCardBlockContentProps), { image: components_1.ImageProps, direction: {
|
|
15
15
|
type: 'string',
|
|
16
16
|
enum: ['direct', 'reverse'],
|
|
17
17
|
}, margins: {
|
|
@@ -17,12 +17,13 @@ unpredictable css rules order in build */
|
|
|
17
17
|
margin: 16px 0 -8px 0;
|
|
18
18
|
}
|
|
19
19
|
.pc-layout-item__content {
|
|
20
|
+
display: flex;
|
|
20
21
|
flex: auto;
|
|
21
22
|
margin: 16px 16px 0 0;
|
|
22
23
|
}
|
|
23
24
|
.pc-layout-item__content_no-media {
|
|
24
25
|
margin: 0;
|
|
25
26
|
}
|
|
26
|
-
.pc-layout-
|
|
27
|
-
|
|
27
|
+
.pc-layout-item__wrapper {
|
|
28
|
+
flex: auto;
|
|
28
29
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { LayoutItemProps } from '../../models';
|
|
2
|
-
declare const LayoutItem: ({ content: { links,
|
|
2
|
+
declare const LayoutItem: ({ content: { links, ...content }, metaInfo, media, border, fullscreen, icon, className, analyticsEvents, controlPosition, }: LayoutItemProps) => JSX.Element;
|
|
3
3
|
export default LayoutItem;
|
|
@@ -10,11 +10,11 @@ const Content_1 = tslib_1.__importDefault(require("../Content/Content"));
|
|
|
10
10
|
const utils_2 = require("./utils");
|
|
11
11
|
const b = (0, utils_1.block)('layout-item');
|
|
12
12
|
const LayoutItem = (_a) => {
|
|
13
|
-
var _b = _a.content, { links
|
|
13
|
+
var _b = _a.content, { links } = _b, content = tslib_1.__rest(_b, ["links"]), { metaInfo, media, border, fullscreen, icon, className, analyticsEvents, controlPosition = 'content' } = _a;
|
|
14
14
|
const normalizedLinks = (0, react_1.useMemo)(() => (0, utils_2.getLayoutItemLinks)(links), [links]);
|
|
15
15
|
const areControlsInFooter = controlPosition === 'footer';
|
|
16
16
|
const theme = (0, theme_1.useTheme)();
|
|
17
|
-
const contentProps = Object.assign(Object.assign(
|
|
17
|
+
const contentProps = Object.assign(Object.assign({ controlPosition: areControlsInFooter ? 'bottom' : 'default' }, content), { links: normalizedLinks, size: 's', colSizes: { all: 12, md: 12 } });
|
|
18
18
|
const titleId = (0, uikit_1.useUniqId)();
|
|
19
19
|
const renderMedia = () => {
|
|
20
20
|
if (!media) {
|
|
@@ -30,9 +30,7 @@ const LayoutItem = (_a) => {
|
|
|
30
30
|
renderMedia(),
|
|
31
31
|
metaInfo && react_1.default.createElement(components_1.MetaInfo, { items: metaInfo, className: b('meta-info') }),
|
|
32
32
|
react_1.default.createElement("div", { className: b('content', { 'no-media': !media }) },
|
|
33
|
-
react_1.default.createElement(components_1.IconWrapper, { icon: icon },
|
|
34
|
-
react_1.default.createElement(Content_1.default, Object.assign({}, contentProps, { titleId: titleId }))))
|
|
35
|
-
areControlsInFooter && links && (react_1.default.createElement(components_1.Links, { className: b('links'), size: "s", links: links, titleId: titleId })),
|
|
36
|
-
areControlsInFooter && buttons && (react_1.default.createElement(components_1.Buttons, { className: b('buttons'), size: "s", buttons: buttons, titleId: titleId }))));
|
|
33
|
+
react_1.default.createElement(components_1.IconWrapper, { icon: icon, className: b('wrapper') },
|
|
34
|
+
react_1.default.createElement(Content_1.default, Object.assign({}, contentProps, { titleId: titleId }))))));
|
|
37
35
|
};
|
|
38
36
|
exports.default = LayoutItem;
|
|
@@ -11,7 +11,7 @@ exports.LayoutItem = {
|
|
|
11
11
|
type: 'object',
|
|
12
12
|
additionalProperties: false,
|
|
13
13
|
required: ['content', 'media'],
|
|
14
|
-
properties: Object.assign(Object.assign({}, common_1.BaseProps), { media: common_1.MediaProps, content: (0, omit_1.default)(schema_2.ContentBase, ['colSize', 'size', 'centered']), metaInfo: schema_1.default, border: {
|
|
14
|
+
properties: Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), common_1.CardLayoutProps), { media: common_1.MediaProps, content: (0, omit_1.default)(schema_2.ContentBase, ['colSize', 'size', 'centered']), metaInfo: schema_1.default, border: {
|
|
15
15
|
type: 'boolean',
|
|
16
16
|
}, fullscreen: {
|
|
17
17
|
type: 'boolean',
|
|
@@ -24,8 +24,5 @@ exports.LayoutItem = {
|
|
|
24
24
|
optionName: 'list',
|
|
25
25
|
},
|
|
26
26
|
],
|
|
27
|
-
}, controlPosition: {
|
|
28
|
-
type: 'string',
|
|
29
|
-
enum: ['content', 'footer'],
|
|
30
27
|
} }),
|
|
31
28
|
};
|
|
@@ -135,6 +135,10 @@ export declare const InfoBlock: {
|
|
|
135
135
|
};
|
|
136
136
|
};
|
|
137
137
|
};
|
|
138
|
+
controlPosition: {
|
|
139
|
+
type: string;
|
|
140
|
+
enum: string[];
|
|
141
|
+
};
|
|
138
142
|
}>;
|
|
139
143
|
};
|
|
140
144
|
rightContent: {
|
|
@@ -222,6 +226,10 @@ export declare const InfoBlock: {
|
|
|
222
226
|
};
|
|
223
227
|
};
|
|
224
228
|
};
|
|
229
|
+
controlPosition: {
|
|
230
|
+
type: string;
|
|
231
|
+
enum: string[];
|
|
232
|
+
};
|
|
225
233
|
}>;
|
|
226
234
|
};
|
|
227
235
|
type: {};
|
|
@@ -538,6 +538,10 @@ export declare const MediaBlockBaseProps: {
|
|
|
538
538
|
};
|
|
539
539
|
};
|
|
540
540
|
};
|
|
541
|
+
controlPosition: {
|
|
542
|
+
type: string;
|
|
543
|
+
enum: string[];
|
|
544
|
+
};
|
|
541
545
|
animated: {
|
|
542
546
|
type: string;
|
|
543
547
|
};
|
|
@@ -1139,6 +1143,10 @@ export declare const MediaBlock: {
|
|
|
1139
1143
|
};
|
|
1140
1144
|
};
|
|
1141
1145
|
};
|
|
1146
|
+
controlPosition: {
|
|
1147
|
+
type: string;
|
|
1148
|
+
enum: string[];
|
|
1149
|
+
};
|
|
1142
1150
|
animated: {
|
|
1143
1151
|
type: string;
|
|
1144
1152
|
};
|
|
@@ -22,6 +22,8 @@ unpredictable css rules order in build */
|
|
|
22
22
|
width: 22px;
|
|
23
23
|
margin: 1px 12px 1px 0px;
|
|
24
24
|
}
|
|
25
|
-
.pc-icon-
|
|
26
|
-
|
|
25
|
+
.pc-icon-wrapper__content {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
flex: 1 0 auto;
|
|
27
29
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { IconWrapperProps } from '../../models';
|
|
2
|
+
import type { ClassNameProps, IconWrapperProps } from '../../models';
|
|
3
3
|
import './IconWrapper.css';
|
|
4
|
-
declare const IconWrapper: (props: PropsWithChildren<IconWrapperProps>) => JSX.Element;
|
|
4
|
+
declare const IconWrapper: (props: PropsWithChildren<IconWrapperProps> & ClassNameProps) => JSX.Element;
|
|
5
5
|
export default IconWrapper;
|
|
@@ -5,14 +5,14 @@ import { getMediaImage } from '../Media/Image/utils';
|
|
|
5
5
|
import './IconWrapper.css';
|
|
6
6
|
const b = block('icon-wrapper');
|
|
7
7
|
const IconWrapper = (props) => {
|
|
8
|
-
const { icon, children } = props;
|
|
8
|
+
const { icon, children, className } = props;
|
|
9
9
|
if (!icon) {
|
|
10
10
|
return React.createElement(Fragment, null, children);
|
|
11
11
|
}
|
|
12
12
|
const iconProps = getMediaImage(icon.value);
|
|
13
13
|
const iconPosition = icon === null || icon === void 0 ? void 0 : icon.position;
|
|
14
|
-
return (React.createElement("div", { className: b({ ['icon-position']: iconPosition }) },
|
|
14
|
+
return (React.createElement("div", { className: b({ ['icon-position']: iconPosition }, className) },
|
|
15
15
|
iconProps && (React.createElement(Image, Object.assign({}, iconProps, { containerClassName: b('icon-container'), className: b('icon', { ['icon-position']: iconPosition }) }))),
|
|
16
|
-
React.createElement("div", { className: b(
|
|
16
|
+
React.createElement("div", { className: b('content') }, children)));
|
|
17
17
|
};
|
|
18
18
|
export default IconWrapper;
|
|
@@ -24,7 +24,7 @@ export declare const subBlockMap: {
|
|
|
24
24
|
"price-detailed": (props: import("./models").PriceDetailedProps) => JSX.Element;
|
|
25
25
|
"media-card": ({ border, analyticsEvents, ...mediaProps }: import("./models").MediaCardProps) => JSX.Element;
|
|
26
26
|
"banner-card": (props: import("./models").BannerCardProps) => JSX.Element;
|
|
27
|
-
"layout-item": ({ content: { links,
|
|
27
|
+
"layout-item": ({ content: { links, ...content }, metaInfo, media, border, fullscreen, icon, className, analyticsEvents, controlPosition, }: import("./models").LayoutItemProps) => JSX.Element;
|
|
28
28
|
"background-card": (props: import("./models").BackgroundCardProps) => JSX.Element;
|
|
29
29
|
"basic-card": (props: import("./models").BasicCardProps) => JSX.Element;
|
|
30
30
|
content: (props: import("./sub-blocks/Content/Content").ContentProps) => JSX.Element;
|
|
@@ -14,17 +14,15 @@ unpredictable css rules order in build */
|
|
|
14
14
|
display: flex;
|
|
15
15
|
align-items: center;
|
|
16
16
|
}
|
|
17
|
-
.pc-control-panel__radio-button {
|
|
18
|
-
margin-left: 12px;
|
|
19
|
-
}
|
|
20
17
|
.pc-control-panel__radio-button .g-radio-button__option {
|
|
21
18
|
display: flex;
|
|
22
19
|
align-items: center;
|
|
23
20
|
}
|
|
24
|
-
.pc-control-
|
|
21
|
+
.pc-control-panel__switch-container {
|
|
25
22
|
display: flex;
|
|
26
23
|
align-items: center;
|
|
27
24
|
place-self: center;
|
|
25
|
+
gap: 12px;
|
|
28
26
|
}
|
|
29
27
|
.pc-control-panel__theme-switch {
|
|
30
28
|
place-self: center end;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { ClassNameProps, Theme } from '../../../models';
|
|
2
|
-
import { ViewModeItem } from '../../types';
|
|
2
|
+
import { EditModeItem, ViewModeItem } from '../../types';
|
|
3
3
|
import './ControlPanel.css';
|
|
4
4
|
export interface ControlPanelProps extends ClassNameProps {
|
|
5
5
|
viewMode?: ViewModeItem;
|
|
6
|
+
editMode?: EditModeItem;
|
|
6
7
|
onViewModeChange: (viewMode: ViewModeItem) => void;
|
|
8
|
+
onEditModeChange: (editMode: EditModeItem) => void;
|
|
7
9
|
theme: Theme;
|
|
8
10
|
onThemeChange: (theme: Theme) => void;
|
|
9
11
|
}
|
|
10
|
-
declare const ControlPanel: ({ viewMode, onViewModeChange, className, theme, onThemeChange, }: ControlPanelProps) => JSX.Element;
|
|
12
|
+
declare const ControlPanel: ({ viewMode, editMode, onViewModeChange, onEditModeChange, className, theme, onThemeChange, }: ControlPanelProps) => JSX.Element;
|
|
11
13
|
export default ControlPanel;
|
|
@@ -1,33 +1,42 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Display,
|
|
2
|
+
import { Code, Display, Eye, Smartphone, SquareDashedText } from '@gravity-ui/icons';
|
|
3
3
|
import { RadioButton, Select } from '@gravity-ui/uikit';
|
|
4
4
|
import { Theme, themeNames } from '../../../models';
|
|
5
5
|
import { block } from '../../../utils';
|
|
6
6
|
import { Tablet } from '../../icons/Tablet';
|
|
7
|
-
import { ViewModeItem } from '../../types';
|
|
7
|
+
import { EditModeItem, ViewModeItem } from '../../types';
|
|
8
8
|
import { i18n } from './i18n';
|
|
9
9
|
import './ControlPanel.css';
|
|
10
10
|
const ICON_SIZE = 14;
|
|
11
11
|
const b = block('control-panel');
|
|
12
12
|
const ControlPanelViewModeIcons = {
|
|
13
|
-
[ViewModeItem.Edititng]: Pencil,
|
|
14
13
|
[ViewModeItem.Desktop]: Display,
|
|
15
14
|
[ViewModeItem.Tablet]: Tablet,
|
|
16
15
|
[ViewModeItem.Mobile]: Smartphone,
|
|
17
16
|
};
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
React.createElement("span", null, i18n('mode')),
|
|
23
|
-
React.createElement(RadioButton, { className: b('radio-button'), value: viewMode, onUpdate: (value) => onViewModeChange(value) }, Object.values(ViewModeItem).map((item) => {
|
|
24
|
-
const Icon = ControlPanelViewModeIcons[item];
|
|
25
|
-
return (React.createElement(RadioButton.Option, { key: item, value: item },
|
|
26
|
-
React.createElement("span", { className: b('icon') },
|
|
27
|
-
React.createElement(Icon, { width: ICON_SIZE, height: ICON_SIZE }))));
|
|
28
|
-
}))),
|
|
29
|
-
React.createElement("div", { className: b('theme-switch') },
|
|
30
|
-
React.createElement("span", null, i18n('theme')),
|
|
31
|
-
React.createElement(Select, { value: [theme], onUpdate: (value) => onThemeChange(value[0]) }, Object.values(Theme).map((item) => (React.createElement(Select.Option, { key: item, value: item }, themeNames[item])))))));
|
|
17
|
+
const ControlPanelEditModeIcons = {
|
|
18
|
+
[EditModeItem.View]: Eye,
|
|
19
|
+
[EditModeItem.Form]: SquareDashedText,
|
|
20
|
+
[EditModeItem.Code]: Code,
|
|
32
21
|
};
|
|
22
|
+
const ControlPanel = ({ viewMode = ViewModeItem.Desktop, editMode = EditModeItem.Form, onViewModeChange, onEditModeChange, className, theme, onThemeChange, }) => (React.createElement("div", { className: b(null, className) },
|
|
23
|
+
React.createElement("div", { className: b('switch-container') },
|
|
24
|
+
React.createElement("span", null, i18n('edit_mode')),
|
|
25
|
+
React.createElement(RadioButton, { className: b('radio-button'), value: editMode, onUpdate: (value) => onEditModeChange(value) }, Object.values(EditModeItem).map((item) => {
|
|
26
|
+
const Icon = ControlPanelEditModeIcons[item];
|
|
27
|
+
return (React.createElement(RadioButton.Option, { key: item, value: item },
|
|
28
|
+
React.createElement("span", { className: b('icon') },
|
|
29
|
+
React.createElement(Icon, { width: ICON_SIZE, height: ICON_SIZE }))));
|
|
30
|
+
}))),
|
|
31
|
+
React.createElement("div", { className: b('switch-container') },
|
|
32
|
+
React.createElement("span", null, i18n('view_mode')),
|
|
33
|
+
React.createElement(RadioButton, { className: b('radio-button'), value: viewMode, onUpdate: (value) => onViewModeChange(value) }, Object.values(ViewModeItem).map((item) => {
|
|
34
|
+
const Icon = ControlPanelViewModeIcons[item];
|
|
35
|
+
return (React.createElement(RadioButton.Option, { key: item, value: item },
|
|
36
|
+
React.createElement("span", { className: b('icon') },
|
|
37
|
+
React.createElement(Icon, { width: ICON_SIZE, height: ICON_SIZE }))));
|
|
38
|
+
}))),
|
|
39
|
+
React.createElement("div", { className: b('switch-container') },
|
|
40
|
+
React.createElement("span", null, i18n('theme')),
|
|
41
|
+
React.createElement(Select, { value: [theme], onUpdate: (value) => onThemeChange(value[0]) }, Object.values(Theme).map((item) => (React.createElement(Select.Option, { key: item, value: item }, themeNames[item])))))));
|
|
33
42
|
export default ControlPanel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const i18n: (key: "theme" | "
|
|
1
|
+
export declare const i18n: (key: "theme" | "view_mode" | "edit_mode", params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
@@ -20,11 +20,6 @@ body {
|
|
|
20
20
|
.pc-editor-layout {
|
|
21
21
|
position: relative;
|
|
22
22
|
}
|
|
23
|
-
.pc-editor-layout__panel {
|
|
24
|
-
top: 0;
|
|
25
|
-
position: sticky;
|
|
26
|
-
z-index: 2;
|
|
27
|
-
}
|
|
28
23
|
.pc-editor-layout__container {
|
|
29
24
|
position: relative;
|
|
30
25
|
display: flex;
|
|
@@ -33,14 +28,23 @@ body {
|
|
|
33
28
|
}
|
|
34
29
|
.pc-editor-layout__left {
|
|
35
30
|
flex: 0 0 auto;
|
|
36
|
-
padding: 24px
|
|
31
|
+
padding: 24px;
|
|
37
32
|
width: var(--pc-editor-left-column-width);
|
|
38
33
|
border-right: var(--pc-editor-divider-width) solid var(--g-color-line-generic);
|
|
39
34
|
overflow-x: auto;
|
|
40
35
|
}
|
|
36
|
+
.pc-editor-layout__left_closed {
|
|
37
|
+
display: none;
|
|
38
|
+
}
|
|
41
39
|
.pc-editor-layout__right {
|
|
40
|
+
position: relative;
|
|
42
41
|
width: 100%;
|
|
43
42
|
}
|
|
44
43
|
.pc-editor-layout__right_editing {
|
|
45
44
|
padding-bottom: 200px;
|
|
45
|
+
}
|
|
46
|
+
.pc-editor-layout__arrow-toggle {
|
|
47
|
+
padding: 12px;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
border-right: 1px solid var(--g-color-line-generic);
|
|
46
50
|
}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { ViewModeItem } from '../../types';
|
|
2
|
+
import { EditModeItem, ViewModeItem } from '../../types';
|
|
4
3
|
import './Layout.css';
|
|
5
4
|
export interface LayoutProps {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
theme: Theme;
|
|
9
|
-
onThemeChange: (theme: Theme) => void;
|
|
5
|
+
editMode: EditModeItem;
|
|
6
|
+
viewMode: ViewModeItem;
|
|
10
7
|
}
|
|
11
8
|
declare const Layout: {
|
|
12
|
-
({ children,
|
|
9
|
+
({ children, editMode, viewMode }: PropsWithChildren<LayoutProps>): JSX.Element;
|
|
13
10
|
Left: React.FC<{
|
|
14
11
|
children?: React.ReactNode;
|
|
15
12
|
}>;
|