@gravity-ui/page-constructor 4.38.1 → 4.39.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.
Files changed (48) hide show
  1. package/README.md +1 -1
  2. package/build/cjs/blocks/Header/schema.d.ts +60 -0
  3. package/build/cjs/blocks/HeaderSlider/schema.d.ts +20 -0
  4. package/build/cjs/blocks/Media/schema.d.ts +40 -0
  5. package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +20 -0
  6. package/build/cjs/blocks/Tabs/schema.d.ts +20 -0
  7. package/build/cjs/components/Media/Iframe/Iframe.css +18 -0
  8. package/build/cjs/components/Media/Iframe/Iframe.d.ts +3 -0
  9. package/build/cjs/components/Media/Iframe/Iframe.js +14 -0
  10. package/build/cjs/components/Media/Iframe/i18n/en.json +3 -0
  11. package/build/cjs/components/Media/Iframe/i18n/index.d.ts +2 -0
  12. package/build/cjs/components/Media/Iframe/i18n/index.js +8 -0
  13. package/build/cjs/components/Media/Iframe/i18n/ru.json +3 -0
  14. package/build/cjs/components/Media/Image/Image.js +1 -1
  15. package/build/cjs/components/Media/Media.js +7 -1
  16. package/build/cjs/containers/PageConstructor/PageConstructor.js +2 -2
  17. package/build/cjs/models/constructor-items/common.d.ts +12 -1
  18. package/build/cjs/schema/constants.d.ts +20 -0
  19. package/build/cjs/schema/validators/common.d.ts +20 -0
  20. package/build/cjs/schema/validators/common.js +21 -0
  21. package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +20 -0
  22. package/build/cjs/sub-blocks/MediaCard/schema.d.ts +20 -0
  23. package/build/cjs/sub-blocks/PriceCard/schema.d.ts +20 -0
  24. package/build/esm/blocks/Header/schema.d.ts +60 -0
  25. package/build/esm/blocks/HeaderSlider/schema.d.ts +20 -0
  26. package/build/esm/blocks/Media/schema.d.ts +40 -0
  27. package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +20 -0
  28. package/build/esm/blocks/Tabs/schema.d.ts +20 -0
  29. package/build/esm/components/Media/Iframe/Iframe.css +18 -0
  30. package/build/esm/components/Media/Iframe/Iframe.d.ts +4 -0
  31. package/build/esm/components/Media/Iframe/Iframe.js +12 -0
  32. package/build/esm/components/Media/Iframe/i18n/en.json +3 -0
  33. package/build/esm/components/Media/Iframe/i18n/index.d.ts +2 -0
  34. package/build/esm/components/Media/Iframe/i18n/index.js +5 -0
  35. package/build/esm/components/Media/Iframe/i18n/ru.json +3 -0
  36. package/build/esm/components/Media/Image/Image.js +1 -1
  37. package/build/esm/components/Media/Media.js +7 -1
  38. package/build/esm/containers/PageConstructor/PageConstructor.js +2 -2
  39. package/build/esm/models/constructor-items/common.d.ts +12 -1
  40. package/build/esm/schema/constants.d.ts +20 -0
  41. package/build/esm/schema/validators/common.d.ts +20 -0
  42. package/build/esm/schema/validators/common.js +21 -0
  43. package/build/esm/sub-blocks/LayoutItem/schema.d.ts +20 -0
  44. package/build/esm/sub-blocks/MediaCard/schema.d.ts +20 -0
  45. package/build/esm/sub-blocks/PriceCard/schema.d.ts +20 -0
  46. package/package.json +1 -1
  47. package/server/models/constructor-items/common.d.ts +12 -1
  48. package/widget/index.js +1 -1
