@gravity-ui/page-constructor 2.21.0 → 2.22.0-alpha.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/README.md +1 -1
- package/build/cjs/blocks/Header/schema.d.ts +18 -0
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +6 -0
- package/build/cjs/blocks/Media/schema.d.ts +12 -0
- package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +6 -0
- package/build/cjs/blocks/Security/schema.d.ts +6 -0
- package/build/cjs/blocks/Tabs/schema.d.ts +6 -0
- package/build/cjs/components/FullscreenImage/FullscreenImage.d.ts +2 -2
- package/build/cjs/components/FullscreenImage/FullscreenImage.js +5 -5
- package/build/cjs/components/FullscreenMedia/FullscreenMedia.d.ts +13 -0
- package/build/cjs/components/FullscreenMedia/{FullScreenMedia.js → FullscreenMedia.js} +3 -3
- package/build/cjs/components/Media/FullscreenVideo/FullscreenVideo.d.ts +4 -0
- package/build/cjs/components/Media/FullscreenVideo/FullscreenVideo.js +10 -0
- package/build/cjs/components/Media/Image/Image.d.ts +1 -0
- package/build/cjs/components/Media/Image/Image.js +10 -3
- package/build/cjs/components/Media/Media.js +25 -4
- package/build/cjs/components/Media/Video/Video.d.ts +1 -1
- package/build/cjs/components/VideoBlock/VideoBlock.d.ts +4 -0
- package/build/cjs/components/VideoBlock/VideoBlock.js +3 -3
- package/build/cjs/components/index.d.ts +1 -1
- package/build/cjs/components/index.js +2 -2
- package/build/cjs/constructor-items.d.ts +1 -1
- package/build/cjs/grid/Col/Col.d.ts +1 -1
- package/build/cjs/models/constructor-items/common.d.ts +4 -0
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +4 -0
- package/build/cjs/schema/validators/common.d.ts +6 -0
- package/build/cjs/schema/validators/common.js +6 -0
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +4 -4
- package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +9 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.js +2 -0
- package/build/cjs/sub-blocks/LayoutItem/utils.d.ts +2 -2
- package/build/cjs/sub-blocks/LayoutItem/utils.js +5 -5
- package/build/cjs/sub-blocks/MediaCard/schema.d.ts +6 -0
- package/build/esm/blocks/Header/schema.d.ts +18 -0
- package/build/esm/blocks/HeaderSlider/schema.d.ts +6 -0
- package/build/esm/blocks/Media/schema.d.ts +12 -0
- package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +6 -0
- package/build/esm/blocks/Security/schema.d.ts +6 -0
- package/build/esm/blocks/Tabs/Tabs.js +2 -2
- package/build/esm/blocks/Tabs/schema.d.ts +6 -0
- package/build/esm/components/FullscreenImage/FullscreenImage.d.ts +3 -3
- package/build/esm/components/FullscreenImage/FullscreenImage.js +6 -6
- package/build/esm/components/FullscreenMedia/FullscreenMedia.d.ts +14 -0
- package/build/esm/components/FullscreenMedia/{FullScreenMedia.js → FullscreenMedia.js} +4 -4
- package/build/esm/components/Media/FullscreenVideo/FullscreenVideo.d.ts +4 -0
- package/build/esm/components/Media/FullscreenVideo/FullscreenVideo.js +7 -0
- package/build/esm/components/Media/Image/Image.d.ts +1 -0
- package/build/esm/components/Media/Image/Image.js +12 -5
- package/build/esm/components/Media/Media.js +25 -4
- package/build/esm/components/Media/Video/Video.d.ts +1 -1
- package/build/esm/components/VideoBlock/VideoBlock.d.ts +4 -0
- package/build/esm/components/VideoBlock/VideoBlock.js +3 -3
- package/build/esm/components/index.d.ts +1 -1
- package/build/esm/components/index.js +1 -1
- package/build/esm/constructor-items.d.ts +1 -1
- package/build/esm/grid/Col/Col.d.ts +1 -1
- package/build/esm/models/constructor-items/common.d.ts +4 -0
- package/build/esm/models/constructor-items/sub-blocks.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/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +5 -5
- package/build/esm/sub-blocks/LayoutItem/schema.d.ts +9 -0
- package/build/esm/sub-blocks/LayoutItem/schema.js +2 -0
- package/build/esm/sub-blocks/LayoutItem/utils.d.ts +2 -2
- package/build/esm/sub-blocks/LayoutItem/utils.js +2 -2
- package/build/esm/sub-blocks/MediaCard/schema.d.ts +6 -0
- package/package.json +4 -1
- package/server/models/constructor-items/common.d.ts +4 -0
- package/server/models/constructor-items/sub-blocks.d.ts +4 -0
- package/build/cjs/components/FullscreenMedia/FullScreenMedia.d.ts +0 -9
- package/build/esm/components/FullscreenMedia/FullScreenMedia.d.ts +0 -10
- /package/build/cjs/components/FullscreenImage/{FullScreenImage.css → FullscreenImage.css} +0 -0
- /package/build/cjs/components/FullscreenMedia/{FullScreenMedia.css → FullscreenMedia.css} +0 -0
- /package/build/esm/components/FullscreenImage/{FullScreenImage.css → FullscreenImage.css} +0 -0
- /package/build/esm/components/FullscreenMedia/{FullScreenMedia.css → FullscreenMedia.css} +0 -0
|
@@ -131,6 +131,12 @@ export declare const Media: {
|
|
|
131
131
|
type: string;
|
|
132
132
|
})[];
|
|
133
133
|
};
|
|
134
|
+
fullScreen: {
|
|
135
|
+
type: string;
|
|
136
|
+
};
|
|
137
|
+
fullscreen: {
|
|
138
|
+
type: string;
|
|
139
|
+
};
|
|
134
140
|
};
|
|
135
141
|
};
|
|
136
142
|
export declare const MediaBlockBaseProps: {
|
|
@@ -608,6 +614,12 @@ export declare const MediaBlock: {
|
|
|
608
614
|
type: string;
|
|
609
615
|
})[];
|
|
610
616
|
};
|
|
617
|
+
fullScreen: {
|
|
618
|
+
type: string;
|
|
619
|
+
};
|
|
620
|
+
fullscreen: {
|
|
621
|
+
type: string;
|
|
622
|
+
};
|
|
611
623
|
};
|
|
612
624
|
};
|
|
613
625
|
description: {
|
|
@@ -2,7 +2,7 @@ import React, { Fragment, useContext, useRef, useState } from 'react';
|
|
|
2
2
|
import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
|
|
3
3
|
import BlockHeader from '../../components/BlockHeader/BlockHeader';
|
|
4
4
|
import ButtonTabs from '../../components/ButtonTabs/ButtonTabs';
|
|
5
|
-
import
|
|
5
|
+
import FullscreenImage from '../../components/FullscreenImage/FullscreenImage';
|
|
6
6
|
import { getMediaImage } from '../../components/Media/Image/utils';
|
|
7
7
|
import Media from '../../components/Media/Media';
|
|
8
8
|
import { getHeight } from '../../components/VideoBlock/VideoBlock';
|
|
@@ -44,7 +44,7 @@ export const TabsBlock = ({ items, title, description, animated, tabsColSizes, c
|
|
|
44
44
|
}, className: b('col', { centered: centered }) },
|
|
45
45
|
React.createElement("div", { ref: ref }, (activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) && (React.createElement(Media, Object.assign({}, getThemedValue(activeTabData.media, theme), { key: activeTab, className: b('media'), playVideo: play, height: mediaHeight })))),
|
|
46
46
|
imageProps && (React.createElement(Fragment, null,
|
|
47
|
-
React.createElement(
|
|
47
|
+
React.createElement(FullscreenImage, Object.assign({}, imageProps, { imageClassName: b('image') })))),
|
|
48
48
|
(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.caption) && React.createElement("p", { className: b('caption') }, activeTabData.caption)));
|
|
49
49
|
const onSelectTab = (id, e) => {
|
|
50
50
|
setActiveTab(id);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { ImageProps } from '../Image/Image';
|
|
3
|
-
import './
|
|
3
|
+
import './FullscreenImage.css';
|
|
4
4
|
export interface FullScreenImageProps extends ImageProps {
|
|
5
5
|
imageClassName?: string;
|
|
6
6
|
modalImageClass?: string;
|
|
7
7
|
imageStyle?: CSSProperties;
|
|
8
8
|
}
|
|
9
|
-
declare const
|
|
10
|
-
export default
|
|
9
|
+
declare const FullscreenImage: (props: FullScreenImageProps) => JSX.Element;
|
|
10
|
+
export default FullscreenImage;
|
|
@@ -4,20 +4,20 @@ import { FullScreen, PreviewClose } from '../../icons';
|
|
|
4
4
|
import { block } from '../../utils';
|
|
5
5
|
import Image from '../Image/Image';
|
|
6
6
|
import i18n from './i18n';
|
|
7
|
-
import './
|
|
7
|
+
import './FullscreenImage.css';
|
|
8
8
|
const b = block('FullScreenImage');
|
|
9
9
|
const FULL_SCREEN_ICON_SIZE = 18;
|
|
10
10
|
const CLOSE_ICON_SIZE = 30;
|
|
11
|
-
const
|
|
11
|
+
const FullscreenImage = (props) => {
|
|
12
12
|
const { imageClassName, modalImageClass, imageStyle, alt = i18n('img-alt') } = props;
|
|
13
13
|
const [isOpened, setIsOpened] = useState(false);
|
|
14
14
|
const [isMouseEnter, setIsMouseEnter] = useState(false);
|
|
15
15
|
const openModal = () => setIsOpened(true);
|
|
16
16
|
const closeModal = () => setIsOpened(false);
|
|
17
|
-
const
|
|
18
|
-
const
|
|
17
|
+
const showFullscreenIcon = () => setIsMouseEnter(true);
|
|
18
|
+
const hideFullscreenIcon = () => setIsMouseEnter(false);
|
|
19
19
|
return (React.createElement("div", { className: b() },
|
|
20
|
-
React.createElement("div", { className: b('image-wrapper'), onMouseEnter:
|
|
20
|
+
React.createElement("div", { className: b('image-wrapper'), onMouseEnter: showFullscreenIcon, onMouseLeave: hideFullscreenIcon },
|
|
21
21
|
React.createElement(Image, Object.assign({}, props, { alt: alt, className: b('image', imageClassName), onClick: openModal, style: imageStyle })),
|
|
22
22
|
React.createElement("div", { className: b('icon-wrapper', { visible: isMouseEnter }), onClick: openModal },
|
|
23
23
|
React.createElement(Icon, { data: FullScreen, width: FULL_SCREEN_ICON_SIZE, height: FULL_SCREEN_ICON_SIZE, className: b('icon') }))),
|
|
@@ -27,4 +27,4 @@ const FullScreenImage = (props) => {
|
|
|
27
27
|
React.createElement(Icon, { data: PreviewClose, width: CLOSE_ICON_SIZE, height: CLOSE_ICON_SIZE, className: b('icon', { hover: true }) })),
|
|
28
28
|
React.createElement(Image, Object.assign({}, props, { className: b('modal-image', modalImageClass) })))))));
|
|
29
29
|
};
|
|
30
|
-
export default
|
|
30
|
+
export default FullscreenImage;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MediaAllProps } from '../Media/Media';
|
|
3
|
+
import './FullscreenMedia.css';
|
|
4
|
+
export type ChildMediaRenderProps = Pick<MediaAllProps, 'fullScreen' | 'fullscreen' | 'imageClassName' | 'videoClassName' | 'youtubeClassName' | 'className'>;
|
|
5
|
+
export interface FullScreenMediaProps {
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated use showFullscreenIcon
|
|
8
|
+
*/
|
|
9
|
+
showFullScreenIcon?: boolean;
|
|
10
|
+
showFullscreenIcon?: boolean;
|
|
11
|
+
children: (props?: ChildMediaRenderProps) => JSX.Element;
|
|
12
|
+
}
|
|
13
|
+
declare const FullscreenMedia: ({ children, showFullScreenIcon, showFullscreenIcon, }: FullScreenMediaProps) => JSX.Element;
|
|
14
|
+
export default FullscreenMedia;
|
|
@@ -3,12 +3,12 @@ import { Icon, Modal } from '@gravity-ui/uikit';
|
|
|
3
3
|
import { MobileContext } from '../../context/mobileContext';
|
|
4
4
|
import { FullScreen, PreviewClose } from '../../icons';
|
|
5
5
|
import { block } from '../../utils';
|
|
6
|
-
import './
|
|
6
|
+
import './FullscreenMedia.css';
|
|
7
7
|
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
|
-
const
|
|
11
|
+
const FullscreenMedia = ({ children, showFullScreenIcon = true, showFullscreenIcon = true, }) => {
|
|
12
12
|
const [isOpened, setIsOpened] = useState(false);
|
|
13
13
|
const isMobile = useContext(MobileContext);
|
|
14
14
|
const openModal = (e) => {
|
|
@@ -22,7 +22,7 @@ const FullScreenMedia = ({ children, showFullScreenIcon = true }) => {
|
|
|
22
22
|
return (React.createElement("div", { className: b() },
|
|
23
23
|
React.createElement("div", { className: b('media-wrapper'), onClickCapture: openModal },
|
|
24
24
|
children({ className: b('inline-media') }),
|
|
25
|
-
showFullScreenIcon && (React.createElement("div", { className: b('icon-wrapper'), onClickCapture: openModal },
|
|
25
|
+
showFullScreenIcon && showFullscreenIcon && (React.createElement("div", { className: b('icon-wrapper'), onClickCapture: openModal },
|
|
26
26
|
React.createElement(Icon, { data: FullScreen, width: FULL_SCREEN_ICON_SIZE, height: FULL_SCREEN_ICON_SIZE, className: b('icon') })))),
|
|
27
27
|
isOpened && (React.createElement(Modal, { open: isOpened, onClose: closeModal, className: b('modal') },
|
|
28
28
|
React.createElement("div", { className: b('modal-content') },
|
|
@@ -35,4 +35,4 @@ const FullScreenMedia = ({ children, showFullScreenIcon = true }) => {
|
|
|
35
35
|
fullScreen: true,
|
|
36
36
|
}))))));
|
|
37
37
|
};
|
|
38
|
-
export default
|
|
38
|
+
export default FullscreenMedia;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import FullscreenMedia from '../../FullscreenMedia/FullscreenMedia';
|
|
3
|
+
import Video from '../Video/Video';
|
|
4
|
+
const FullscreenVideo = (props) => {
|
|
5
|
+
return (React.createElement(FullscreenMedia, null, (classNames) => React.createElement(Video, Object.assign({}, props, classNames))));
|
|
6
|
+
};
|
|
7
|
+
export default FullscreenVideo;
|
|
@@ -5,13 +5,13 @@ import SliderBlock from '../../../blocks/Slider/Slider';
|
|
|
5
5
|
import { SliderType } from '../../../models';
|
|
6
6
|
import { block } from '../../../utils';
|
|
7
7
|
import BackgroundImage from '../../BackgroundImage/BackgroundImage';
|
|
8
|
-
import
|
|
8
|
+
import FullscreenImage from '../../FullscreenImage/FullscreenImage';
|
|
9
9
|
import ImageView from '../../Image/Image';
|
|
10
10
|
import { getMediaImage } from './utils';
|
|
11
11
|
import './Image.css';
|
|
12
12
|
const b = block('media-component-image');
|
|
13
13
|
const Image = (props) => {
|
|
14
|
-
const { parallax, image, height, imageClassName, isBackground, hasVideoFallback, video } = props;
|
|
14
|
+
const { parallax, image, height, imageClassName, isBackground, hasVideoFallback, video, fullscreen, } = props;
|
|
15
15
|
const [scrollY, setScrollY] = useState(0);
|
|
16
16
|
const [{ springScrollY }, springSetScrollY] = useSpring(() => ({
|
|
17
17
|
springScrollY: 0,
|
|
@@ -32,10 +32,10 @@ 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 fullscreenImage = (item) => {
|
|
36
36
|
const itemData = getMediaImage(item);
|
|
37
|
-
return (React.createElement(
|
|
38
|
-
}
|
|
37
|
+
return (React.createElement(FullscreenImage, Object.assign({ key: itemData.alt }, itemData, { imageClassName: imageClass, imageStyle: { height } })));
|
|
38
|
+
};
|
|
39
39
|
const imageBackground = (oneImage) => {
|
|
40
40
|
const imageData = getMediaImage(oneImage);
|
|
41
41
|
return (React.createElement(animated.div, { style: { transform: parallaxInterpolate } },
|
|
@@ -45,9 +45,16 @@ const Image = (props) => {
|
|
|
45
45
|
const imageData = getMediaImage(oneImage);
|
|
46
46
|
return React.createElement(ImageView, Object.assign({}, imageData, { className: imageClass, style: { height } }));
|
|
47
47
|
};
|
|
48
|
+
const imageSlider = (imageArray) => {
|
|
49
|
+
const fullscreenItem = fullscreen === undefined || fullscreen;
|
|
50
|
+
return (React.createElement(SliderBlock, { slidesToShow: 1, type: SliderType.MediaCard }, imageArray.map((item) => fullscreenItem ? fullscreenImage(item) : imageOnly(item))));
|
|
51
|
+
};
|
|
48
52
|
if (Array.isArray(image)) {
|
|
49
53
|
return imageSlider(image);
|
|
50
54
|
}
|
|
55
|
+
if (fullscreen) {
|
|
56
|
+
return fullscreenImage(image);
|
|
57
|
+
}
|
|
51
58
|
return isBackground ? imageBackground(image) : imageOnly(image);
|
|
52
59
|
};
|
|
53
60
|
export default Image;
|
|
@@ -2,24 +2,44 @@ import React, { useMemo, useState } from 'react';
|
|
|
2
2
|
import { block } from '../../utils';
|
|
3
3
|
import YoutubeBlock from '../VideoBlock/VideoBlock';
|
|
4
4
|
import DataLens from './DataLens/DataLens';
|
|
5
|
+
import FullscreenVideo from './FullscreenVideo/FullscreenVideo';
|
|
5
6
|
import Image from './Image/Image';
|
|
6
7
|
import Video from './Video/Video';
|
|
7
8
|
import './Media.css';
|
|
8
9
|
const b = block('Media');
|
|
9
10
|
export const Media = (props) => {
|
|
10
|
-
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullScreen, analyticsEvents, } = props;
|
|
11
|
+
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullScreen, fullscreen, analyticsEvents, } = props;
|
|
11
12
|
const { className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, } = props;
|
|
12
13
|
const [hasVideoFallback, setHasVideoFallback] = useState(false);
|
|
13
14
|
const content = useMemo(() => {
|
|
14
15
|
let result = [];
|
|
15
16
|
if (image) {
|
|
16
|
-
result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback }));
|
|
17
|
+
result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback, fullscreen: fullScreen || fullscreen }));
|
|
17
18
|
}
|
|
18
19
|
if (video) {
|
|
19
|
-
|
|
20
|
+
const videoProps = {
|
|
21
|
+
key: 'video',
|
|
22
|
+
video,
|
|
23
|
+
videoClassName,
|
|
24
|
+
height,
|
|
25
|
+
metrika,
|
|
26
|
+
analyticsEvents,
|
|
27
|
+
playVideo,
|
|
28
|
+
previewImg,
|
|
29
|
+
playButton,
|
|
30
|
+
customBarControlsClassName,
|
|
31
|
+
hasVideoFallback,
|
|
32
|
+
setHasVideoFallback,
|
|
33
|
+
};
|
|
34
|
+
if (fullScreen || fullscreen) {
|
|
35
|
+
result.push(React.createElement(FullscreenVideo, Object.assign({}, videoProps)));
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
result.push(React.createElement(Video, Object.assign({}, videoProps)));
|
|
39
|
+
}
|
|
20
40
|
}
|
|
21
41
|
if (youtube) {
|
|
22
|
-
result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height,
|
|
42
|
+
result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: fullScreen || fullscreen }));
|
|
23
43
|
}
|
|
24
44
|
if (dataLens) {
|
|
25
45
|
result = React.createElement(DataLens, { dataLens: dataLens });
|
|
@@ -44,6 +64,7 @@ export const Media = (props) => {
|
|
|
44
64
|
customBarControlsClassName,
|
|
45
65
|
youtubeClassName,
|
|
46
66
|
fullScreen,
|
|
67
|
+
fullscreen,
|
|
47
68
|
]);
|
|
48
69
|
return (React.createElement("div", { className: b(null, className), style: { backgroundColor: color } }, content));
|
|
49
70
|
};
|
|
@@ -11,6 +11,6 @@ interface InnerVideoProps {
|
|
|
11
11
|
setHasVideoFallback: React.Dispatch<boolean>;
|
|
12
12
|
hasVideoFallback: boolean;
|
|
13
13
|
}
|
|
14
|
-
type VideoAllProps = VideoAdditionProps & MediaComponentVideoProps & InnerVideoProps;
|
|
14
|
+
export type VideoAllProps = VideoAdditionProps & MediaComponentVideoProps & InnerVideoProps;
|
|
15
15
|
declare const Video: (props: VideoAllProps) => JSX.Element | null;
|
|
16
16
|
export default Video;
|
|
@@ -14,7 +14,11 @@ export interface VideoBlockProps {
|
|
|
14
14
|
previewImg?: string;
|
|
15
15
|
playButton?: React.ReactNode;
|
|
16
16
|
height?: number;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated use fullscreen
|
|
19
|
+
*/
|
|
17
20
|
fullScreen?: boolean;
|
|
21
|
+
fullscreen?: boolean;
|
|
18
22
|
}
|
|
19
23
|
declare const VideoBlock: (props: VideoBlockProps) => JSX.Element | null;
|
|
20
24
|
export default VideoBlock;
|
|
@@ -35,7 +35,7 @@ export function getHeight(width) {
|
|
|
35
35
|
return (width / 16) * 9;
|
|
36
36
|
}
|
|
37
37
|
const VideoBlock = (props) => {
|
|
38
|
-
const { stream, record, attributes, className, id, previewImg, playButton, height, fullScreen } = props;
|
|
38
|
+
const { stream, record, attributes, className, id, previewImg, playButton, height, fullScreen, fullscreen, } = props;
|
|
39
39
|
const src = getVideoSrc(stream, record);
|
|
40
40
|
const ref = useRef(null);
|
|
41
41
|
const iframeRef = useRef();
|
|
@@ -78,14 +78,14 @@ const VideoBlock = (props) => {
|
|
|
78
78
|
ref.current.appendChild(iframe);
|
|
79
79
|
iframeRef.current = iframe;
|
|
80
80
|
}
|
|
81
|
-
}, [stream, record, norender, src, fullId, attributes, iframeRef, fullScreen]);
|
|
81
|
+
}, [stream, record, norender, src, fullId, attributes, iframeRef, fullScreen, fullscreen]);
|
|
82
82
|
useEffect(() => {
|
|
83
83
|
setHidePreview(false);
|
|
84
84
|
}, [src, setHidePreview]);
|
|
85
85
|
if (norender) {
|
|
86
86
|
return null;
|
|
87
87
|
}
|
|
88
|
-
return (React.createElement("div", { className: b(null, className), ref: ref, style: { height: currentHeight } }, previewImg && !hidePreview && !fullScreen && (React.createElement("div", { className: b('preview'), onClick: onPreviewClick },
|
|
88
|
+
return (React.createElement("div", { className: b(null, className), ref: ref, style: { height: currentHeight } }, previewImg && !hidePreview && !fullScreen && !fullscreen && (React.createElement("div", { className: b('preview'), onClick: onPreviewClick },
|
|
89
89
|
React.createElement(Image, { src: previewImg, className: b('image'), containerClassName: b('image-wrapper') }),
|
|
90
90
|
playButton || (React.createElement("button", { className: b('button') },
|
|
91
91
|
React.createElement(Icon, { className: b('icon'), data: PlayVideo, size: 24 })))))));
|
|
@@ -35,6 +35,6 @@ export { default as Author } from './Author/Author';
|
|
|
35
35
|
export { default as RouterLink } from './RouterLink/RouterLink';
|
|
36
36
|
export { default as HTML } from './HTML/HTML';
|
|
37
37
|
export { default as MetaInfo } from './MetaInfo/MetaInfo';
|
|
38
|
-
export { default as FullScreenMedia } from './FullscreenMedia/
|
|
38
|
+
export { default as FullScreenMedia } from './FullscreenMedia/FullscreenMedia';
|
|
39
39
|
export type { RouterLinkProps } from './RouterLink/RouterLink';
|
|
40
40
|
export type { ImageBaseProps } from './ImageBase/ImageBase';
|
|
@@ -35,4 +35,4 @@ export { default as Author } from './Author/Author';
|
|
|
35
35
|
export { default as RouterLink } from './RouterLink/RouterLink';
|
|
36
36
|
export { default as HTML } from './HTML/HTML';
|
|
37
37
|
export { default as MetaInfo } from './MetaInfo/MetaInfo';
|
|
38
|
-
export { default as FullScreenMedia } from './FullscreenMedia/
|
|
38
|
+
export { default as FullScreenMedia } from './FullscreenMedia/FullscreenMedia';
|
|
@@ -36,7 +36,7 @@ export declare const subBlockMap: {
|
|
|
36
36
|
"media-card": ({ border, ...mediaProps }: import("./models").MediaCardProps) => JSX.Element;
|
|
37
37
|
"banner-card": (props: import("./models").BannerCardProps) => JSX.Element;
|
|
38
38
|
"news-card": (props: import("./models").NewsCardProps) => JSX.Element;
|
|
39
|
-
"layout-item": ({ content: { links, ...content }, metaInfo, media, border, fullScreen, className, }: import("./models").LayoutItemProps) => JSX.Element;
|
|
39
|
+
"layout-item": ({ content: { links, ...content }, metaInfo, media, border, fullScreen, fullscreen, className, }: import("./models").LayoutItemProps) => JSX.Element;
|
|
40
40
|
/**
|
|
41
41
|
* @deprecated Use LayoutItem
|
|
42
42
|
*/
|
|
@@ -7,4 +7,4 @@ export interface GridColumnProps extends GridColumnClassParams, Refable<HTMLDivE
|
|
|
7
7
|
dataQa?: string;
|
|
8
8
|
children?: React.ReactNode;
|
|
9
9
|
}
|
|
10
|
-
export declare const Col: React.ForwardRefExoticComponent<Pick<WithChildren<GridColumnProps>, "style" | "children" | "className" | "reset" | "
|
|
10
|
+
export declare const Col: React.ForwardRefExoticComponent<Pick<WithChildren<GridColumnProps>, "style" | "children" | "className" | "reset" | "visible" | "sizes" | "offsets" | "orders" | "hidden" | "alignSelf" | "justifyContent" | "dataQa"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -174,7 +174,11 @@ export interface MediaComponentVideoProps extends AnalyticsEventsBase {
|
|
|
174
174
|
export interface MediaComponentYoutubeProps {
|
|
175
175
|
youtube: string;
|
|
176
176
|
previewImg?: string;
|
|
177
|
+
/**
|
|
178
|
+
* @deprecated use fullscreen
|
|
179
|
+
*/
|
|
177
180
|
fullScreen?: boolean;
|
|
181
|
+
fullscreen?: boolean;
|
|
178
182
|
}
|
|
179
183
|
export interface MediaComponentImageProps {
|
|
180
184
|
image: ImageProps | ImageProps[] | ImageDeviceProps;
|
|
@@ -136,7 +136,11 @@ export interface LayoutItemProps extends ClassNameProps {
|
|
|
136
136
|
media: MediaProps;
|
|
137
137
|
metaInfo?: string[];
|
|
138
138
|
border?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* @deprecated use fullscreen
|
|
141
|
+
*/
|
|
139
142
|
fullScreen?: boolean;
|
|
143
|
+
fullscreen?: boolean;
|
|
140
144
|
}
|
|
141
145
|
export type DividerModel = {
|
|
142
146
|
type: SubBlockType.Divider;
|
|
@@ -1114,6 +1114,12 @@ export declare const MediaProps: {
|
|
|
1114
1114
|
type: string;
|
|
1115
1115
|
})[];
|
|
1116
1116
|
};
|
|
1117
|
+
fullScreen: {
|
|
1118
|
+
type: string;
|
|
1119
|
+
};
|
|
1120
|
+
fullscreen: {
|
|
1121
|
+
type: string;
|
|
1122
|
+
};
|
|
1117
1123
|
};
|
|
1118
1124
|
export declare const YMapMarkerLabel: {
|
|
1119
1125
|
type: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { LayoutItemProps } from '../../models';
|
|
2
2
|
import './LayoutItem.css';
|
|
3
|
-
declare const LayoutItem: ({ content: { links, ...content }, metaInfo, media, border, fullScreen, className, }: LayoutItemProps) => JSX.Element;
|
|
3
|
+
declare const LayoutItem: ({ content: { links, ...content }, metaInfo, media, border, fullScreen, fullscreen, className, }: LayoutItemProps) => JSX.Element;
|
|
4
4
|
export default LayoutItem;
|
|
@@ -3,15 +3,15 @@ import React from 'react';
|
|
|
3
3
|
import { Content } from '..';
|
|
4
4
|
import { FullScreenMedia, Media, MetaInfo } from '../../components';
|
|
5
5
|
import { block } from '../../utils';
|
|
6
|
-
import { getLayoutItemLinks,
|
|
6
|
+
import { getLayoutItemLinks, hasFullscreen, showFullscreenIcon } from './utils';
|
|
7
7
|
import './LayoutItem.css';
|
|
8
8
|
const b = block('layout-item');
|
|
9
9
|
const LayoutItem = (_a) => {
|
|
10
|
-
var _b = _a.content, { links } = _b, content = __rest(_b, ["links"]), { metaInfo, media, border, fullScreen, className } = _a;
|
|
10
|
+
var _b = _a.content, { links } = _b, content = __rest(_b, ["links"]), { metaInfo, media, border, fullScreen, fullscreen, className } = _a;
|
|
11
11
|
return (React.createElement("div", { className: b(null, className) },
|
|
12
|
-
fullScreen &&
|
|
13
|
-
var { className: mediaClassName } = _a,
|
|
14
|
-
return (React.createElement(Media, Object.assign({}, media,
|
|
12
|
+
(fullScreen || fullscreen) && hasFullscreen(media) ? (React.createElement(FullScreenMedia, { showFullscreenIcon: showFullscreenIcon(media) }, (_a = {}) => {
|
|
13
|
+
var { className: mediaClassName, fullScreen: _fullScreen } = _a, fullscreenMediaProps = __rest(_a, ["className", "fullScreen"]);
|
|
14
|
+
return (React.createElement(Media, Object.assign({}, media, fullscreenMediaProps, { className: b('media', { border }, mediaClassName) })));
|
|
15
15
|
})) : (React.createElement(Media, Object.assign({}, media, { className: b('media', { border }) }))),
|
|
16
16
|
metaInfo && React.createElement(MetaInfo, { items: metaInfo, className: b('meta-info') }),
|
|
17
17
|
React.createElement("div", { className: b('content') },
|
|
@@ -132,6 +132,12 @@ export declare const LayoutItem: {
|
|
|
132
132
|
type: string;
|
|
133
133
|
})[];
|
|
134
134
|
};
|
|
135
|
+
fullScreen: {
|
|
136
|
+
type: string;
|
|
137
|
+
};
|
|
138
|
+
fullscreen: {
|
|
139
|
+
type: string;
|
|
140
|
+
};
|
|
135
141
|
};
|
|
136
142
|
content: Partial<{
|
|
137
143
|
title: {
|
|
@@ -212,6 +218,9 @@ export declare const LayoutItem: {
|
|
|
212
218
|
fullScreen: {
|
|
213
219
|
type: string;
|
|
214
220
|
};
|
|
221
|
+
fullscreen: {
|
|
222
|
+
type: string;
|
|
223
|
+
};
|
|
215
224
|
type: {};
|
|
216
225
|
when: {};
|
|
217
226
|
};
|
|
@@ -24,5 +24,5 @@ export declare const getLayoutItemLinks: (links: LayoutItemProps['content']['lin
|
|
|
24
24
|
}[] | undefined;
|
|
25
25
|
className?: string | undefined;
|
|
26
26
|
}[] | undefined;
|
|
27
|
-
export declare const
|
|
28
|
-
export declare const
|
|
27
|
+
export declare const hasFullscreen: ({ dataLens, image }: MediaProps) => boolean;
|
|
28
|
+
export declare const showFullscreenIcon: ({ youtube }: MediaProps) => boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const getLayoutItemLinks = (links) => links === null || links === void 0 ? void 0 : links.map((link) => (Object.assign({ theme: 'normal' }, link)));
|
|
2
|
-
export const
|
|
2
|
+
export const hasFullscreen = ({ dataLens, image }) => {
|
|
3
3
|
// datalens and slider media card don't support fullScreen mode
|
|
4
4
|
return !(dataLens || Array.isArray(image));
|
|
5
5
|
};
|
|
6
|
-
export const
|
|
6
|
+
export const showFullscreenIcon = ({ youtube }) => !youtube;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/page-constructor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.22.0-alpha.0",
|
|
4
4
|
"description": "Gravity UI Page Constructor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -139,5 +139,8 @@
|
|
|
139
139
|
"*.{json,yaml,yml,md}": [
|
|
140
140
|
"prettier --write"
|
|
141
141
|
]
|
|
142
|
+
},
|
|
143
|
+
"publishConfig": {
|
|
144
|
+
"tag": "alpha"
|
|
142
145
|
}
|
|
143
146
|
}
|
|
@@ -174,7 +174,11 @@ export interface MediaComponentVideoProps extends AnalyticsEventsBase {
|
|
|
174
174
|
export interface MediaComponentYoutubeProps {
|
|
175
175
|
youtube: string;
|
|
176
176
|
previewImg?: string;
|
|
177
|
+
/**
|
|
178
|
+
* @deprecated use fullscreen
|
|
179
|
+
*/
|
|
177
180
|
fullScreen?: boolean;
|
|
181
|
+
fullscreen?: boolean;
|
|
178
182
|
}
|
|
179
183
|
export interface MediaComponentImageProps {
|
|
180
184
|
image: ImageProps | ImageProps[] | ImageDeviceProps;
|
|
@@ -136,7 +136,11 @@ export interface LayoutItemProps extends ClassNameProps {
|
|
|
136
136
|
media: MediaProps;
|
|
137
137
|
metaInfo?: string[];
|
|
138
138
|
border?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* @deprecated use fullscreen
|
|
141
|
+
*/
|
|
139
142
|
fullScreen?: boolean;
|
|
143
|
+
fullscreen?: boolean;
|
|
140
144
|
}
|
|
141
145
|
export type DividerModel = {
|
|
142
146
|
type: SubBlockType.Divider;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { MediaAllProps } from '../Media/Media';
|
|
3
|
-
export type ChildMediaRenderProps = Pick<MediaAllProps, 'fullScreen' | 'imageClassName' | 'videoClassName' | 'youtubeClassName' | 'className'>;
|
|
4
|
-
export interface FullScreenMediaProps {
|
|
5
|
-
showFullScreenIcon?: boolean;
|
|
6
|
-
children: (props?: ChildMediaRenderProps) => JSX.Element;
|
|
7
|
-
}
|
|
8
|
-
declare const FullScreenMedia: ({ children, showFullScreenIcon }: FullScreenMediaProps) => JSX.Element;
|
|
9
|
-
export default FullScreenMedia;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { MediaAllProps } from '../Media/Media';
|
|
3
|
-
import './FullScreenMedia.css';
|
|
4
|
-
export type ChildMediaRenderProps = Pick<MediaAllProps, 'fullScreen' | 'imageClassName' | 'videoClassName' | 'youtubeClassName' | 'className'>;
|
|
5
|
-
export interface FullScreenMediaProps {
|
|
6
|
-
showFullScreenIcon?: boolean;
|
|
7
|
-
children: (props?: ChildMediaRenderProps) => JSX.Element;
|
|
8
|
-
}
|
|
9
|
-
declare const FullScreenMedia: ({ children, showFullScreenIcon }: FullScreenMediaProps) => JSX.Element;
|
|
10
|
-
export default FullScreenMedia;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|