@gravity-ui/page-constructor 2.22.0-alpha.0 → 2.22.1
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 +14 -0
- package/build/cjs/blocks/CardLayout/CardLayout.js +1 -1
- package/build/cjs/blocks/CardLayout/schema.d.ts +2 -2
- package/build/cjs/blocks/CardLayout/schema.js +1 -1
- package/build/cjs/blocks/FilterBlock/FilterBlock.js +9 -13
- package/build/cjs/components/FullscreenMedia/FullscreenMedia.js +3 -1
- package/build/cjs/components/Media/Image/Image.js +3 -3
- package/build/cjs/components/Media/Media.js +5 -3
- package/build/cjs/models/constructor-items/blocks.d.ts +1 -1
- package/build/esm/blocks/CardLayout/CardLayout.js +1 -1
- package/build/esm/blocks/CardLayout/schema.d.ts +2 -2
- package/build/esm/blocks/CardLayout/schema.js +1 -1
- package/build/esm/blocks/FilterBlock/FilterBlock.js +10 -14
- package/build/esm/components/FullscreenMedia/FullscreenMedia.js +3 -1
- package/build/esm/components/Media/Image/Image.js +3 -3
- package/build/esm/components/Media/Media.js +5 -3
- package/build/esm/models/constructor-items/blocks.d.ts +1 -1
- package/package.json +1 -4
- package/server/models/constructor-items/blocks.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.22.1](https://github.com/gravity-ui/page-constructor/compare/v2.22.0...v2.22.1) (2023-06-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* filter block nesting ([#364](https://github.com/gravity-ui/page-constructor/issues/364)) ([5b62522](https://github.com/gravity-ui/page-constructor/commit/5b62522e5e34eeacbb2fb9ec6de957bba69cd758))
|
|
9
|
+
|
|
10
|
+
## [2.22.0](https://github.com/gravity-ui/page-constructor/compare/v2.21.0...v2.22.0) (2023-05-31)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **Media:** add fullscreen video ([#345](https://github.com/gravity-ui/page-constructor/issues/345)) ([516a9a8](https://github.com/gravity-ui/page-constructor/commit/516a9a8423d710b6ecad33046121c489fa876e30))
|
|
16
|
+
|
|
3
17
|
## [2.21.0](https://github.com/gravity-ui/page-constructor/compare/v2.20.1...v2.21.0) (2023-05-29)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -12,6 +12,6 @@ const DEFAULT_SIZES = {
|
|
|
12
12
|
};
|
|
13
13
|
const b = (0, utils_1.block)('card-layout-block');
|
|
14
14
|
const CardLayout = ({ title, description, animated, colSizes = DEFAULT_SIZES, children, }) => (react_1.default.createElement(components_1.AnimateBlock, { className: b(), animate: animated },
|
|
15
|
-
react_1.default.createElement(components_1.BlockHeader, { title: title, description: description }),
|
|
15
|
+
(title || description) && react_1.default.createElement(components_1.BlockHeader, { title: title, description: description }),
|
|
16
16
|
react_1.default.createElement(grid_1.Row, null, react_1.default.Children.map(children, (child, index) => (react_1.default.createElement(grid_1.Col, { key: index, sizes: colSizes, className: b('item') }, child))))));
|
|
17
17
|
exports.default = CardLayout;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const CardLayoutProps: {
|
|
2
2
|
additionalProperties: boolean;
|
|
3
|
-
required:
|
|
3
|
+
required: never[];
|
|
4
4
|
properties: {
|
|
5
5
|
colSizes: {
|
|
6
6
|
type: string;
|
|
@@ -76,7 +76,7 @@ export declare const CardLayoutProps: {
|
|
|
76
76
|
export declare const CardLayoutBlock: {
|
|
77
77
|
'card-layout-block': {
|
|
78
78
|
additionalProperties: boolean;
|
|
79
|
-
required:
|
|
79
|
+
required: never[];
|
|
80
80
|
properties: {
|
|
81
81
|
colSizes: {
|
|
82
82
|
type: string;
|
|
@@ -4,7 +4,7 @@ exports.CardLayoutBlock = exports.CardLayoutProps = void 0;
|
|
|
4
4
|
const common_1 = require("../../schema/validators/common");
|
|
5
5
|
exports.CardLayoutProps = {
|
|
6
6
|
additionalProperties: false,
|
|
7
|
-
required: [
|
|
7
|
+
required: [],
|
|
8
8
|
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BlockBaseProps), common_1.AnimatableProps), common_1.BlockHeaderProps), { colSizes: common_1.containerSizesObject, children: common_1.ChildrenCardsProps }),
|
|
9
9
|
};
|
|
10
10
|
exports.CardLayoutBlock = {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const __1 = require("..");
|
|
5
6
|
const components_1 = require("../../components");
|
|
6
7
|
const ButtonTabs_1 = tslib_1.__importDefault(require("../../components/ButtonTabs/ButtonTabs"));
|
|
7
|
-
const
|
|
8
|
+
const ConstructorItem_1 = require("../../containers/PageConstructor/components/ConstructorItem");
|
|
8
9
|
const grid_1 = require("../../grid");
|
|
9
|
-
const models_1 = require("../../models");
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const i18n_1 = tslib_1.__importDefault(require("./i18n"));
|
|
12
12
|
const b = (0, utils_1.block)('filter-block');
|
|
@@ -24,25 +24,21 @@ const FilterBlock = ({ title, description, tags, tagButtonSize, allTag, items, c
|
|
|
24
24
|
? tabButtons[0].id
|
|
25
25
|
: selectedTag;
|
|
26
26
|
}, [tabButtons, selectedTag]);
|
|
27
|
-
const
|
|
27
|
+
const cards = (0, react_1.useMemo)(() => {
|
|
28
28
|
const itemsToShow = actualTag
|
|
29
29
|
? items.filter((item) => item.tags.includes(actualTag))
|
|
30
30
|
: items;
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
type: models_1.BlockType.CardLayoutBlock,
|
|
34
|
-
title: '',
|
|
35
|
-
colSizes: colSizes,
|
|
36
|
-
children: itemsToShow.map((item) => item.card),
|
|
37
|
-
},
|
|
38
|
-
];
|
|
39
|
-
}, [actualTag, items, colSizes]);
|
|
31
|
+
return itemsToShow.map((item) => item.card);
|
|
32
|
+
}, [actualTag, items]);
|
|
40
33
|
return (react_1.default.createElement(components_1.AnimateBlock, { className: b(), animate: animated },
|
|
41
34
|
title && (react_1.default.createElement(components_1.BlockHeader, { className: b('title', { centered: centered }), title: title, description: description })),
|
|
42
35
|
tabButtons.length && (react_1.default.createElement(grid_1.Row, null,
|
|
43
36
|
react_1.default.createElement(grid_1.Col, null,
|
|
44
37
|
react_1.default.createElement(ButtonTabs_1.default, { className: b('tabs', { centered: centered }), items: tabButtons, activeTab: selectedTag, onSelectTab: setSelectedTag, tabSize: tagButtonSize })))),
|
|
45
38
|
react_1.default.createElement(grid_1.Row, { className: b('block-container') },
|
|
46
|
-
react_1.default.createElement(
|
|
39
|
+
react_1.default.createElement(__1.CardLayoutBlock, { title: "", colSizes: colSizes }, cards.map((card, index) => {
|
|
40
|
+
const key = (0, utils_1.getBlockKey)(card, index);
|
|
41
|
+
return react_1.default.createElement(ConstructorItem_1.ConstructorItem, { data: card, blockKey: key, key: key });
|
|
42
|
+
})))));
|
|
47
43
|
};
|
|
48
44
|
exports.default = FilterBlock;
|
|
@@ -10,6 +10,8 @@ const b = (0, utils_1.block)('full-screen-media');
|
|
|
10
10
|
const FULL_SCREEN_ICON_SIZE = 18;
|
|
11
11
|
const CLOSE_ICON_SIZE = 30;
|
|
12
12
|
const getMediaClass = (type) => b('modal-media', { type });
|
|
13
|
+
// TODO delete along with showFullScreenIcon props
|
|
14
|
+
const getShowFullscreenIcon = ({ showFullScreenIcon = true, showFullscreenIcon = true }) => showFullScreenIcon && showFullscreenIcon;
|
|
13
15
|
const FullscreenMedia = ({ children, showFullScreenIcon = true, showFullscreenIcon = true, }) => {
|
|
14
16
|
const [isOpened, setIsOpened] = (0, react_1.useState)(false);
|
|
15
17
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
@@ -24,7 +26,7 @@ const FullscreenMedia = ({ children, showFullScreenIcon = true, showFullscreenIc
|
|
|
24
26
|
return (react_1.default.createElement("div", { className: b() },
|
|
25
27
|
react_1.default.createElement("div", { className: b('media-wrapper'), onClickCapture: openModal },
|
|
26
28
|
children({ className: b('inline-media') }),
|
|
27
|
-
showFullScreenIcon
|
|
29
|
+
getShowFullscreenIcon({ showFullScreenIcon, showFullscreenIcon }) && (react_1.default.createElement("div", { className: b('icon-wrapper'), onClickCapture: openModal },
|
|
28
30
|
react_1.default.createElement(uikit_1.Icon, { data: icons_1.FullScreen, width: FULL_SCREEN_ICON_SIZE, height: FULL_SCREEN_ICON_SIZE, className: b('icon') })))),
|
|
29
31
|
isOpened && (react_1.default.createElement(uikit_1.Modal, { open: isOpened, onClose: closeModal, className: b('modal') },
|
|
30
32
|
react_1.default.createElement("div", { className: b('modal-content') },
|
|
@@ -34,7 +34,7 @@ const Image = (props) => {
|
|
|
34
34
|
parallaxInterpolate = springScrollY.interpolate((value) => `translateY(-${Number(value) / parallaxLevel}px)`);
|
|
35
35
|
}
|
|
36
36
|
const imageClass = b('item', { withVideo: Boolean(video) && !hasVideoFallback }, imageClassName);
|
|
37
|
-
const
|
|
37
|
+
const renderFullscreenImage = (item) => {
|
|
38
38
|
const itemData = (0, utils_2.getMediaImage)(item);
|
|
39
39
|
return (react_1.default.createElement(FullscreenImage_1.default, Object.assign({ key: itemData.alt }, itemData, { imageClassName: imageClass, imageStyle: { height } })));
|
|
40
40
|
};
|
|
@@ -49,13 +49,13 @@ const Image = (props) => {
|
|
|
49
49
|
};
|
|
50
50
|
const imageSlider = (imageArray) => {
|
|
51
51
|
const fullscreenItem = fullscreen === undefined || fullscreen;
|
|
52
|
-
return (react_1.default.createElement(Slider_1.default, { slidesToShow: 1, type: models_1.SliderType.MediaCard }, imageArray.map((item) => fullscreenItem ?
|
|
52
|
+
return (react_1.default.createElement(Slider_1.default, { slidesToShow: 1, type: models_1.SliderType.MediaCard }, imageArray.map((item) => fullscreenItem ? renderFullscreenImage(item) : imageOnly(item))));
|
|
53
53
|
};
|
|
54
54
|
if (Array.isArray(image)) {
|
|
55
55
|
return imageSlider(image);
|
|
56
56
|
}
|
|
57
57
|
if (fullscreen) {
|
|
58
|
-
return
|
|
58
|
+
return renderFullscreenImage(image);
|
|
59
59
|
}
|
|
60
60
|
return isBackground ? imageBackground(image) : imageOnly(image);
|
|
61
61
|
};
|
|
@@ -10,6 +10,8 @@ const FullscreenVideo_1 = tslib_1.__importDefault(require("./FullscreenVideo/Ful
|
|
|
10
10
|
const Image_1 = tslib_1.__importDefault(require("./Image/Image"));
|
|
11
11
|
const Video_1 = tslib_1.__importDefault(require("./Video/Video"));
|
|
12
12
|
const b = (0, utils_1.block)('Media');
|
|
13
|
+
// TODO delete along with fullScreen props
|
|
14
|
+
const getFullscreen = ({ fullScreen, fullscreen }) => fullScreen || fullscreen;
|
|
13
15
|
const Media = (props) => {
|
|
14
16
|
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullScreen, fullscreen, analyticsEvents, } = props;
|
|
15
17
|
const { className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, } = props;
|
|
@@ -17,7 +19,7 @@ const Media = (props) => {
|
|
|
17
19
|
const content = (0, react_1.useMemo)(() => {
|
|
18
20
|
let result = [];
|
|
19
21
|
if (image) {
|
|
20
|
-
result.push(react_1.default.createElement(Image_1.default, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback, fullscreen: fullScreen
|
|
22
|
+
result.push(react_1.default.createElement(Image_1.default, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback, fullscreen: getFullscreen({ fullScreen, fullscreen }) }));
|
|
21
23
|
}
|
|
22
24
|
if (video) {
|
|
23
25
|
const videoProps = {
|
|
@@ -34,7 +36,7 @@ const Media = (props) => {
|
|
|
34
36
|
hasVideoFallback,
|
|
35
37
|
setHasVideoFallback,
|
|
36
38
|
};
|
|
37
|
-
if (fullScreen
|
|
39
|
+
if (getFullscreen({ fullScreen, fullscreen })) {
|
|
38
40
|
result.push(react_1.default.createElement(FullscreenVideo_1.default, Object.assign({}, videoProps)));
|
|
39
41
|
}
|
|
40
42
|
else {
|
|
@@ -42,7 +44,7 @@ const Media = (props) => {
|
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
if (youtube) {
|
|
45
|
-
result = (react_1.default.createElement(VideoBlock_1.default, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: fullScreen
|
|
47
|
+
result = (react_1.default.createElement(VideoBlock_1.default, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: getFullscreen({ fullScreen, fullscreen }) }));
|
|
46
48
|
}
|
|
47
49
|
if (dataLens) {
|
|
48
50
|
result = react_1.default.createElement(DataLens_1.default, { dataLens: dataLens });
|
|
@@ -246,7 +246,7 @@ export interface LinkTableBlockProps extends BlockHeaderProps {
|
|
|
246
246
|
linkTheme?: LinkTheme;
|
|
247
247
|
}
|
|
248
248
|
export interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {
|
|
249
|
-
title
|
|
249
|
+
title?: TitleProps | string;
|
|
250
250
|
description?: string;
|
|
251
251
|
colSizes?: GridColumnSizesType;
|
|
252
252
|
}
|
|
@@ -10,6 +10,6 @@ const DEFAULT_SIZES = {
|
|
|
10
10
|
};
|
|
11
11
|
const b = block('card-layout-block');
|
|
12
12
|
const CardLayout = ({ title, description, animated, colSizes = DEFAULT_SIZES, children, }) => (React.createElement(AnimateBlock, { className: b(), animate: animated },
|
|
13
|
-
React.createElement(BlockHeader, { title: title, description: description }),
|
|
13
|
+
(title || description) && React.createElement(BlockHeader, { title: title, description: description }),
|
|
14
14
|
React.createElement(Row, null, React.Children.map(children, (child, index) => (React.createElement(Col, { key: index, sizes: colSizes, className: b('item') }, child))))));
|
|
15
15
|
export default CardLayout;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const CardLayoutProps: {
|
|
2
2
|
additionalProperties: boolean;
|
|
3
|
-
required:
|
|
3
|
+
required: never[];
|
|
4
4
|
properties: {
|
|
5
5
|
colSizes: {
|
|
6
6
|
type: string;
|
|
@@ -76,7 +76,7 @@ export declare const CardLayoutProps: {
|
|
|
76
76
|
export declare const CardLayoutBlock: {
|
|
77
77
|
'card-layout-block': {
|
|
78
78
|
additionalProperties: boolean;
|
|
79
|
-
required:
|
|
79
|
+
required: never[];
|
|
80
80
|
properties: {
|
|
81
81
|
colSizes: {
|
|
82
82
|
type: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnimatableProps, BlockBaseProps, BlockHeaderProps, ChildrenCardsProps, containerSizesObject, } from '../../schema/validators/common';
|
|
2
2
|
export const CardLayoutProps = {
|
|
3
3
|
additionalProperties: false,
|
|
4
|
-
required: [
|
|
4
|
+
required: [],
|
|
5
5
|
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, BlockBaseProps), AnimatableProps), BlockHeaderProps), { colSizes: containerSizesObject, children: ChildrenCardsProps }),
|
|
6
6
|
};
|
|
7
7
|
export const CardLayoutBlock = {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import { CardLayoutBlock } from '..';
|
|
2
3
|
import { AnimateBlock, BlockHeader } from '../../components';
|
|
3
4
|
import ButtonTabs from '../../components/ButtonTabs/ButtonTabs';
|
|
4
|
-
import {
|
|
5
|
+
import { ConstructorItem } from '../../containers/PageConstructor/components/ConstructorItem';
|
|
5
6
|
import { Col, Row } from '../../grid';
|
|
6
|
-
import {
|
|
7
|
-
import { block } from '../../utils';
|
|
7
|
+
import { block, getBlockKey } from '../../utils';
|
|
8
8
|
import i18n from './i18n';
|
|
9
9
|
import './FilterBlock.css';
|
|
10
10
|
const b = block('filter-block');
|
|
@@ -22,25 +22,21 @@ const FilterBlock = ({ title, description, tags, tagButtonSize, allTag, items, c
|
|
|
22
22
|
? tabButtons[0].id
|
|
23
23
|
: selectedTag;
|
|
24
24
|
}, [tabButtons, selectedTag]);
|
|
25
|
-
const
|
|
25
|
+
const cards = useMemo(() => {
|
|
26
26
|
const itemsToShow = actualTag
|
|
27
27
|
? items.filter((item) => item.tags.includes(actualTag))
|
|
28
28
|
: items;
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
type: BlockType.CardLayoutBlock,
|
|
32
|
-
title: '',
|
|
33
|
-
colSizes: colSizes,
|
|
34
|
-
children: itemsToShow.map((item) => item.card),
|
|
35
|
-
},
|
|
36
|
-
];
|
|
37
|
-
}, [actualTag, items, colSizes]);
|
|
29
|
+
return itemsToShow.map((item) => item.card);
|
|
30
|
+
}, [actualTag, items]);
|
|
38
31
|
return (React.createElement(AnimateBlock, { className: b(), animate: animated },
|
|
39
32
|
title && (React.createElement(BlockHeader, { className: b('title', { centered: centered }), title: title, description: description })),
|
|
40
33
|
tabButtons.length && (React.createElement(Row, null,
|
|
41
34
|
React.createElement(Col, null,
|
|
42
35
|
React.createElement(ButtonTabs, { className: b('tabs', { centered: centered }), items: tabButtons, activeTab: selectedTag, onSelectTab: setSelectedTag, tabSize: tagButtonSize })))),
|
|
43
36
|
React.createElement(Row, { className: b('block-container') },
|
|
44
|
-
React.createElement(
|
|
37
|
+
React.createElement(CardLayoutBlock, { title: "", colSizes: colSizes }, cards.map((card, index) => {
|
|
38
|
+
const key = getBlockKey(card, index);
|
|
39
|
+
return React.createElement(ConstructorItem, { data: card, blockKey: key, key: key });
|
|
40
|
+
})))));
|
|
45
41
|
};
|
|
46
42
|
export default FilterBlock;
|
|
@@ -8,6 +8,8 @@ const b = block('full-screen-media');
|
|
|
8
8
|
const FULL_SCREEN_ICON_SIZE = 18;
|
|
9
9
|
const CLOSE_ICON_SIZE = 30;
|
|
10
10
|
const getMediaClass = (type) => b('modal-media', { type });
|
|
11
|
+
// TODO delete along with showFullScreenIcon props
|
|
12
|
+
const getShowFullscreenIcon = ({ showFullScreenIcon = true, showFullscreenIcon = true }) => showFullScreenIcon && showFullscreenIcon;
|
|
11
13
|
const FullscreenMedia = ({ children, showFullScreenIcon = true, showFullscreenIcon = true, }) => {
|
|
12
14
|
const [isOpened, setIsOpened] = useState(false);
|
|
13
15
|
const isMobile = useContext(MobileContext);
|
|
@@ -22,7 +24,7 @@ const FullscreenMedia = ({ children, showFullScreenIcon = true, showFullscreenIc
|
|
|
22
24
|
return (React.createElement("div", { className: b() },
|
|
23
25
|
React.createElement("div", { className: b('media-wrapper'), onClickCapture: openModal },
|
|
24
26
|
children({ className: b('inline-media') }),
|
|
25
|
-
showFullScreenIcon
|
|
27
|
+
getShowFullscreenIcon({ showFullScreenIcon, showFullscreenIcon }) && (React.createElement("div", { className: b('icon-wrapper'), onClickCapture: openModal },
|
|
26
28
|
React.createElement(Icon, { data: FullScreen, width: FULL_SCREEN_ICON_SIZE, height: FULL_SCREEN_ICON_SIZE, className: b('icon') })))),
|
|
27
29
|
isOpened && (React.createElement(Modal, { open: isOpened, onClose: closeModal, className: b('modal') },
|
|
28
30
|
React.createElement("div", { className: b('modal-content') },
|
|
@@ -32,7 +32,7 @@ const Image = (props) => {
|
|
|
32
32
|
parallaxInterpolate = springScrollY.interpolate((value) => `translateY(-${Number(value) / parallaxLevel}px)`);
|
|
33
33
|
}
|
|
34
34
|
const imageClass = b('item', { withVideo: Boolean(video) && !hasVideoFallback }, imageClassName);
|
|
35
|
-
const
|
|
35
|
+
const renderFullscreenImage = (item) => {
|
|
36
36
|
const itemData = getMediaImage(item);
|
|
37
37
|
return (React.createElement(FullscreenImage, Object.assign({ key: itemData.alt }, itemData, { imageClassName: imageClass, imageStyle: { height } })));
|
|
38
38
|
};
|
|
@@ -47,13 +47,13 @@ const Image = (props) => {
|
|
|
47
47
|
};
|
|
48
48
|
const imageSlider = (imageArray) => {
|
|
49
49
|
const fullscreenItem = fullscreen === undefined || fullscreen;
|
|
50
|
-
return (React.createElement(SliderBlock, { slidesToShow: 1, type: SliderType.MediaCard }, imageArray.map((item) => fullscreenItem ?
|
|
50
|
+
return (React.createElement(SliderBlock, { slidesToShow: 1, type: SliderType.MediaCard }, imageArray.map((item) => fullscreenItem ? renderFullscreenImage(item) : imageOnly(item))));
|
|
51
51
|
};
|
|
52
52
|
if (Array.isArray(image)) {
|
|
53
53
|
return imageSlider(image);
|
|
54
54
|
}
|
|
55
55
|
if (fullscreen) {
|
|
56
|
-
return
|
|
56
|
+
return renderFullscreenImage(image);
|
|
57
57
|
}
|
|
58
58
|
return isBackground ? imageBackground(image) : imageOnly(image);
|
|
59
59
|
};
|
|
@@ -7,6 +7,8 @@ import Image from './Image/Image';
|
|
|
7
7
|
import Video from './Video/Video';
|
|
8
8
|
import './Media.css';
|
|
9
9
|
const b = block('Media');
|
|
10
|
+
// TODO delete along with fullScreen props
|
|
11
|
+
const getFullscreen = ({ fullScreen, fullscreen }) => fullScreen || fullscreen;
|
|
10
12
|
export const Media = (props) => {
|
|
11
13
|
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullScreen, fullscreen, analyticsEvents, } = props;
|
|
12
14
|
const { className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, } = props;
|
|
@@ -14,7 +16,7 @@ export const Media = (props) => {
|
|
|
14
16
|
const content = useMemo(() => {
|
|
15
17
|
let result = [];
|
|
16
18
|
if (image) {
|
|
17
|
-
result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback, fullscreen: fullScreen
|
|
19
|
+
result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback, fullscreen: getFullscreen({ fullScreen, fullscreen }) }));
|
|
18
20
|
}
|
|
19
21
|
if (video) {
|
|
20
22
|
const videoProps = {
|
|
@@ -31,7 +33,7 @@ export const Media = (props) => {
|
|
|
31
33
|
hasVideoFallback,
|
|
32
34
|
setHasVideoFallback,
|
|
33
35
|
};
|
|
34
|
-
if (fullScreen
|
|
36
|
+
if (getFullscreen({ fullScreen, fullscreen })) {
|
|
35
37
|
result.push(React.createElement(FullscreenVideo, Object.assign({}, videoProps)));
|
|
36
38
|
}
|
|
37
39
|
else {
|
|
@@ -39,7 +41,7 @@ export const Media = (props) => {
|
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
if (youtube) {
|
|
42
|
-
result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: fullScreen
|
|
44
|
+
result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: getFullscreen({ fullScreen, fullscreen }) }));
|
|
43
45
|
}
|
|
44
46
|
if (dataLens) {
|
|
45
47
|
result = React.createElement(DataLens, { dataLens: dataLens });
|
|
@@ -246,7 +246,7 @@ export interface LinkTableBlockProps extends BlockHeaderProps {
|
|
|
246
246
|
linkTheme?: LinkTheme;
|
|
247
247
|
}
|
|
248
248
|
export interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {
|
|
249
|
-
title
|
|
249
|
+
title?: TitleProps | string;
|
|
250
250
|
description?: string;
|
|
251
251
|
colSizes?: GridColumnSizesType;
|
|
252
252
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/page-constructor",
|
|
3
|
-
"version": "2.22.
|
|
3
|
+
"version": "2.22.1",
|
|
4
4
|
"description": "Gravity UI Page Constructor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -139,8 +139,5 @@
|
|
|
139
139
|
"*.{json,yaml,yml,md}": [
|
|
140
140
|
"prettier --write"
|
|
141
141
|
]
|
|
142
|
-
},
|
|
143
|
-
"publishConfig": {
|
|
144
|
-
"tag": "alpha"
|
|
145
142
|
}
|
|
146
143
|
}
|
|
@@ -246,7 +246,7 @@ export interface LinkTableBlockProps extends BlockHeaderProps {
|
|
|
246
246
|
linkTheme?: LinkTheme;
|
|
247
247
|
}
|
|
248
248
|
export interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {
|
|
249
|
-
title
|
|
249
|
+
title?: TitleProps | string;
|
|
250
250
|
description?: string;
|
|
251
251
|
colSizes?: GridColumnSizesType;
|
|
252
252
|
}
|