@@ -245,6 +245,26 @@ export declare const Media: {
245
245
  ratio: {
246
246
  type: string;
247
247
  };
248
+ iframe: {
249
+ src: {
250
+ type: string;
251
+ };
252
+ name: {
253
+ type: string;
254
+ };
255
+ title: {
256
+ type: string;
257
+ };
258
+ height: {
259
+ type: string;
260
+ };
261
+ width: {
262
+ type: string;
263
+ };
264
+ };
265
+ margins: {
266
+ type: string;
267
+ };
248
268
  };
249
269
  };
250
270
  export declare const MediaBlockBaseProps: {
@@ -870,6 +890,26 @@ export declare const MediaBlock: {
870
890
  ratio: {
871
891
  type: string;
872
892
  };
893
+ iframe: {
894
+ src: {
895
+ type: string;
896
+ };
897
+ name: {
898
+ type: string;
899
+ };
900
+ title: {
901
+ type: string;
902
+ };
903
+ height: {
904
+ type: string;
905
+ };
906
+ width: {
907
+ type: string;
908
+ };
909
+ };
910
+ margins: {
911
+ type: string;
912
+ };
873
913
  };
874
914
  } & {
875
915
  optionName: string;
@@ -261,6 +261,26 @@ export declare const PromoFeaturesItem: {
261
261
  ratio: {
262
262
  type: string;
263
263
  };
264
+ iframe: {
265
+ src: {
266
+ type: string;
267
+ };
268
+ name: {
269
+ type: string;
270
+ };
271
+ title: {
272
+ type: string;
273
+ };
274
+ height: {
275
+ type: string;
276
+ };
277
+ width: {
278
+ type: string;
279
+ };
280
+ };
281
+ margins: {
282
+ type: string;
283
+ };
264
284
  };
265
285
  };
266
286
  };
@@ -256,6 +256,26 @@ export declare const tabsItem: {
256
256
  ratio: {
257
257
  type: string;
258
258
  };
259
+ iframe: {
260
+ src: {
261
+ type: string;
262
+ };
263
+ name: {
264
+ type: string;
265
+ };
266
+ title: {
267
+ type: string;
268
+ };
269
+ height: {
270
+ type: string;
271
+ };
272
+ width: {
273
+ type: string;
274
+ };
275
+ };
276
+ margins: {
277
+ type: string;
278
+ };
259
279
  };
