@gravity-ui/page-constructor 1.9.0 → 1.9.1-alpha.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 +7 -0
- package/build/cjs/{components → blocks}/Share/Share.css +0 -0
- package/build/cjs/blocks/Share/Share.d.ts +3 -0
- package/build/cjs/{components → blocks}/Share/Share.js +0 -0
- package/build/cjs/{components → blocks}/Share/i18n/en.json +0 -0
- package/build/cjs/{components → blocks}/Share/i18n/index.d.ts +0 -0
- package/build/cjs/{components → blocks}/Share/i18n/index.js +0 -0
- package/build/cjs/{components → blocks}/Share/i18n/ru.json +0 -0
- package/build/cjs/blocks/Share/schema.d.ts +24 -0
- package/build/cjs/blocks/Share/schema.js +19 -0
- package/build/cjs/blocks/Tabs/Tabs.js +6 -1
- package/build/cjs/blocks/index.d.ts +1 -0
- package/build/cjs/blocks/index.js +3 -1
- package/build/cjs/blocks/validators.d.ts +1 -0
- package/build/cjs/blocks/validators.js +1 -0
- package/build/cjs/components/Media/Media.js +1 -1
- package/build/cjs/components/Media/Video/Video.js +4 -3
- package/build/cjs/components/ReactPlayer/ReactPlayer.d.ts +1 -0
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +5 -5
- package/build/cjs/components/VideoBlock/VideoBlock.d.ts +2 -0
- package/build/cjs/components/VideoBlock/VideoBlock.js +7 -6
- package/build/cjs/constructor-items.d.ts +1 -0
- package/build/cjs/constructor-items.js +1 -0
- package/build/cjs/models/components.d.ts +0 -6
- package/build/cjs/models/components.js +0 -8
- package/build/cjs/models/constructor-items/blocks.d.ts +16 -2
- package/build/cjs/models/constructor-items/blocks.js +9 -1
- package/build/cjs/schema/index.js +1 -1
- package/build/cjs/schema/validators/blocks.d.ts +1 -0
- package/build/cjs/schema/validators/blocks.js +1 -0
- package/build/cjs/text-transform/blocks.js +6 -0
- package/build/esm/{components → blocks}/Share/Share.css +0 -0
- package/build/esm/blocks/Share/Share.d.ts +4 -0
- package/build/esm/{components → blocks}/Share/Share.js +0 -0
- package/build/esm/{components → blocks}/Share/i18n/en.json +0 -0
- package/build/esm/{components → blocks}/Share/i18n/index.d.ts +0 -0
- package/build/esm/{components → blocks}/Share/i18n/index.js +0 -0
- package/build/esm/{components → blocks}/Share/i18n/ru.json +0 -0
- package/build/esm/blocks/Share/schema.d.ts +24 -0
- package/build/esm/blocks/Share/schema.js +16 -0
- package/build/esm/blocks/Tabs/Tabs.js +7 -2
- package/build/esm/blocks/index.d.ts +1 -0
- package/build/esm/blocks/index.js +1 -0
- package/build/esm/blocks/validators.d.ts +1 -0
- package/build/esm/blocks/validators.js +1 -0
- package/build/esm/components/Media/Media.js +1 -1
- package/build/esm/components/Media/Video/Video.js +4 -3
- package/build/esm/components/ReactPlayer/ReactPlayer.d.ts +1 -0
- package/build/esm/components/ReactPlayer/ReactPlayer.js +5 -5
- package/build/esm/components/VideoBlock/VideoBlock.d.ts +2 -0
- package/build/esm/components/VideoBlock/VideoBlock.js +6 -6
- package/build/esm/constructor-items.d.ts +1 -0
- package/build/esm/constructor-items.js +2 -1
- package/build/esm/models/components.d.ts +0 -6
- package/build/esm/models/components.js +1 -7
- package/build/esm/models/constructor-items/blocks.d.ts +16 -2
- package/build/esm/models/constructor-items/blocks.js +8 -0
- package/build/esm/schema/index.js +2 -2
- package/build/esm/schema/validators/blocks.d.ts +1 -0
- package/build/esm/schema/validators/blocks.js +1 -0
- package/build/esm/text-transform/blocks.js +6 -0
- package/package.json +4 -1
- package/server/models/components.d.ts +0 -6
- package/server/models/components.js +0 -8
- package/server/models/constructor-items/blocks.d.ts +16 -2
- package/server/models/constructor-items/blocks.js +9 -1
- package/server/text-transform/blocks.js +6 -0
- package/build/cjs/components/Share/Share.d.ts +0 -7
- package/build/esm/components/Share/Share.d.ts +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.9.1](https://github.com/gravity-ui/page-constructor/compare/v1.9.0...v1.9.1) (2022-12-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **Tabs:** player video height ([a372ddb](https://github.com/gravity-ui/page-constructor/commit/a372ddbbde003ef82818ba167adbff0e8bf57905))
|
|
9
|
+
|
|
3
10
|
## [1.9.0](https://github.com/gravity-ui/page-constructor/compare/v1.8.2...v1.9.0) (2022-12-05)
|
|
4
11
|
|
|
5
12
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const ShareBlock: {
|
|
2
|
+
'share-block': {
|
|
3
|
+
additionalProperties: boolean;
|
|
4
|
+
required: string[];
|
|
5
|
+
properties: {
|
|
6
|
+
title: {
|
|
7
|
+
type: string;
|
|
8
|
+
};
|
|
9
|
+
items: {
|
|
10
|
+
type: string;
|
|
11
|
+
items: {
|
|
12
|
+
type: string;
|
|
13
|
+
properties: {
|
|
14
|
+
when: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
type: {};
|
|
21
|
+
when: {};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ShareBlock = void 0;
|
|
4
|
+
const utils_1 = require("../../schema/validators/utils");
|
|
5
|
+
const common_1 = require("../../schema/validators/common");
|
|
6
|
+
exports.ShareBlock = {
|
|
7
|
+
'share-block': {
|
|
8
|
+
additionalProperties: false,
|
|
9
|
+
required: ['items'],
|
|
10
|
+
properties: Object.assign(Object.assign({}, common_1.BaseProps), { title: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
}, items: (0, utils_1.filteredArray)({
|
|
13
|
+
properties: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
enum: ['telegram', 'facebook', 'twitter', 'vk'],
|
|
16
|
+
},
|
|
17
|
+
}) }),
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -13,14 +13,19 @@ const ThemeValueContext_1 = require("../../context/theme/ThemeValueContext");
|
|
|
13
13
|
const utils_2 = require("../../components/Media/Image/utils");
|
|
14
14
|
const ButtonTabs_1 = (0, tslib_1.__importDefault)(require("../../components/ButtonTabs/ButtonTabs"));
|
|
15
15
|
const sub_blocks_1 = require("../../sub-blocks");
|
|
16
|
+
const VideoBlock_1 = require("../../components/VideoBlock/VideoBlock");
|
|
16
17
|
const b = (0, utils_1.block)('tabs-block');
|
|
17
18
|
const TabsBlock = ({ items, title, description, animated, tabsColSizes, centered, direction = 'media-content', }) => {
|
|
19
|
+
var _a;
|
|
18
20
|
const [activeTab, setActiveTab] = (0, react_1.useState)(items[0].tabName);
|
|
19
21
|
const [play, setPlay] = (0, react_1.useState)(false);
|
|
20
22
|
const { themeValue: theme } = (0, react_1.useContext)(ThemeValueContext_1.ThemeValueContext);
|
|
21
23
|
const tabs = items.map(({ tabName }) => ({ title: tabName, id: tabName }));
|
|
22
24
|
const activeTabData = items.find(({ tabName }) => tabName === activeTab);
|
|
23
25
|
const isReverse = direction === 'content-media';
|
|
26
|
+
const ref = (0, react_1.useRef)(null);
|
|
27
|
+
const mediaWidth = (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.offsetWidth;
|
|
28
|
+
const mediaHeight = mediaWidth && (0, VideoBlock_1.getHeight)(mediaWidth);
|
|
24
29
|
let imageProps;
|
|
25
30
|
if (activeTabData) {
|
|
26
31
|
const themedImage = (0, utils_1.getThemedValue)(activeTabData.image, theme);
|
|
@@ -40,7 +45,7 @@ const TabsBlock = ({ items, title, description, animated, tabsColSizes, centered
|
|
|
40
45
|
all: grid_1.GridColumnOrderClasses.Last,
|
|
41
46
|
md: grid_1.GridColumnOrderClasses.First,
|
|
42
47
|
}, className: b('col', { centered: centered }) },
|
|
43
|
-
(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) && (react_1.default.createElement(Media_1.default, Object.assign({}, (0, utils_1.getThemedValue)(activeTabData.media, theme), { key: activeTab, className: b('media'), playVideo: play }))),
|
|
48
|
+
react_1.default.createElement("div", { ref: ref }, (activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) && (react_1.default.createElement(Media_1.default, Object.assign({}, (0, utils_1.getThemedValue)(activeTabData.media, theme), { key: activeTab, className: b('media'), playVideo: play, height: mediaHeight })))),
|
|
44
49
|
imageProps && (react_1.default.createElement(react_1.Fragment, null,
|
|
45
50
|
react_1.default.createElement(FullscreenImage_1.default, Object.assign({}, imageProps, { imageClassName: b('image') })),
|
|
46
51
|
(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.caption) && (react_1.default.createElement("p", { className: b('caption') }, activeTabData.caption))))));
|
|
@@ -17,3 +17,4 @@ export { default as IconsBlock } from './Icons/Icons';
|
|
|
17
17
|
export { default as HeaderSliderBlock } from './HeaderSlider/HeaderSlider';
|
|
18
18
|
export { default as CardLayoutBlock } from './CardLayout/CardLayout';
|
|
19
19
|
export { default as ContentLayoutBlock } from './ContentLayout/ContentLayout';
|
|
20
|
+
export { default as ShareBlock } from './Share/Share';
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ContentLayoutBlock = exports.CardLayoutBlock = exports.HeaderSliderBlock = exports.IconsBlock = exports.HeaderBlock = exports.LinkTableBlock = exports.TabsBlock = exports.TableBlock = exports.QuestionsBlock = exports.PromoFeaturesBlock = exports.ExtendedFeaturesBlock = exports.SliderBlock = exports.SecurityBlock = exports.PreviewBlock = exports.MediaBlock = exports.InfoBlock = exports.SimpleBlock = exports.CompaniesBlock = exports.BannerBlock = void 0;
|
|
6
|
+
exports.ShareBlock = exports.ContentLayoutBlock = exports.CardLayoutBlock = exports.HeaderSliderBlock = exports.IconsBlock = exports.HeaderBlock = exports.LinkTableBlock = exports.TabsBlock = exports.TableBlock = exports.QuestionsBlock = exports.PromoFeaturesBlock = exports.ExtendedFeaturesBlock = exports.SliderBlock = exports.SecurityBlock = exports.PreviewBlock = exports.MediaBlock = exports.InfoBlock = exports.SimpleBlock = exports.CompaniesBlock = exports.BannerBlock = void 0;
|
|
7
7
|
var Banner_1 = require("./Banner/Banner");
|
|
8
8
|
Object.defineProperty(exports, "BannerBlock", { enumerable: true, get: function () { return __importDefault(Banner_1).default; } });
|
|
9
9
|
var Companies_1 = require("./Companies/Companies");
|
|
@@ -42,3 +42,5 @@ var CardLayout_1 = require("./CardLayout/CardLayout");
|
|
|
42
42
|
Object.defineProperty(exports, "CardLayoutBlock", { enumerable: true, get: function () { return __importDefault(CardLayout_1).default; } });
|
|
43
43
|
var ContentLayout_1 = require("./ContentLayout/ContentLayout");
|
|
44
44
|
Object.defineProperty(exports, "ContentLayoutBlock", { enumerable: true, get: function () { return __importDefault(ContentLayout_1).default; } });
|
|
45
|
+
var Share_1 = require("./Share/Share");
|
|
46
|
+
Object.defineProperty(exports, "ShareBlock", { enumerable: true, get: function () { return __importDefault(Share_1).default; } });
|
|
@@ -19,3 +19,4 @@ const tslib_1 = require("tslib");
|
|
|
19
19
|
(0, tslib_1.__exportStar)(require("./Simple/schema"), exports);
|
|
20
20
|
(0, tslib_1.__exportStar)(require("./Slider/schema"), exports);
|
|
21
21
|
(0, tslib_1.__exportStar)(require("./Table/schema"), exports);
|
|
22
|
+
(0, tslib_1.__exportStar)(require("./Share/schema"), exports);
|
|
@@ -22,7 +22,7 @@ const Media = (props) => {
|
|
|
22
22
|
result.push(react_1.default.createElement(Video_1.default, { key: "video", video: video, videoClassName: videoClassName, height: height, metrika: metrika, playVideo: playVideo, previewImg: previewImg, playButton: playButton, customBarControlsClassName: customBarControlsClassName, hasVideoFallback: hasVideoFallback, setHasVideoFallback: setHasVideoFallback }));
|
|
23
23
|
}
|
|
24
24
|
if (youtube) {
|
|
25
|
-
result = (react_1.default.createElement(VideoBlock_1.default, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg }));
|
|
25
|
+
result = (react_1.default.createElement(VideoBlock_1.default, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height }));
|
|
26
26
|
}
|
|
27
27
|
if (dataLens) {
|
|
28
28
|
result = react_1.default.createElement(DataLens_1.default, { dataLens: dataLens });
|
|
@@ -31,15 +31,16 @@ const Video = (props) => {
|
|
|
31
31
|
}, [playVideo, video, setHasVideoFallback]);
|
|
32
32
|
const reactPlayerBlock = (0, react_1.useMemo)(() => {
|
|
33
33
|
const { src, loop, controls, muted, autoplay = true, elapsedTime, playButton } = video;
|
|
34
|
-
return (react_1.default.createElement(ReactPlayer_1.default, { className: b('react-player', videoClassName), src: src, previewImgUrl: previewImg, loop: Boolean(loop), controls: controls, muted: muted, autoplay: autoplay && playVideo, elapsedTime: elapsedTime, playButton: playButton || commonPlayButton, customBarControlsClassName: customBarControlsClassName, metrika: metrika }));
|
|
34
|
+
return (react_1.default.createElement(ReactPlayer_1.default, { className: b('react-player', videoClassName), src: src, previewImgUrl: previewImg, loop: Boolean(loop), controls: controls, muted: muted, autoplay: autoplay && playVideo, elapsedTime: elapsedTime, playButton: playButton || commonPlayButton, customBarControlsClassName: customBarControlsClassName, metrika: metrika, height: height }));
|
|
35
35
|
}, [
|
|
36
36
|
video,
|
|
37
|
-
|
|
37
|
+
height,
|
|
38
|
+
videoClassName,
|
|
38
39
|
previewImg,
|
|
39
40
|
playVideo,
|
|
40
|
-
videoClassName,
|
|
41
41
|
commonPlayButton,
|
|
42
42
|
customBarControlsClassName,
|
|
43
|
+
metrika,
|
|
43
44
|
]);
|
|
44
45
|
const defaultVideoBlock = (0, react_1.useMemo)(() => {
|
|
45
46
|
return video.src.length && !hasVideoFallback ? (react_1.default.createElement("div", { className: b('wrap', videoClassName), style: { height } },
|
|
@@ -7,6 +7,7 @@ export interface ReactPlayerBlockProps extends Omit<MediaVideoProps, 'loop' | 's
|
|
|
7
7
|
customBarControlsClassName?: string;
|
|
8
8
|
showPreview?: boolean;
|
|
9
9
|
onClickPreview?: () => void;
|
|
10
|
+
height?: number;
|
|
10
11
|
children?: React.ReactNode;
|
|
11
12
|
}
|
|
12
13
|
export declare const ReactPlayerBlock: React.ForwardRefExoticComponent<ReactPlayerBlockProps & React.RefAttributes<ReactPlayerBlockHandler>>;
|
|
@@ -19,7 +19,7 @@ const FPS = 60;
|
|
|
19
19
|
exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
20
20
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
21
21
|
const { metrika } = (0, react_1.useContext)(metrikaContext_1.MetrikaContext);
|
|
22
|
-
const { src, previewImgUrl, loop = false, controls = models_1.MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, } = props;
|
|
22
|
+
const { src, previewImgUrl, loop = false, controls = models_1.MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, height, } = props;
|
|
23
23
|
const { type = models_1.PlayButtonType.Default, theme = models_1.PlayButtonThemes.Blue, text, className: buttonClassName, } = playButton || {};
|
|
24
24
|
const autoPlay = Boolean(!isMobile && !previewImgUrl && props.autoplay);
|
|
25
25
|
const mute = initiallyMuted || autoPlay;
|
|
@@ -28,7 +28,7 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
28
28
|
const [playerRef, setPlayerRef] = (0, react_1.useState)();
|
|
29
29
|
const [isPlaying, setIsPlaying] = (0, react_1.useState)(autoPlay);
|
|
30
30
|
const [playedPercent, setPlayedPercent] = (0, react_1.useState)(0);
|
|
31
|
-
const [
|
|
31
|
+
const [currentHeight, setCurrentHeight] = (0, react_1.useState)(height);
|
|
32
32
|
const [width, setWidth] = (0, react_1.useState)(0);
|
|
33
33
|
const [muted, setMuted] = (0, react_1.useState)(mute);
|
|
34
34
|
const [started, setStarted] = (0, react_1.useState)(autoPlay);
|
|
@@ -73,7 +73,7 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
73
73
|
parseFloat(paddingLeft) -
|
|
74
74
|
parseFloat(paddingRight);
|
|
75
75
|
setWidth(newWidth);
|
|
76
|
-
|
|
76
|
+
setCurrentHeight(Math.floor(getHeight(newWidth)));
|
|
77
77
|
}
|
|
78
78
|
}, 200);
|
|
79
79
|
updateSize();
|
|
@@ -179,8 +179,8 @@ exports.ReactPlayerBlock = react_1.default.forwardRef((props, originRef) => {
|
|
|
179
179
|
},
|
|
180
180
|
}, elapsedTimePercent: elapsedTimePercent }));
|
|
181
181
|
}, [controls, isPlaying, customBarControlsClassName, changeMute]);
|
|
182
|
-
return (react_1.default.createElement("div", { className: b({ wrapper: !
|
|
183
|
-
react_1.default.createElement(react_player_1.default, { className: b('player'), url: src, muted: muted, controls: controls === models_1.MediaVideoControlsType.Default, height:
|
|
182
|
+
return (react_1.default.createElement("div", { className: b({ wrapper: !currentHeight }, className), ref: ref, onClick: handleClick },
|
|
183
|
+
react_1.default.createElement(react_player_1.default, { className: b('player'), url: src, muted: muted, controls: controls === models_1.MediaVideoControlsType.Default, height: currentHeight || '100%', width: width || '100%', light: previewImgUrl, playing: isPlaying, playIcon: playIcon, progressInterval: FPS, onClickPreview: handleClickPreview, onStart: onStart, onReady: setPlayerRef, onPlay: onPlay, onPause: onPause, onProgress: onProgress, onEnded: onEnded }),
|
|
184
184
|
renderCustomBarControls(muted, playedPercent)));
|
|
185
185
|
});
|
|
186
186
|
function getHeight(width) {
|
|
@@ -3,6 +3,7 @@ export declare const AUTOPLAY_ATTRIBUTES: {
|
|
|
3
3
|
autoplay: number;
|
|
4
4
|
mute: number;
|
|
5
5
|
};
|
|
6
|
+
export declare function getHeight(width: number): number;
|
|
6
7
|
export interface VideoBlockProps {
|
|
7
8
|
id?: string;
|
|
8
9
|
stream?: string;
|
|
@@ -11,6 +12,7 @@ export interface VideoBlockProps {
|
|
|
11
12
|
className?: string;
|
|
12
13
|
previewImg?: string;
|
|
13
14
|
playButton?: React.ReactNode;
|
|
15
|
+
height?: number;
|
|
14
16
|
}
|
|
15
17
|
declare const VideoBlock: (props: VideoBlockProps) => JSX.Element | null;
|
|
16
18
|
export default VideoBlock;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AUTOPLAY_ATTRIBUTES = void 0;
|
|
3
|
+
exports.getHeight = exports.AUTOPLAY_ATTRIBUTES = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
@@ -36,14 +36,15 @@ function getVideoSrc(stream, record) {
|
|
|
36
36
|
function getHeight(width) {
|
|
37
37
|
return (width / 16) * 9;
|
|
38
38
|
}
|
|
39
|
+
exports.getHeight = getHeight;
|
|
39
40
|
const VideoBlock = (props) => {
|
|
40
|
-
const { stream, record, attributes, className, id, previewImg, playButton } = props;
|
|
41
|
+
const { stream, record, attributes, className, id, previewImg, playButton, height } = props;
|
|
41
42
|
const src = getVideoSrc(stream, record);
|
|
42
43
|
const ref = (0, react_1.useRef)(null);
|
|
43
44
|
const iframeRef = (0, react_1.useRef)();
|
|
44
45
|
const [hidePreview, setHidePreview] = (0, react_1.useState)(false);
|
|
45
46
|
const norender = (!stream && !record) || !src;
|
|
46
|
-
const [
|
|
47
|
+
const [currentHeight, setCurrentHeight] = (0, react_1.useState)(height || undefined);
|
|
47
48
|
const fullId = `${iframeId}-${id || src}`;
|
|
48
49
|
const onPreviewClick = (0, react_1.useCallback)(() => {
|
|
49
50
|
if (iframeRef.current) {
|
|
@@ -53,14 +54,14 @@ const VideoBlock = (props) => {
|
|
|
53
54
|
}, [src, attributes]);
|
|
54
55
|
(0, react_1.useEffect)(() => {
|
|
55
56
|
const updateSize = lodash_1.default.debounce(() => {
|
|
56
|
-
|
|
57
|
+
setCurrentHeight(ref.current ? Math.round(getHeight(ref.current.offsetWidth)) : undefined);
|
|
57
58
|
}, 100);
|
|
58
59
|
updateSize();
|
|
59
60
|
window.addEventListener('resize', updateSize);
|
|
60
61
|
return () => {
|
|
61
62
|
window.removeEventListener('resize', updateSize);
|
|
62
63
|
};
|
|
63
|
-
}, []);
|
|
64
|
+
}, [height]);
|
|
64
65
|
(0, react_1.useEffect)(() => {
|
|
65
66
|
if (norender) {
|
|
66
67
|
return;
|
|
@@ -89,7 +90,7 @@ const VideoBlock = (props) => {
|
|
|
89
90
|
if (norender) {
|
|
90
91
|
return null;
|
|
91
92
|
}
|
|
92
|
-
return (react_1.default.createElement("div", { className: b(null, className), ref: ref, style: { height } }, previewImg && !hidePreview && (react_1.default.createElement("div", { className: b('preview'), onClick: onPreviewClick },
|
|
93
|
+
return (react_1.default.createElement("div", { className: b(null, className), ref: ref, style: { height: currentHeight } }, previewImg && !hidePreview && (react_1.default.createElement("div", { className: b('preview'), onClick: onPreviewClick },
|
|
93
94
|
react_1.default.createElement(Image_1.default, { src: previewImg, className: b('image') }),
|
|
94
95
|
playButton || (react_1.default.createElement("button", { className: b('button') },
|
|
95
96
|
react_1.default.createElement(uikit_1.Icon, { className: b('icon'), data: icons_1.PlayVideo, size: 24 })))))));
|
|
@@ -18,6 +18,7 @@ export declare const blockMap: {
|
|
|
18
18
|
"header-slider-block": ({ items, arrows, ...props }: import("./models").HeaderSliderBlockProps) => JSX.Element;
|
|
19
19
|
"card-layout-block": ({ title, description, animated, colSizes, children, }: import("./blocks/CardLayout/CardLayout").CardLayoutBlockProps) => JSX.Element;
|
|
20
20
|
"content-layout-block": (props: import("./models").ContentLayoutBlockProps) => JSX.Element;
|
|
21
|
+
"share-block": ({ items, title }: import("./models").ShareBlockProps) => JSX.Element;
|
|
21
22
|
};
|
|
22
23
|
export declare const subBlockMap: {
|
|
23
24
|
divider: ({ size, border }: import("./models").DividerProps) => JSX.Element;
|
|
@@ -24,6 +24,7 @@ exports.blockMap = {
|
|
|
24
24
|
[models_1.BlockType.HeaderSliderBlock]: blocks_1.HeaderSliderBlock,
|
|
25
25
|
[models_1.BlockType.CardLayoutBlock]: blocks_1.CardLayoutBlock,
|
|
26
26
|
[models_1.BlockType.ContentLayoutBlock]: blocks_1.ContentLayoutBlock,
|
|
27
|
+
[models_1.BlockType.ShareBlock]: blocks_1.ShareBlock,
|
|
27
28
|
};
|
|
28
29
|
exports.subBlockMap = {
|
|
29
30
|
[models_1.SubBlockType.Divider]: sub_blocks_1.Divider,
|
|
@@ -1,10 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PCShareSocialNetwork = void 0;
|
|
4
|
-
var PCShareSocialNetwork;
|
|
5
|
-
(function (PCShareSocialNetwork) {
|
|
6
|
-
PCShareSocialNetwork["Vk"] = "vk";
|
|
7
|
-
PCShareSocialNetwork["Telegram"] = "telegram";
|
|
8
|
-
PCShareSocialNetwork["Twitter"] = "twitter";
|
|
9
|
-
PCShareSocialNetwork["Facebook"] = "facebook";
|
|
10
|
-
})(PCShareSocialNetwork = exports.PCShareSocialNetwork || (exports.PCShareSocialNetwork = {}));
|
|
@@ -24,7 +24,8 @@ export declare enum BlockType {
|
|
|
24
24
|
HeaderBlock = "header-block",
|
|
25
25
|
IconsBlock = "icons-block",
|
|
26
26
|
CardLayoutBlock = "card-layout-block",
|
|
27
|
-
ContentLayoutBlock = "content-layout-block"
|
|
27
|
+
ContentLayoutBlock = "content-layout-block",
|
|
28
|
+
ShareBlock = "share-block"
|
|
28
29
|
}
|
|
29
30
|
export declare const BlockTypes: BlockType[];
|
|
30
31
|
export declare const HeaderBlockTypes: BlockType[];
|
|
@@ -275,6 +276,16 @@ export interface ContentBlockProps {
|
|
|
275
276
|
centered?: boolean;
|
|
276
277
|
theme?: ContentTheme;
|
|
277
278
|
}
|
|
279
|
+
export declare enum PCShareSocialNetwork {
|
|
280
|
+
Vk = "vk",
|
|
281
|
+
Telegram = "telegram",
|
|
282
|
+
Twitter = "twitter",
|
|
283
|
+
Facebook = "facebook"
|
|
284
|
+
}
|
|
285
|
+
export interface ShareBlockProps {
|
|
286
|
+
items: PCShareSocialNetwork[];
|
|
287
|
+
title?: string;
|
|
288
|
+
}
|
|
278
289
|
export declare type HeaderBlockModel = {
|
|
279
290
|
type: BlockType.HeaderBlock;
|
|
280
291
|
} & HeaderBlockProps;
|
|
@@ -338,6 +349,9 @@ export declare type HeaderSliderBlockModel = {
|
|
|
338
349
|
export declare type ContentLayoutBlockModel = {
|
|
339
350
|
type: BlockType.ContentLayoutBlock;
|
|
340
351
|
} & ContentLayoutBlockProps;
|
|
341
|
-
declare type
|
|
352
|
+
export declare type ShareBLockModel = {
|
|
353
|
+
type: BlockType.ShareBlock;
|
|
354
|
+
} & ShareBlockProps;
|
|
355
|
+
declare type BlockModels = SliderBlockModel | ServiceDemoBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | CalculatorBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | InfoBlockModel | SecurityBlockModel | TableBlockModel | TabsBlockModel | SimpleBlockModel | LinkTableBlockModel | HeaderBlockModel | PreviewBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | ShareBLockModel;
|
|
342
356
|
export declare type Block = BlockModels & BlockBaseProps;
|
|
343
357
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SliderType = exports.SliderBreakpointNames = exports.HeaderBlockTypes = exports.BlockTypes = exports.BlockType = void 0;
|
|
3
|
+
exports.PCShareSocialNetwork = exports.SliderType = exports.SliderBreakpointNames = exports.HeaderBlockTypes = exports.BlockTypes = exports.BlockType = void 0;
|
|
4
4
|
var BlockType;
|
|
5
5
|
(function (BlockType) {
|
|
6
6
|
BlockType["PromoFeaturesBlock"] = "promo-features-block";
|
|
@@ -24,6 +24,7 @@ var BlockType;
|
|
|
24
24
|
BlockType["IconsBlock"] = "icons-block";
|
|
25
25
|
BlockType["CardLayoutBlock"] = "card-layout-block";
|
|
26
26
|
BlockType["ContentLayoutBlock"] = "content-layout-block";
|
|
27
|
+
BlockType["ShareBlock"] = "share-block";
|
|
27
28
|
})(BlockType = exports.BlockType || (exports.BlockType = {}));
|
|
28
29
|
exports.BlockTypes = Object.values(BlockType);
|
|
29
30
|
exports.HeaderBlockTypes = [BlockType.HeaderBlock, BlockType.HeaderSliderBlock];
|
|
@@ -39,3 +40,10 @@ var SliderType;
|
|
|
39
40
|
SliderType["MediaCard"] = "media-card";
|
|
40
41
|
SliderType["HeaderCard"] = "header-card";
|
|
41
42
|
})(SliderType = exports.SliderType || (exports.SliderType = {}));
|
|
43
|
+
var PCShareSocialNetwork;
|
|
44
|
+
(function (PCShareSocialNetwork) {
|
|
45
|
+
PCShareSocialNetwork["Vk"] = "vk";
|
|
46
|
+
PCShareSocialNetwork["Telegram"] = "telegram";
|
|
47
|
+
PCShareSocialNetwork["Twitter"] = "twitter";
|
|
48
|
+
PCShareSocialNetwork["Facebook"] = "facebook";
|
|
49
|
+
})(PCShareSocialNetwork = exports.PCShareSocialNetwork || (exports.PCShareSocialNetwork = {}));
|
|
@@ -53,7 +53,7 @@ function generateDefaultSchema(config) {
|
|
|
53
53
|
},
|
|
54
54
|
},
|
|
55
55
|
select: { $data: '0/type' },
|
|
56
|
-
selectCases: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, blocks_1.TabsBlock), blocks_1.SliderBlock), blocks_1.ExtendedFeaturesBlock), blocks_1.PromoFeaturesBlock), blocks_1.HeaderBlock), blocks_1.BannerBlock), blocks_1.CompaniesBlock), blocks_1.MediaBlock), blocks_1.InfoBlock), blocks_1.QuestionsBlock), blocks_1.SecurityBlock), blocks_1.TableBlock), blocks_1.SimpleBlock), blocks_1.LinkTableBlock), blocks_1.PreviewBlock), blocks_1.HeaderSliderBlock), blocks_1.IconsBlock), blocks_1.CardLayoutBlock), blocks_1.ContentLayoutBlock), sub_blocks_1.Divider), (0, exports.getBlocksCases)(blocks)),
|
|
56
|
+
selectCases: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, blocks_1.TabsBlock), blocks_1.SliderBlock), blocks_1.ExtendedFeaturesBlock), blocks_1.PromoFeaturesBlock), blocks_1.HeaderBlock), blocks_1.BannerBlock), blocks_1.CompaniesBlock), blocks_1.MediaBlock), blocks_1.InfoBlock), blocks_1.QuestionsBlock), blocks_1.SecurityBlock), blocks_1.TableBlock), blocks_1.SimpleBlock), blocks_1.LinkTableBlock), blocks_1.PreviewBlock), blocks_1.HeaderSliderBlock), blocks_1.IconsBlock), blocks_1.CardLayoutBlock), blocks_1.ContentLayoutBlock), sub_blocks_1.Divider), blocks_1.ShareBlock), (0, exports.getBlocksCases)(blocks)),
|
|
57
57
|
}),
|
|
58
58
|
cards: (0, utils_1.filteredItem)({
|
|
59
59
|
type: 'object',
|
|
@@ -20,3 +20,4 @@ const tslib_1 = require("tslib");
|
|
|
20
20
|
(0, tslib_1.__exportStar)(require("../../blocks/Icons/schema"), exports);
|
|
21
21
|
(0, tslib_1.__exportStar)(require("../../blocks/CardLayout/schema"), exports);
|
|
22
22
|
(0, tslib_1.__exportStar)(require("../../blocks/ContentLayout/schema"), exports);
|
|
23
|
+
(0, tslib_1.__exportStar)(require("../../blocks/Share/schema"), exports);
|
|
@@ -314,6 +314,12 @@ const config = {
|
|
|
314
314
|
parser: parseContentLayoutTitle,
|
|
315
315
|
},
|
|
316
316
|
],
|
|
317
|
+
[models_1.BlockType.ShareBlock]: [
|
|
318
|
+
{
|
|
319
|
+
fields: ['title'],
|
|
320
|
+
transformer: typografTransformer,
|
|
321
|
+
},
|
|
322
|
+
],
|
|
317
323
|
};
|
|
318
324
|
function addRandomOrder(block) {
|
|
319
325
|
if (block) {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const ShareBlock: {
|
|
2
|
+
'share-block': {
|
|
3
|
+
additionalProperties: boolean;
|
|
4
|
+
required: string[];
|
|
5
|
+
properties: {
|
|
6
|
+
title: {
|
|
7
|
+
type: string;
|
|
8
|
+
};
|
|
9
|
+
items: {
|
|
10
|
+
type: string;
|
|
11
|
+
items: {
|
|
12
|
+
type: string;
|
|
13
|
+
properties: {
|
|
14
|
+
when: {
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
type: {};
|
|
21
|
+
when: {};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { filteredArray } from '../../schema/validators/utils';
|
|
2
|
+
import { BaseProps } from '../../schema/validators/common';
|
|
3
|
+
export const ShareBlock = {
|
|
4
|
+
'share-block': {
|
|
5
|
+
additionalProperties: false,
|
|
6
|
+
required: ['items'],
|
|
7
|
+
properties: Object.assign(Object.assign({}, BaseProps), { title: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
}, items: filteredArray({
|
|
10
|
+
properties: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
enum: ['telegram', 'facebook', 'twitter', 'vk'],
|
|
13
|
+
},
|
|
14
|
+
}) }),
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Fragment, useContext, useState } from 'react';
|
|
1
|
+
import React, { Fragment, useContext, useRef, useState } from 'react';
|
|
2
2
|
import { block, getThemedValue } from '../../utils';
|
|
3
3
|
import { Row, Col, GridColumnOrderClasses } from '../../grid';
|
|
4
4
|
import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
|
|
@@ -9,15 +9,20 @@ import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
|
|
|
9
9
|
import { getMediaImage } from '../../components/Media/Image/utils';
|
|
10
10
|
import ButtonTabs from '../../components/ButtonTabs/ButtonTabs';
|
|
11
11
|
import { Content } from '../../sub-blocks';
|
|
12
|
+
import { getHeight } from '../../components/VideoBlock/VideoBlock';
|
|
12
13
|
import './Tabs.css';
|
|
13
14
|
const b = block('tabs-block');
|
|
14
15
|
export const TabsBlock = ({ items, title, description, animated, tabsColSizes, centered, direction = 'media-content', }) => {
|
|
16
|
+
var _a;
|
|
15
17
|
const [activeTab, setActiveTab] = useState(items[0].tabName);
|
|
16
18
|
const [play, setPlay] = useState(false);
|
|
17
19
|
const { themeValue: theme } = useContext(ThemeValueContext);
|
|
18
20
|
const tabs = items.map(({ tabName }) => ({ title: tabName, id: tabName }));
|
|
19
21
|
const activeTabData = items.find(({ tabName }) => tabName === activeTab);
|
|
20
22
|
const isReverse = direction === 'content-media';
|
|
23
|
+
const ref = useRef(null);
|
|
24
|
+
const mediaWidth = (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.offsetWidth;
|
|
25
|
+
const mediaHeight = mediaWidth && getHeight(mediaWidth);
|
|
21
26
|
let imageProps;
|
|
22
27
|
if (activeTabData) {
|
|
23
28
|
const themedImage = getThemedValue(activeTabData.image, theme);
|
|
@@ -37,7 +42,7 @@ export const TabsBlock = ({ items, title, description, animated, tabsColSizes, c
|
|
|
37
42
|
all: GridColumnOrderClasses.Last,
|
|
38
43
|
md: GridColumnOrderClasses.First,
|
|
39
44
|
}, className: b('col', { centered: centered }) },
|
|
40
|
-
(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 }))),
|
|
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 })))),
|
|
41
46
|
imageProps && (React.createElement(Fragment, null,
|
|
42
47
|
React.createElement(FullScreenImage, Object.assign({}, imageProps, { imageClassName: b('image') })),
|
|
43
48
|
(activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.caption) && (React.createElement("p", { className: b('caption') }, activeTabData.caption))))));
|
|
@@ -17,3 +17,4 @@ export { default as IconsBlock } from './Icons/Icons';
|
|
|
17
17
|
export { default as HeaderSliderBlock } from './HeaderSlider/HeaderSlider';
|
|
18
18
|
export { default as CardLayoutBlock } from './CardLayout/CardLayout';
|
|
19
19
|
export { default as ContentLayoutBlock } from './ContentLayout/ContentLayout';
|
|
20
|
+
export { default as ShareBlock } from './Share/Share';
|
|
@@ -17,3 +17,4 @@ export { default as IconsBlock } from './Icons/Icons';
|
|
|
17
17
|
export { default as HeaderSliderBlock } from './HeaderSlider/HeaderSlider';
|
|
18
18
|
export { default as CardLayoutBlock } from './CardLayout/CardLayout';
|
|
19
19
|
export { default as ContentLayoutBlock } from './ContentLayout/ContentLayout';
|
|
20
|
+
export { default as ShareBlock } from './Share/Share';
|
|
@@ -19,7 +19,7 @@ export const Media = (props) => {
|
|
|
19
19
|
result.push(React.createElement(Video, { key: "video", video: video, videoClassName: videoClassName, height: height, metrika: metrika, playVideo: playVideo, previewImg: previewImg, playButton: playButton, customBarControlsClassName: customBarControlsClassName, hasVideoFallback: hasVideoFallback, setHasVideoFallback: setHasVideoFallback }));
|
|
20
20
|
}
|
|
21
21
|
if (youtube) {
|
|
22
|
-
result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg }));
|
|
22
|
+
result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height }));
|
|
23
23
|
}
|
|
24
24
|
if (dataLens) {
|
|
25
25
|
result = React.createElement(DataLens, { dataLens: dataLens });
|
|
@@ -29,15 +29,16 @@ const Video = (props) => {
|
|
|
29
29
|
}, [playVideo, video, setHasVideoFallback]);
|
|
30
30
|
const reactPlayerBlock = useMemo(() => {
|
|
31
31
|
const { src, loop, controls, muted, autoplay = true, elapsedTime, playButton } = video;
|
|
32
|
-
return (React.createElement(ReactPlayerBlock, { className: b('react-player', videoClassName), src: src, previewImgUrl: previewImg, loop: Boolean(loop), controls: controls, muted: muted, autoplay: autoplay && playVideo, elapsedTime: elapsedTime, playButton: playButton || commonPlayButton, customBarControlsClassName: customBarControlsClassName, metrika: metrika }));
|
|
32
|
+
return (React.createElement(ReactPlayerBlock, { className: b('react-player', videoClassName), src: src, previewImgUrl: previewImg, loop: Boolean(loop), controls: controls, muted: muted, autoplay: autoplay && playVideo, elapsedTime: elapsedTime, playButton: playButton || commonPlayButton, customBarControlsClassName: customBarControlsClassName, metrika: metrika, height: height }));
|
|
33
33
|
}, [
|
|
34
34
|
video,
|
|
35
|
-
|
|
35
|
+
height,
|
|
36
|
+
videoClassName,
|
|
36
37
|
previewImg,
|
|
37
38
|
playVideo,
|
|
38
|
-
videoClassName,
|
|
39
39
|
commonPlayButton,
|
|
40
40
|
customBarControlsClassName,
|
|
41
|
+
metrika,
|
|
41
42
|
]);
|
|
42
43
|
const defaultVideoBlock = useMemo(() => {
|
|
43
44
|
return video.src.length && !hasVideoFallback ? (React.createElement("div", { className: b('wrap', videoClassName), style: { height } },
|
|
@@ -8,6 +8,7 @@ export interface ReactPlayerBlockProps extends Omit<MediaVideoProps, 'loop' | 's
|
|
|
8
8
|
customBarControlsClassName?: string;
|
|
9
9
|
showPreview?: boolean;
|
|
10
10
|
onClickPreview?: () => void;
|
|
11
|
+
height?: number;
|
|
11
12
|
children?: React.ReactNode;
|
|
12
13
|
}
|
|
13
14
|
export declare const ReactPlayerBlock: React.ForwardRefExoticComponent<ReactPlayerBlockProps & React.RefAttributes<ReactPlayerBlockHandler>>;
|
|
@@ -16,7 +16,7 @@ const FPS = 60;
|
|
|
16
16
|
export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
17
17
|
const isMobile = useContext(MobileContext);
|
|
18
18
|
const { metrika } = useContext(MetrikaContext);
|
|
19
|
-
const { src, previewImgUrl, loop = false, controls = MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, } = props;
|
|
19
|
+
const { src, previewImgUrl, loop = false, controls = MediaVideoControlsType.Default, muted: initiallyMuted = false, elapsedTime, playButton, className, customBarControlsClassName, showPreview, onClickPreview, metrika: videoMetrika, height, } = props;
|
|
20
20
|
const { type = PlayButtonType.Default, theme = PlayButtonThemes.Blue, text, className: buttonClassName, } = playButton || {};
|
|
21
21
|
const autoPlay = Boolean(!isMobile && !previewImgUrl && props.autoplay);
|
|
22
22
|
const mute = initiallyMuted || autoPlay;
|
|
@@ -25,7 +25,7 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
25
25
|
const [playerRef, setPlayerRef] = useState();
|
|
26
26
|
const [isPlaying, setIsPlaying] = useState(autoPlay);
|
|
27
27
|
const [playedPercent, setPlayedPercent] = useState(0);
|
|
28
|
-
const [
|
|
28
|
+
const [currentHeight, setCurrentHeight] = useState(height);
|
|
29
29
|
const [width, setWidth] = useState(0);
|
|
30
30
|
const [muted, setMuted] = useState(mute);
|
|
31
31
|
const [started, setStarted] = useState(autoPlay);
|
|
@@ -70,7 +70,7 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
70
70
|
parseFloat(paddingLeft) -
|
|
71
71
|
parseFloat(paddingRight);
|
|
72
72
|
setWidth(newWidth);
|
|
73
|
-
|
|
73
|
+
setCurrentHeight(Math.floor(getHeight(newWidth)));
|
|
74
74
|
}
|
|
75
75
|
}, 200);
|
|
76
76
|
updateSize();
|
|
@@ -176,8 +176,8 @@ export const ReactPlayerBlock = React.forwardRef((props, originRef) => {
|
|
|
176
176
|
},
|
|
177
177
|
}, elapsedTimePercent: elapsedTimePercent }));
|
|
178
178
|
}, [controls, isPlaying, customBarControlsClassName, changeMute]);
|
|
179
|
-
return (React.createElement("div", { className: b({ wrapper: !
|
|
180
|
-
React.createElement(ReactPlayer, { className: b('player'), url: src, muted: muted, controls: controls === MediaVideoControlsType.Default, height:
|
|
179
|
+
return (React.createElement("div", { className: b({ wrapper: !currentHeight }, className), ref: ref, onClick: handleClick },
|
|
180
|
+
React.createElement(ReactPlayer, { className: b('player'), url: src, muted: muted, controls: controls === MediaVideoControlsType.Default, height: currentHeight || '100%', width: width || '100%', light: previewImgUrl, playing: isPlaying, playIcon: playIcon, progressInterval: FPS, onClickPreview: handleClickPreview, onStart: onStart, onReady: setPlayerRef, onPlay: onPlay, onPause: onPause, onProgress: onProgress, onEnded: onEnded }),
|
|
181
181
|
renderCustomBarControls(muted, playedPercent)));
|
|
182
182
|
});
|
|
183
183
|
function getHeight(width) {
|
|
@@ -4,6 +4,7 @@ export declare const AUTOPLAY_ATTRIBUTES: {
|
|
|
4
4
|
autoplay: number;
|
|
5
5
|
mute: number;
|
|
6
6
|
};
|
|
7
|
+
export declare function getHeight(width: number): number;
|
|
7
8
|
export interface VideoBlockProps {
|
|
8
9
|
id?: string;
|
|
9
10
|
stream?: string;
|
|
@@ -12,6 +13,7 @@ export interface VideoBlockProps {
|
|
|
12
13
|
className?: string;
|
|
13
14
|
previewImg?: string;
|
|
14
15
|
playButton?: React.ReactNode;
|
|
16
|
+
height?: number;
|
|
15
17
|
}
|
|
16
18
|
declare const VideoBlock: (props: VideoBlockProps) => JSX.Element | null;
|
|
17
19
|
export default VideoBlock;
|
|
@@ -30,17 +30,17 @@ function getVideoSrc(stream, record) {
|
|
|
30
30
|
}
|
|
31
31
|
return src;
|
|
32
32
|
}
|
|
33
|
-
function getHeight(width) {
|
|
33
|
+
export function getHeight(width) {
|
|
34
34
|
return (width / 16) * 9;
|
|
35
35
|
}
|
|
36
36
|
const VideoBlock = (props) => {
|
|
37
|
-
const { stream, record, attributes, className, id, previewImg, playButton } = props;
|
|
37
|
+
const { stream, record, attributes, className, id, previewImg, playButton, height } = props;
|
|
38
38
|
const src = getVideoSrc(stream, record);
|
|
39
39
|
const ref = useRef(null);
|
|
40
40
|
const iframeRef = useRef();
|
|
41
41
|
const [hidePreview, setHidePreview] = useState(false);
|
|
42
42
|
const norender = (!stream && !record) || !src;
|
|
43
|
-
const [
|
|
43
|
+
const [currentHeight, setCurrentHeight] = useState(height || undefined);
|
|
44
44
|
const fullId = `${iframeId}-${id || src}`;
|
|
45
45
|
const onPreviewClick = useCallback(() => {
|
|
46
46
|
if (iframeRef.current) {
|
|
@@ -50,14 +50,14 @@ const VideoBlock = (props) => {
|
|
|
50
50
|
}, [src, attributes]);
|
|
51
51
|
useEffect(() => {
|
|
52
52
|
const updateSize = _.debounce(() => {
|
|
53
|
-
|
|
53
|
+
setCurrentHeight(ref.current ? Math.round(getHeight(ref.current.offsetWidth)) : undefined);
|
|
54
54
|
}, 100);
|
|
55
55
|
updateSize();
|
|
56
56
|
window.addEventListener('resize', updateSize);
|
|
57
57
|
return () => {
|
|
58
58
|
window.removeEventListener('resize', updateSize);
|
|
59
59
|
};
|
|
60
|
-
}, []);
|
|
60
|
+
}, [height]);
|
|
61
61
|
useEffect(() => {
|
|
62
62
|
if (norender) {
|
|
63
63
|
return;
|
|
@@ -86,7 +86,7 @@ const VideoBlock = (props) => {
|
|
|
86
86
|
if (norender) {
|
|
87
87
|
return null;
|
|
88
88
|
}
|
|
89
|
-
return (React.createElement("div", { className: b(null, className), ref: ref, style: { height } }, previewImg && !hidePreview && (React.createElement("div", { className: b('preview'), onClick: onPreviewClick },
|
|
89
|
+
return (React.createElement("div", { className: b(null, className), ref: ref, style: { height: currentHeight } }, previewImg && !hidePreview && (React.createElement("div", { className: b('preview'), onClick: onPreviewClick },
|
|
90
90
|
React.createElement(Image, { src: previewImg, className: b('image') }),
|
|
91
91
|
playButton || (React.createElement("button", { className: b('button') },
|
|
92
92
|
React.createElement(Icon, { className: b('icon'), data: PlayVideo, size: 24 })))))));
|
|
@@ -18,6 +18,7 @@ export declare const blockMap: {
|
|
|
18
18
|
"header-slider-block": ({ items, arrows, ...props }: import("./models").HeaderSliderBlockProps) => JSX.Element;
|
|
19
19
|
"card-layout-block": ({ title, description, animated, colSizes, children, }: import("./blocks/CardLayout/CardLayout").CardLayoutBlockProps) => JSX.Element;
|
|
20
20
|
"content-layout-block": (props: import("./models").ContentLayoutBlockProps) => JSX.Element;
|
|
21
|
+
"share-block": ({ items, title }: import("./models").ShareBlockProps) => JSX.Element;
|
|
21
22
|
};
|
|
22
23
|
export declare const subBlockMap: {
|
|
23
24
|
divider: ({ size, border }: import("./models").DividerProps) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BlockType, SubBlockType } from './models';
|
|
2
2
|
import { Partner, PriceDetailed, MediaCard, NewsCard, TutorialCard, CardWithImage, BackgroundCard, Content, Quote, Divider, BannerCard, BasicCard, } from './sub-blocks';
|
|
3
|
-
import { BannerBlock, CompaniesBlock, SimpleBlock, MediaBlock, PreviewBlock, InfoBlock, SecurityBlock, SliderBlock, ExtendedFeaturesBlock, PromoFeaturesBlock, QuestionsBlock, TableBlock, TabsBlock, LinkTableBlock, HeaderBlock, IconsBlock, HeaderSliderBlock, CardLayoutBlock, ContentLayoutBlock, } from './blocks';
|
|
3
|
+
import { BannerBlock, CompaniesBlock, SimpleBlock, MediaBlock, PreviewBlock, InfoBlock, SecurityBlock, SliderBlock, ExtendedFeaturesBlock, PromoFeaturesBlock, QuestionsBlock, TableBlock, TabsBlock, LinkTableBlock, HeaderBlock, IconsBlock, HeaderSliderBlock, CardLayoutBlock, ContentLayoutBlock, ShareBlock, } from './blocks';
|
|
4
4
|
export const blockMap = {
|
|
5
5
|
[BlockType.SliderBlock]: SliderBlock,
|
|
6
6
|
[BlockType.SimpleBlock]: SimpleBlock,
|
|
@@ -21,6 +21,7 @@ export const blockMap = {
|
|
|
21
21
|
[BlockType.HeaderSliderBlock]: HeaderSliderBlock,
|
|
22
22
|
[BlockType.CardLayoutBlock]: CardLayoutBlock,
|
|
23
23
|
[BlockType.ContentLayoutBlock]: ContentLayoutBlock,
|
|
24
|
+
[BlockType.ShareBlock]: ShareBlock,
|
|
24
25
|
};
|
|
25
26
|
export const subBlockMap = {
|
|
26
27
|
[SubBlockType.Divider]: Divider,
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
(function (PCShareSocialNetwork) {
|
|
3
|
-
PCShareSocialNetwork["Vk"] = "vk";
|
|
4
|
-
PCShareSocialNetwork["Telegram"] = "telegram";
|
|
5
|
-
PCShareSocialNetwork["Twitter"] = "twitter";
|
|
6
|
-
PCShareSocialNetwork["Facebook"] = "facebook";
|
|
7
|
-
})(PCShareSocialNetwork || (PCShareSocialNetwork = {}));
|
|
1
|
+
export {};
|
|
@@ -24,7 +24,8 @@ export declare enum BlockType {
|
|
|
24
24
|
HeaderBlock = "header-block",
|
|
25
25
|
IconsBlock = "icons-block",
|
|
26
26
|
CardLayoutBlock = "card-layout-block",
|
|
27
|
-
ContentLayoutBlock = "content-layout-block"
|
|
27
|
+
ContentLayoutBlock = "content-layout-block",
|
|
28
|
+
ShareBlock = "share-block"
|
|
28
29
|
}
|
|
29
30
|
export declare const BlockTypes: BlockType[];
|
|
30
31
|
export declare const HeaderBlockTypes: BlockType[];
|
|
@@ -275,6 +276,16 @@ export interface ContentBlockProps {
|
|
|
275
276
|
centered?: boolean;
|
|
276
277
|
theme?: ContentTheme;
|
|
277
278
|
}
|
|
279
|
+
export declare enum PCShareSocialNetwork {
|
|
280
|
+
Vk = "vk",
|
|
281
|
+
Telegram = "telegram",
|
|
282
|
+
Twitter = "twitter",
|
|
283
|
+
Facebook = "facebook"
|
|
284
|
+
}
|
|
285
|
+
export interface ShareBlockProps {
|
|
286
|
+
items: PCShareSocialNetwork[];
|
|
287
|
+
title?: string;
|
|
288
|
+
}
|
|
278
289
|
export declare type HeaderBlockModel = {
|
|
279
290
|
type: BlockType.HeaderBlock;
|
|
280
291
|
} & HeaderBlockProps;
|
|
@@ -338,6 +349,9 @@ export declare type HeaderSliderBlockModel = {
|
|
|
338
349
|
export declare type ContentLayoutBlockModel = {
|
|
339
350
|
type: BlockType.ContentLayoutBlock;
|
|
340
351
|
} & ContentLayoutBlockProps;
|
|
341
|
-
declare type
|
|
352
|
+
export declare type ShareBLockModel = {
|
|
353
|
+
type: BlockType.ShareBlock;
|
|
354
|
+
} & ShareBlockProps;
|
|
355
|
+
declare type BlockModels = SliderBlockModel | ServiceDemoBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | CalculatorBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | InfoBlockModel | SecurityBlockModel | TableBlockModel | TabsBlockModel | SimpleBlockModel | LinkTableBlockModel | HeaderBlockModel | PreviewBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | ShareBLockModel;
|
|
342
356
|
export declare type Block = BlockModels & BlockBaseProps;
|
|
343
357
|
export {};
|
|
@@ -21,6 +21,7 @@ export var BlockType;
|
|
|
21
21
|
BlockType["IconsBlock"] = "icons-block";
|
|
22
22
|
BlockType["CardLayoutBlock"] = "card-layout-block";
|
|
23
23
|
BlockType["ContentLayoutBlock"] = "content-layout-block";
|
|
24
|
+
BlockType["ShareBlock"] = "share-block";
|
|
24
25
|
})(BlockType || (BlockType = {}));
|
|
25
26
|
export const BlockTypes = Object.values(BlockType);
|
|
26
27
|
export const HeaderBlockTypes = [BlockType.HeaderBlock, BlockType.HeaderSliderBlock];
|
|
@@ -36,3 +37,10 @@ export var SliderType;
|
|
|
36
37
|
SliderType["MediaCard"] = "media-card";
|
|
37
38
|
SliderType["HeaderCard"] = "header-card";
|
|
38
39
|
})(SliderType || (SliderType = {}));
|
|
40
|
+
export var PCShareSocialNetwork;
|
|
41
|
+
(function (PCShareSocialNetwork) {
|
|
42
|
+
PCShareSocialNetwork["Vk"] = "vk";
|
|
43
|
+
PCShareSocialNetwork["Telegram"] = "telegram";
|
|
44
|
+
PCShareSocialNetwork["Twitter"] = "twitter";
|
|
45
|
+
PCShareSocialNetwork["Facebook"] = "facebook";
|
|
46
|
+
})(PCShareSocialNetwork || (PCShareSocialNetwork = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { validators } from './validators';
|
|
2
|
-
import { TabsBlock, BannerCard, SliderBlock, ExtendedFeaturesBlock, HeaderBlock, BannerBlock, CompaniesBlock, MediaBlock, InfoBlock, QuestionsBlock, SecurityBlock, TableBlock, SimpleBlock, LinkTableBlock, PromoFeaturesBlock, PreviewBlock, ContentLayoutBlock, HeaderSliderBlock, IconsBlock, CardLayoutBlock, } from './validators/blocks';
|
|
2
|
+
import { TabsBlock, BannerCard, SliderBlock, ExtendedFeaturesBlock, HeaderBlock, BannerBlock, CompaniesBlock, MediaBlock, InfoBlock, QuestionsBlock, SecurityBlock, TableBlock, SimpleBlock, LinkTableBlock, PromoFeaturesBlock, PreviewBlock, ContentLayoutBlock, HeaderSliderBlock, IconsBlock, CardLayoutBlock, ShareBlock, } from './validators/blocks';
|
|
3
3
|
import { PartnerBlock, MediaCardBlock, TutorialCard, BackgroundCard, NewsCard, CardWithImage, PriceDetailedBlock, Quote, Divider, } from './validators/sub-blocks';
|
|
4
4
|
import { AnimatableProps, BackgroundProps, MenuProps, withTheme } from './validators/common';
|
|
5
5
|
import { filteredItem } from './validators/utils';
|
|
@@ -48,7 +48,7 @@ export function generateDefaultSchema(config) {
|
|
|
48
48
|
},
|
|
49
49
|
},
|
|
50
50
|
select: { $data: '0/type' },
|
|
51
|
-
selectCases: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, TabsBlock), SliderBlock), ExtendedFeaturesBlock), PromoFeaturesBlock), HeaderBlock), BannerBlock), CompaniesBlock), MediaBlock), InfoBlock), QuestionsBlock), SecurityBlock), TableBlock), SimpleBlock), LinkTableBlock), PreviewBlock), HeaderSliderBlock), IconsBlock), CardLayoutBlock), ContentLayoutBlock), Divider), getBlocksCases(blocks)),
|
|
51
|
+
selectCases: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, TabsBlock), SliderBlock), ExtendedFeaturesBlock), PromoFeaturesBlock), HeaderBlock), BannerBlock), CompaniesBlock), MediaBlock), InfoBlock), QuestionsBlock), SecurityBlock), TableBlock), SimpleBlock), LinkTableBlock), PreviewBlock), HeaderSliderBlock), IconsBlock), CardLayoutBlock), ContentLayoutBlock), Divider), ShareBlock), getBlocksCases(blocks)),
|
|
52
52
|
}),
|
|
53
53
|
cards: filteredItem({
|
|
54
54
|
type: 'object',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/page-constructor",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.1-alpha.1",
|
|
4
4
|
"description": "Gravity UI Page Constructor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -121,5 +121,8 @@
|
|
|
121
121
|
"*.{json,yaml,yml,md}": [
|
|
122
122
|
"prettier --write"
|
|
123
123
|
]
|
|
124
|
+
},
|
|
125
|
+
"publishConfig": {
|
|
126
|
+
"tag": "alpha"
|
|
124
127
|
}
|
|
125
128
|
}
|
|
@@ -1,10 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PCShareSocialNetwork = void 0;
|
|
4
|
-
var PCShareSocialNetwork;
|
|
5
|
-
(function (PCShareSocialNetwork) {
|
|
6
|
-
PCShareSocialNetwork["Vk"] = "vk";
|
|
7
|
-
PCShareSocialNetwork["Telegram"] = "telegram";
|
|
8
|
-
PCShareSocialNetwork["Twitter"] = "twitter";
|
|
9
|
-
PCShareSocialNetwork["Facebook"] = "facebook";
|
|
10
|
-
})(PCShareSocialNetwork = exports.PCShareSocialNetwork || (exports.PCShareSocialNetwork = {}));
|
|
@@ -24,7 +24,8 @@ export declare enum BlockType {
|
|
|
24
24
|
HeaderBlock = "header-block",
|
|
25
25
|
IconsBlock = "icons-block",
|
|
26
26
|
CardLayoutBlock = "card-layout-block",
|
|
27
|
-
ContentLayoutBlock = "content-layout-block"
|
|
27
|
+
ContentLayoutBlock = "content-layout-block",
|
|
28
|
+
ShareBlock = "share-block"
|
|
28
29
|
}
|
|
29
30
|
export declare const BlockTypes: BlockType[];
|
|
30
31
|
export declare const HeaderBlockTypes: BlockType[];
|
|
@@ -275,6 +276,16 @@ export interface ContentBlockProps {
|
|
|
275
276
|
centered?: boolean;
|
|
276
277
|
theme?: ContentTheme;
|
|
277
278
|
}
|
|
279
|
+
export declare enum PCShareSocialNetwork {
|
|
280
|
+
Vk = "vk",
|
|
281
|
+
Telegram = "telegram",
|
|
282
|
+
Twitter = "twitter",
|
|
283
|
+
Facebook = "facebook"
|
|
284
|
+
}
|
|
285
|
+
export interface ShareBlockProps {
|
|
286
|
+
items: PCShareSocialNetwork[];
|
|
287
|
+
title?: string;
|
|
288
|
+
}
|
|
278
289
|
export declare type HeaderBlockModel = {
|
|
279
290
|
type: BlockType.HeaderBlock;
|
|
280
291
|
} & HeaderBlockProps;
|
|
@@ -338,6 +349,9 @@ export declare type HeaderSliderBlockModel = {
|
|
|
338
349
|
export declare type ContentLayoutBlockModel = {
|
|
339
350
|
type: BlockType.ContentLayoutBlock;
|
|
340
351
|
} & ContentLayoutBlockProps;
|
|
341
|
-
declare type
|
|
352
|
+
export declare type ShareBLockModel = {
|
|
353
|
+
type: BlockType.ShareBlock;
|
|
354
|
+
} & ShareBlockProps;
|
|
355
|
+
declare type BlockModels = SliderBlockModel | ServiceDemoBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | CalculatorBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | InfoBlockModel | SecurityBlockModel | TableBlockModel | TabsBlockModel | SimpleBlockModel | LinkTableBlockModel | HeaderBlockModel | PreviewBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | ShareBLockModel;
|
|
342
356
|
export declare type Block = BlockModels & BlockBaseProps;
|
|
343
357
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SliderType = exports.SliderBreakpointNames = exports.HeaderBlockTypes = exports.BlockTypes = exports.BlockType = void 0;
|
|
3
|
+
exports.PCShareSocialNetwork = exports.SliderType = exports.SliderBreakpointNames = exports.HeaderBlockTypes = exports.BlockTypes = exports.BlockType = void 0;
|
|
4
4
|
var BlockType;
|
|
5
5
|
(function (BlockType) {
|
|
6
6
|
BlockType["PromoFeaturesBlock"] = "promo-features-block";
|
|
@@ -24,6 +24,7 @@ var BlockType;
|
|
|
24
24
|
BlockType["IconsBlock"] = "icons-block";
|
|
25
25
|
BlockType["CardLayoutBlock"] = "card-layout-block";
|
|
26
26
|
BlockType["ContentLayoutBlock"] = "content-layout-block";
|
|
27
|
+
BlockType["ShareBlock"] = "share-block";
|
|
27
28
|
})(BlockType = exports.BlockType || (exports.BlockType = {}));
|
|
28
29
|
exports.BlockTypes = Object.values(BlockType);
|
|
29
30
|
exports.HeaderBlockTypes = [BlockType.HeaderBlock, BlockType.HeaderSliderBlock];
|
|
@@ -39,3 +40,10 @@ var SliderType;
|
|
|
39
40
|
SliderType["MediaCard"] = "media-card";
|
|
40
41
|
SliderType["HeaderCard"] = "header-card";
|
|
41
42
|
})(SliderType = exports.SliderType || (exports.SliderType = {}));
|
|
43
|
+
var PCShareSocialNetwork;
|
|
44
|
+
(function (PCShareSocialNetwork) {
|
|
45
|
+
PCShareSocialNetwork["Vk"] = "vk";
|
|
46
|
+
PCShareSocialNetwork["Telegram"] = "telegram";
|
|
47
|
+
PCShareSocialNetwork["Twitter"] = "twitter";
|
|
48
|
+
PCShareSocialNetwork["Facebook"] = "facebook";
|
|
49
|
+
})(PCShareSocialNetwork = exports.PCShareSocialNetwork || (exports.PCShareSocialNetwork = {}));
|
|
@@ -327,6 +327,12 @@ const config = {
|
|
|
327
327
|
parser: parseContentLayoutTitle,
|
|
328
328
|
},
|
|
329
329
|
],
|
|
330
|
+
[models_1.BlockType.ShareBlock]: [
|
|
331
|
+
{
|
|
332
|
+
fields: ['title'],
|
|
333
|
+
transformer: typografTransformer,
|
|
334
|
+
},
|
|
335
|
+
],
|
|
330
336
|
};
|
|
331
337
|
function addRandomOrder(block) {
|
|
332
338
|
if (block) {
|