260
280
  } & {
261
281
  optionName: string;
@@ -0,0 +1,18 @@
1
+ /* use this for style redefinitions to awoid problems with
2
+ unpredictable css rules order in build */
3
+ .pc-media-component-iframe {
4
+ overflow: hidden;
5
+ }
6
+ .pc-media-component-iframe_margins {
7
+ margin: 24px;
8
+ }
9
+ .pc-media-component-iframe_margins .pc-media-component-iframe__item {
10
+ border-radius: 0;
11
+ }
12
+ .pc-media-component-iframe .pc-media-component-iframe__iframe {
13
+ border-radius: 0;
14
+ }
15
+ .pc-media-component-iframe__item {
16
+ width: 100%;
17
+ height: 100%;
18
+ }
@@ -0,0 +1,4 @@
1
+ import { MediaComponentIframeProps } from '../../../models';
2
+ import './Iframe.css';
3
+ declare const Iframe: (props: MediaComponentIframeProps) => JSX.Element | null;
4
+ export default Iframe;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { block } from '../../../utils';
3
+ import i18n from './i18n';
4
+ import './Iframe.css';
5
+ const b = block('media-component-iframe');
6
+ const Iframe = (props) => {
7
+ const { iframe, margins = true } = props;
8
+ const { height = 400, src, width, name, title } = iframe;
9
+ return iframe ? (React.createElement("div", { className: b({ margins }), style: { height } },
10
+ React.createElement("iframe", { className: b('item'), loading: "lazy", title: title || i18n('iframe-title'), frameBorder: 0, src: src, width: width, height: height, name: name }))) : null;
11
+ };
12
+ export default Iframe;
@@ -0,0 +1,3 @@
1
+ {
2
+ "iframe-title": "Datalens frame"
3
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { registerKeyset } from '../../../../utils/registerKeyset';
2
+ import en from './en.json';
3
+ import ru from './ru.json';
4
+ const COMPONENT = 'Iframe';
5
+ export default registerKeyset({ en, ru }, COMPONENT);
@@ -0,0 +1,3 @@
1
+ {
2
+ "iframe-title": "Фрейм данных"
3
+ }
@@ -50,7 +50,7 @@ const Image = (props) => {
50
50
  };
51
51
  const imageSlider = (imageArray) => {
52
52
  const fullscreenItem = fullscreen === undefined || fullscreen;
53
- return (React.createElement(SliderBlock, { slidesToShow: 1, type: SliderType.MediaCard }, imageArray.map((item, index) => (React.createElement(Fragment, { key: index }, fullscreenItem ? renderFullscreenImage(item) : imageOnly(item))))));
53
+ return (React.createElement(SliderBlock, { slidesToShow: 1, type: SliderType.MediaCard, animated: parallax }, imageArray.map((item, index) => (React.createElement(Fragment, { key: index }, fullscreenItem ? renderFullscreenImage(item) : imageOnly(item))))));
54
54
  };
55
55
  if (Array.isArray(image)) {
56
56
  return imageSlider(image);
@@ -3,12 +3,13 @@ import { block, getQaAttrubutes } from '../../utils';
3
3
  import YoutubeBlock from '../VideoBlock/VideoBlock';
4
4
  import DataLens from './DataLens/DataLens';
5
5
  import FullscreenVideo from './FullscreenVideo/FullscreenVideo';
6
+ import Iframe from './Iframe/Iframe';
6
7
  import Image from './Image/Image';
7
8
  import Video from './Video/Video';
8
9
  import './Media.css';
9
10
  const b = block('Media');
10
11
  export const Media = (props) => {
11
- const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullscreen, analyticsEvents, className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, qa, ratio, autoplay, onImageLoad, } = props;
12
+ const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullscreen, analyticsEvents, className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, qa, ratio, autoplay, onImageLoad, iframe, margins, } = props;
12
13
  const [hasVideoFallback, setHasVideoFallback] = useState(false);
13
14
  const qaAttributes = getQaAttrubutes(qa, 'video');
14
15
  const content = useMemo(() => {
@@ -45,12 +46,16 @@ export const Media = (props) => {
45
46
  if (dataLens) {
46
47
  result = React.createElement(DataLens, { dataLens: dataLens });
47
48
  }
49
+ if (iframe) {
50
+ result = React.createElement(Iframe, { iframe: iframe, margins: margins });
51
+ }
48
52
  return result;
49
53
  }, [
50
54
  image,
51
55
  video,
52
56
  youtube,
53
57
  dataLens,
58
+ iframe,
54
59
  parallax,
55
60
  height,
56
61
  imageClassName,
@@ -70,6 +75,7 @@ export const Media = (props) => {
70
75
  ratio,
71
76
  youtubeClassName,
72
77
  autoplay,
78
+ margins,
73
79
  ]);
74
80
  return (React.createElement("div", { className: b(null, className), style: { backgroundColor: color }, "data-qa": qa }, content));
75
81
  };
@@ -17,7 +17,7 @@ import { ConstructorRow } from './components/ConstructorRow';
17
17
  import './PageConstructor.css';
18
18
  const b = cnBlock('page-constructor');
19
19
  export const Constructor = (props) => {
20
- const { content: { blocks = [], background = {} } = {}, renderMenu, shouldRenderBlock, navigation, custom, } = props;
20
+ const { content: { blocks = [], background } = {}, renderMenu, shouldRenderBlock, navigation, custom, } = props;
21
21
  const { context } = useMemo(() => ({
22
22
  context: {
23
23
  blockTypes: [...BlockTypes, ...getCustomTypes(['blocks', 'headers'], custom)],
@@ -41,7 +41,7 @@ export const Constructor = (props) => {
41
41
  const restBlocks = getOrderedBlocks(blocks, context.headerBlockTypes);
42
42
  const themedBackground = getThemedValue(background, theme);
43
43
  return (React.createElement(InnerContext.Provider, { value: context },
44
- React.createElement(RootCn, null,
44
+ React.createElement(RootCn, { className: b() },
45
45
  React.createElement("div", { className: b('wrapper') },
46
46
  themedBackground && (React.createElement(BackgroundMedia, Object.assign({}, themedBackground, { className: b('background') }))),
47
47
  React.createElement(Layout, { navigation: navigation },
@@ -200,7 +200,11 @@ export interface MediaComponentImageProps {
200
200
  export interface MediaComponentDataLensProps {
201
201
  dataLens: DataLensProps;
202
202
  }
203
- export interface MediaProps extends Animatable, Partial<MediaComponentDataLensProps>, Partial<MediaComponentYoutubeProps>, Partial<MediaComponentImageProps>, Partial<MediaComponentVideoProps> {
203
+ export interface MediaComponentIframeProps {
204
+ iframe: IframeProps;
205
+ margins?: boolean;
206
+ }
207
+ export interface MediaProps extends Animatable, Partial<MediaComponentDataLensProps>, Partial<MediaComponentYoutubeProps>, Partial<MediaComponentImageProps>, Partial<MediaComponentIframeProps>, Partial<MediaComponentVideoProps> {
204
208
  color?: string;
205
209
  }
206
210
  export interface BackgroundMediaProps extends MediaProps, Animatable, QAProps {
@@ -253,6 +257,13 @@ export interface DataLensObjectProps {
253
257
  id: string;
254
258
  theme: 'dark' | 'light';
255
259
  }
260
+ export interface IframeProps {
261
+ src: string;
262
+ width?: number;
263
+ height?: number;
264
+ title?: string;
265
+ name?: string;
266
+ }
256
267
  export type DataLensProps = string | DataLensObjectProps;
257
268
  export interface AuthorItem {
258
269
  firstName: string;
@@ -1098,6 +1098,26 @@ export declare const cardSchemas: {
1098
1098
  ratio: {
1099
1099
  type: string;
1100
1100
  };
1101
+ iframe: {
1102
+ src: {
1103
+ type: string;
1104
+ };
1105
+ name: {
1106
+ type: string;
1107
+ };
1108
+ title: {
1109
+ type: string;
1110
+ };
1111
+ height: {
1112
+ type: string;
1113
+ };
1114
+ width: {
1115
+ type: string;
1116
+ };
1117
+ };
1118
+ margins: {
1119
+ type: string;
1120
+ };
1101
1121
  border: {
1102
1122
  type: string;
1103
1123
  enum: string[];
@@ -1353,6 +1353,26 @@ export declare const MediaProps: {
1353
1353
  ratio: {
1354
1354
  type: string;
1355
1355
  };
1356
+ iframe: {
1357
+ src: {
1358
+ type: string;
1359
+ };
1360
+ name: {
1361
+ type: string;
1362
+ };
1363
+ title: {
1364
+ type: string;
1365
+ };
1366
+ height: {
1367
+ type: string;
1368
+ };
1369
+ width: {
1370
+ type: string;
1371
+ };
1372
+ };
1373
+ margins: {
1374
+ type: string;
1375
+ };
1356
1376
  };
1357
1377
  export declare const YMapMarkerLabel: {
1358
1378
  type: string;
@@ -496,6 +496,23 @@ export const ButtonBlock = {
496
496
  required: ['text', 'url'],
497
497
  },
498
498
  };
499
+ const IframeProps = {
500
+ src: {
501
+ type: 'string',
502
+ },
503
+ name: {
504
+ type: 'string',
505
+ },
506
+ title: {
507
+ type: 'string',
508
+ },
509
+ height: {
510
+ type: 'number',
511
+ },
512
+ width: {
513
+ type: 'number',
514
+ },
515
+ };
499
516
  export const MediaProps = {
500
517
  color: {
501
518
  type: 'string',
@@ -529,6 +546,10 @@ export const MediaProps = {
529
546
  ratio: {
530
547
  type: 'number',
531
548
  },
549
+ iframe: Object.assign({}, IframeProps),
550
+ margins: {
551
+ type: 'number',
552
+ },
532
553
  };
533
554
  export const YMapMarkerLabel = {
534
555
  type: 'object',
@@ -246,6 +246,26 @@ export declare const LayoutItem: {
246
246
  ratio: {
247
247
  type: string;
248
248
  };
249
+ iframe: {
250
+ src: {
251
+ type: string;
252
+ };
253
+ name: {
254
+ type: string;
255
+ };
256
+ title: {
257
+ type: string;
258
+ };
259
+ height: {
260
+ type: string;
261
+ };
262
+ width: {
263
+ type: string;
264
+ };
265
+ };
266
+ margins: {
267
+ type: string;
268
+ };
249
269
  };
250
270
  content: Partial<{
251
271
  title: {
@@ -251,6 +251,26 @@ export declare const MediaCardBlock: {
251
251
  ratio: {
252
252
  type: string;
253
253
  };
254
+ iframe: {
255
+ src: {
256
+ type: string;
257
+ };
258
+ name: {
259
+ type: string;
260
+ };
261
+ title: {
262
+ type: string;
263
+ };
264
+ height: {
265
+ type: string;
266
+ };
267
+ width: {
268
+ type: string;
269
+ };
270
+ };
271
+ margins: {
272
+ type: string;
273
+ };
254
274
  border: {
255
275
  type: string;
256
276
  enum: string[];
@@ -635,6 +635,26 @@ export declare const PriceCardBlock: {
635
635
  ratio: {
636
636
  type: string;
637
637
  };
638
+ iframe: {
639
+ src: {
640
+ type: string;
641
+ };
642
+ name: {
643
+ type: string;
644
+ };
645
+ title: {
646
+ type: string;
647
+ };
648
+ height: {
649
+ type: string;
650
+ };
651
+ width: {
652
+ type: string;
653
+ };
654
+ };
655
+ margins: {
656
+ type: string;
657
+ };
638
658
  border: {
639
659
  type: string;
640
660
  enum: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "4.38.1",
3
+ "version": "4.39.1",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -200,7 +200,11 @@ export interface MediaComponentImageProps {
200
200
  export interface MediaComponentDataLensProps {
201
201
  dataLens: DataLensProps;
202
202
  }
203
- export interface MediaProps extends Animatable, Partial<MediaComponentDataLensProps>, Partial<MediaComponentYoutubeProps>, Partial<MediaComponentImageProps>, Partial<MediaComponentVideoProps> {
203
+ export interface MediaComponentIframeProps {
204
+ iframe: IframeProps;
205
+ margins?: boolean;
206
+ }
207
+ export interface MediaProps extends Animatable, Partial<MediaComponentDataLensProps>, Partial<MediaComponentYoutubeProps>, Partial<MediaComponentImageProps>, Partial<MediaComponentIframeProps>, Partial<MediaComponentVideoProps> {
204
208
  color?: string;
205
209
  }
206
210
  export interface BackgroundMediaProps extends MediaProps, Animatable, QAProps {
@@ -253,6 +257,13 @@ export interface DataLensObjectProps {
253
257
  id: string;
254
258
  theme: 'dark' | 'light';
255
259
  }
260
+ export interface IframeProps {
261
+ src: string;
262
+ width?: number;
263
+ height?: number;
264
+ title?: string;
265
+ name?: string;
266
+ }
256
267
  export type DataLensProps = string | DataLensObjectProps;
257
268
  export interface AuthorItem {
258
269
  firstName: string;