@gravity-ui/page-constructor 1.2.5 → 1.3.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/CHANGELOG.md +7 -0
- package/build/cjs/blocks/Companies/Companies.js +2 -6
- package/build/cjs/blocks/ContentLayout/schema.js +2 -1
- package/build/cjs/blocks/Header/Header.css +11 -10
- package/build/cjs/blocks/Header/Header.js +15 -15
- package/build/cjs/blocks/Header/schema.d.ts +332 -230
- package/build/cjs/blocks/Header/schema.js +6 -20
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +96 -115
- package/build/cjs/blocks/Tabs/Tabs.js +3 -2
- package/build/cjs/blocks/Tabs/schema.js +2 -1
- package/build/cjs/components/BackgroundImage/BackgroundImage.js +2 -2
- package/build/cjs/components/BackgroundMedia/BackgroundMedia.css +2 -0
- package/build/cjs/components/Image/Image.d.ts +2 -4
- package/build/cjs/components/Image/Image.js +16 -6
- package/build/cjs/components/Image/schema.d.ts +56 -0
- package/build/cjs/components/Image/schema.js +54 -0
- package/build/cjs/components/Media/Image/Image.js +3 -3
- package/build/cjs/components/Media/Image/utils.d.ts +2 -2
- package/build/cjs/models/constructor-items/blocks.d.ts +4 -8
- package/build/cjs/models/constructor-items/common.d.ts +11 -7
- package/build/cjs/models/guards.d.ts +2 -3
- package/build/cjs/models/guards.js +1 -5
- package/build/cjs/schema/validators/common.d.ts +0 -31
- package/build/cjs/schema/validators/common.js +5 -32
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -1
- package/build/cjs/sub-blocks/BasicCard/BasicCard.js +1 -1
- package/build/cjs/sub-blocks/BasicCard/schema.js +2 -1
- package/build/cjs/sub-blocks/Partner/Partner.js +1 -1
- package/build/cjs/sub-blocks/Partner/schema.js +2 -1
- package/build/cjs/sub-blocks/Quote/Quote.js +3 -2
- package/build/cjs/sub-blocks/Quote/schema.js +4 -3
- package/build/cjs/sub-blocks/TutorialCard/TutorialCard.js +2 -2
- package/build/cjs/sub-blocks/TutorialCard/schema.js +2 -1
- package/build/esm/blocks/Companies/Companies.js +2 -6
- package/build/esm/blocks/ContentLayout/schema.js +2 -1
- package/build/esm/blocks/Header/Header.css +11 -10
- package/build/esm/blocks/Header/Header.js +16 -16
- package/build/esm/blocks/Header/schema.d.ts +332 -230
- package/build/esm/blocks/Header/schema.js +5 -19
- package/build/esm/blocks/HeaderSlider/schema.d.ts +96 -115
- package/build/esm/blocks/Tabs/Tabs.js +3 -2
- package/build/esm/blocks/Tabs/schema.js +2 -1
- package/build/esm/components/BackgroundImage/BackgroundImage.js +2 -2
- package/build/esm/components/BackgroundMedia/BackgroundMedia.css +2 -0
- package/build/esm/components/Image/Image.d.ts +2 -4
- package/build/esm/components/Image/Image.js +17 -7
- package/build/esm/components/Image/schema.d.ts +56 -0
- package/build/esm/components/Image/schema.js +51 -0
- package/build/esm/components/Media/Image/Image.js +3 -3
- package/build/esm/components/Media/Image/utils.d.ts +2 -2
- package/build/esm/models/constructor-items/blocks.d.ts +4 -8
- package/build/esm/models/constructor-items/common.d.ts +11 -7
- package/build/esm/models/guards.d.ts +2 -3
- package/build/esm/models/guards.js +0 -3
- package/build/esm/schema/validators/common.d.ts +0 -31
- package/build/esm/schema/validators/common.js +1 -28
- package/build/esm/sub-blocks/BackgroundCard/schema.js +2 -1
- package/build/esm/sub-blocks/BasicCard/BasicCard.js +1 -1
- package/build/esm/sub-blocks/BasicCard/schema.js +2 -1
- package/build/esm/sub-blocks/Partner/Partner.js +1 -1
- package/build/esm/sub-blocks/Partner/schema.js +2 -1
- package/build/esm/sub-blocks/Quote/Quote.js +3 -2
- package/build/esm/sub-blocks/Quote/schema.js +2 -1
- package/build/esm/sub-blocks/TutorialCard/TutorialCard.js +2 -2
- package/build/esm/sub-blocks/TutorialCard/schema.js +2 -1
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +4 -8
- package/server/models/constructor-items/common.d.ts +11 -7
- package/server/models/guards.d.ts +2 -3
- package/server/models/guards.js +1 -5
|
@@ -19,7 +19,6 @@ export declare const sizeNumber: {
|
|
|
19
19
|
minimum: number;
|
|
20
20
|
};
|
|
21
21
|
export declare const contentThemes: string[];
|
|
22
|
-
export declare const urlPattern = "^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?(#[\\w\\-]+)?$";
|
|
23
22
|
export declare const BaseProps: {
|
|
24
23
|
type: {};
|
|
25
24
|
when: {};
|
|
@@ -159,36 +158,6 @@ export declare const JustifyProps: {
|
|
|
159
158
|
type: string;
|
|
160
159
|
enum: string[];
|
|
161
160
|
};
|
|
162
|
-
export declare const ImageObjectProps: {
|
|
163
|
-
type: string;
|
|
164
|
-
additionalProperties: boolean;
|
|
165
|
-
required: string[];
|
|
166
|
-
properties: {
|
|
167
|
-
src: {
|
|
168
|
-
type: string;
|
|
169
|
-
pattern: string;
|
|
170
|
-
};
|
|
171
|
-
alt: {
|
|
172
|
-
type: string;
|
|
173
|
-
};
|
|
174
|
-
disableCompress: {
|
|
175
|
-
type: string;
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
export declare const ImageProps: {
|
|
180
|
-
oneOf: ({
|
|
181
|
-
type: string;
|
|
182
|
-
properties: {
|
|
183
|
-
when: {
|
|
184
|
-
type: string;
|
|
185
|
-
};
|
|
186
|
-
};
|
|
187
|
-
} | {
|
|
188
|
-
type: string;
|
|
189
|
-
pattern: string;
|
|
190
|
-
})[];
|
|
191
|
-
};
|
|
192
161
|
export declare const DataLensObjectProps: {
|
|
193
162
|
type: string;
|
|
194
163
|
additionalProperties: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { filteredItem } from './utils';
|
|
2
1
|
import { pixelEvents } from './pixel';
|
|
3
2
|
import { Theme } from '../../models';
|
|
3
|
+
import { ImageProps, urlPattern } from '../../components/Image/schema';
|
|
4
4
|
export const mediaDirection = ['media-content', 'content-media'];
|
|
5
5
|
export const textSize = ['s', 'm', 'l'];
|
|
6
6
|
export const containerSizesArray = ['sm', 'md', 'lg', 'xl', 'all'];
|
|
@@ -15,7 +15,6 @@ export const fileLinkTypes = ['vertical', 'horizontal'];
|
|
|
15
15
|
export const dividerEnum = { enum: [0, 'xxs', 'xs', 's', 'm', 'l', 'xl', 'xxl', 'xxxl'] };
|
|
16
16
|
export const sizeNumber = { type: 'number', maximum: 12, minimum: 1 };
|
|
17
17
|
export const contentThemes = ['default', 'dark', 'light'];
|
|
18
|
-
export const urlPattern = '^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?(#[\\w\\-]+)?$';
|
|
19
18
|
export const BaseProps = {
|
|
20
19
|
type: {},
|
|
21
20
|
when: {},
|
|
@@ -127,32 +126,6 @@ export const JustifyProps = {
|
|
|
127
126
|
type: 'string',
|
|
128
127
|
enum: ['start', 'center', 'end'],
|
|
129
128
|
};
|
|
130
|
-
export const ImageObjectProps = {
|
|
131
|
-
type: 'object',
|
|
132
|
-
additionalProperties: false,
|
|
133
|
-
required: ['src'],
|
|
134
|
-
properties: {
|
|
135
|
-
src: {
|
|
136
|
-
type: 'string',
|
|
137
|
-
pattern: urlPattern,
|
|
138
|
-
},
|
|
139
|
-
alt: {
|
|
140
|
-
type: 'string',
|
|
141
|
-
},
|
|
142
|
-
disableCompress: {
|
|
143
|
-
type: 'boolean',
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
};
|
|
147
|
-
export const ImageProps = {
|
|
148
|
-
oneOf: [
|
|
149
|
-
{
|
|
150
|
-
type: 'string',
|
|
151
|
-
pattern: urlPattern,
|
|
152
|
-
},
|
|
153
|
-
filteredItem(Object.assign({}, ImageObjectProps)),
|
|
154
|
-
],
|
|
155
|
-
};
|
|
156
129
|
export const DataLensObjectProps = {
|
|
157
130
|
type: 'object',
|
|
158
131
|
additionalProperties: false,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { BaseProps,
|
|
1
|
+
import { BaseProps, withTheme } from '../../schema/validators/common';
|
|
2
2
|
import { CardBase } from '../../components/CardBase/schema';
|
|
3
3
|
import { ContentBase } from '../Content/schema';
|
|
4
|
+
import { ImageObjectProps } from '../../components/Image/schema';
|
|
4
5
|
import _ from 'lodash';
|
|
5
6
|
const BackgroundCardContentProps = _.omit(ContentBase, ['size']);
|
|
6
7
|
export const BackgroundCard = {
|
|
@@ -11,7 +11,7 @@ const BasicCard = (props) => {
|
|
|
11
11
|
const iconProps = icon && getMediaImage(icon);
|
|
12
12
|
return (React.createElement(CardBase, { className: b(), url: url, border: border },
|
|
13
13
|
React.createElement(CardBase.Content, null,
|
|
14
|
-
iconProps &&
|
|
14
|
+
iconProps && React.createElement(Image, Object.assign({}, iconProps, { className: b('icon') })),
|
|
15
15
|
React.createElement(Content, { title: title, text: text, additionalInfo: additionalInfo, links: links, buttons: buttons, colSizes: { all: 12, md: 12 }, size: "s" }))));
|
|
16
16
|
};
|
|
17
17
|
export default BasicCard;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
-
import { BaseProps
|
|
2
|
+
import { BaseProps } from '../../schema/validators/common';
|
|
3
3
|
import { CardBase } from '../../components/CardBase/schema';
|
|
4
4
|
import { ContentBase } from '../Content/schema';
|
|
5
|
+
import { ImageProps } from '../../components/Image/schema';
|
|
5
6
|
const BasicCardContentProps = _.omit(ContentBase, ['size', 'theme']);
|
|
6
7
|
export const BasicCard = {
|
|
7
8
|
'basic-card': {
|
|
@@ -7,7 +7,7 @@ const Partner = ({ text, logo, url, border }) => {
|
|
|
7
7
|
const logoData = typeof logo === 'string' ? { src: logo } : logo;
|
|
8
8
|
return (React.createElement(CardBase, { url: url, target: "_blank", className: b(), border: border },
|
|
9
9
|
React.createElement(CardBase.Content, null,
|
|
10
|
-
React.createElement(Image, { className: b('logo')
|
|
10
|
+
React.createElement(Image, Object.assign({ className: b('logo') }, logoData)),
|
|
11
11
|
React.createElement(HTML, null, text))));
|
|
12
12
|
};
|
|
13
13
|
export default Partner;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BaseProps
|
|
1
|
+
import { BaseProps } from '../../schema/validators/common';
|
|
2
|
+
import { ImageProps } from '../../components/Image/schema';
|
|
2
3
|
export const PartnerBlock = {
|
|
3
4
|
partner: {
|
|
4
5
|
additionalProperties: false,
|
|
@@ -4,13 +4,14 @@ import { block, getThemedValue } from '../../utils';
|
|
|
4
4
|
import { AuthorType } from '../../models';
|
|
5
5
|
import { Author, Image, HTML } from '../../components';
|
|
6
6
|
import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
|
|
7
|
+
import { getMediaImage } from '../../components/Media/Image/utils';
|
|
7
8
|
import './Quote.css';
|
|
8
9
|
const b = block('quote');
|
|
9
10
|
const Quote = (props) => {
|
|
10
11
|
const { theme: textTheme = 'light', color, image, border = 'shadow', text, logo, author, url, buttonText, } = props;
|
|
11
12
|
const { themeValue: theme } = useContext(ThemeValueContext);
|
|
12
13
|
const imageThemed = getThemedValue(image, theme);
|
|
13
|
-
const imageData =
|
|
14
|
+
const imageData = getMediaImage(imageThemed);
|
|
14
15
|
const renderFooter = Boolean(author || url) && (React.createElement("div", { className: b('author-wrapper') },
|
|
15
16
|
author && (React.createElement(Author, { className: b('author', { theme: textTheme }), author: author, type: AuthorType.Line })),
|
|
16
17
|
url && buttonText && (React.createElement(Button, { view: "outlined", size: "xl", href: url, className: b('link-button', { theme: textTheme }) }, buttonText))));
|
|
@@ -23,6 +24,6 @@ const Quote = (props) => {
|
|
|
23
24
|
React.createElement(HTML, null, text)))),
|
|
24
25
|
renderFooter),
|
|
25
26
|
React.createElement("div", { className: b('image-wrapper') },
|
|
26
|
-
React.createElement(Image, {
|
|
27
|
+
React.createElement(Image, Object.assign({}, imageData, { className: b('image') })))));
|
|
27
28
|
};
|
|
28
29
|
export default Quote;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { authorItem, BaseProps,
|
|
1
|
+
import { authorItem, BaseProps, ThemeProps, withTheme } from '../../schema/validators/common';
|
|
2
|
+
import { ImageProps, urlPattern } from '../../components/Image/schema';
|
|
2
3
|
export const Quote = {
|
|
3
4
|
quote: {
|
|
4
5
|
additionalProperties: false,
|
|
@@ -6,8 +6,8 @@ import { getMediaImage } from '../../components/Media/Image/utils';
|
|
|
6
6
|
import './TutorialCard.css';
|
|
7
7
|
const b = block('tutorial-card');
|
|
8
8
|
function iconElement(icon, title) {
|
|
9
|
-
const
|
|
10
|
-
return React.createElement(Image, {
|
|
9
|
+
const image = getMediaImage(icon !== null && icon !== void 0 ? icon : {});
|
|
10
|
+
return React.createElement(Image, Object.assign({}, image, { alt: image.alt || title, className: b('icon') }));
|
|
11
11
|
}
|
|
12
12
|
const TutorialCard = (props) => {
|
|
13
13
|
const { url, title, text, border, icon } = props;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BaseProps
|
|
1
|
+
import { BaseProps } from '../../schema/validators/common';
|
|
2
|
+
import { ImageProps } from '../../components/Image/schema';
|
|
2
3
|
export const TutorialCard = {
|
|
3
4
|
'tutorial-card': {
|
|
4
5
|
additionalProperties: false,
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, Justify, LinkProps, LinkTheme, MediaDirection, MediaProps, PreviewItemProps, PreviewRatioMediaContent, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleProps, LegendTableMarkerType, AnchorProps, TitleBaseProps, Animatable, BlockHeaderProps } from './common';
|
|
2
|
+
import { BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, Justify, LinkProps, LinkTheme, MediaDirection, MediaProps, PreviewItemProps, PreviewRatioMediaContent, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleProps, LegendTableMarkerType, AnchorProps, TitleBaseProps, Animatable, BlockHeaderProps, ImageDeviceProps } from './common';
|
|
3
3
|
import { ThemeSupporting } from '../../utils';
|
|
4
4
|
import { GridColumnSize, GridColumnSizesType } from '../../grid/types';
|
|
5
5
|
import { BannerCardProps, SubBlock } from './sub-blocks';
|
|
@@ -78,8 +78,9 @@ export interface HeaderSliderBlockProps extends Omit<SliderProps, 'title' | 'des
|
|
|
78
78
|
items: HeaderBlockProps[];
|
|
79
79
|
}
|
|
80
80
|
interface HeaderBackgroundProps {
|
|
81
|
-
|
|
81
|
+
/** @deprecated replaced by Media Props image */
|
|
82
82
|
url?: string;
|
|
83
|
+
/** @deprecated replaced by Media Props image */
|
|
83
84
|
disableCompress?: boolean;
|
|
84
85
|
}
|
|
85
86
|
export interface HeaderBlockBackground extends Partial<HeaderBackgroundProps>, Partial<MediaProps> {
|
|
@@ -151,12 +152,7 @@ export interface BannerBlockProps extends BannerCardProps, Animatable {
|
|
|
151
152
|
}
|
|
152
153
|
export interface CompaniesBlockProps extends Animatable {
|
|
153
154
|
title: string;
|
|
154
|
-
images: ThemeSupporting<
|
|
155
|
-
desktop: string;
|
|
156
|
-
tablet: string;
|
|
157
|
-
mobile: string;
|
|
158
|
-
alt?: string;
|
|
159
|
-
}>;
|
|
155
|
+
images: ThemeSupporting<ImageDeviceProps>;
|
|
160
156
|
}
|
|
161
157
|
export interface MediaContentProps {
|
|
162
158
|
title: string;
|
|
@@ -81,17 +81,21 @@ interface LoopProps {
|
|
|
81
81
|
start: number;
|
|
82
82
|
end?: number;
|
|
83
83
|
}
|
|
84
|
-
export interface
|
|
85
|
-
src: string;
|
|
84
|
+
export interface ImageInfoProps {
|
|
86
85
|
alt?: string;
|
|
87
86
|
disableCompress?: boolean;
|
|
88
87
|
}
|
|
89
|
-
export
|
|
88
|
+
export interface ImageObjectProps extends ImageInfoProps {
|
|
89
|
+
src: string;
|
|
90
|
+
}
|
|
91
|
+
export interface ImageDeviceProps extends ImageInfoProps {
|
|
92
|
+
desktop: string;
|
|
93
|
+
mobile: string;
|
|
94
|
+
tablet?: string;
|
|
95
|
+
}
|
|
96
|
+
export declare type ImageProps = string | ImageObjectProps | ImageDeviceProps;
|
|
90
97
|
export declare type ThemedImage = ThemeSupporting<ImageProps>;
|
|
91
|
-
export interface BackgroundImageProps extends React.HTMLProps<HTMLDivElement> {
|
|
92
|
-
src?: string;
|
|
93
|
-
alt?: string;
|
|
94
|
-
disableCompress?: boolean;
|
|
98
|
+
export interface BackgroundImageProps extends React.HTMLProps<HTMLDivElement>, Partial<ImageDeviceProps>, Partial<ImageObjectProps> {
|
|
95
99
|
style?: CSSProperties;
|
|
96
100
|
imageClassName?: string;
|
|
97
101
|
hide?: boolean;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Block, ConstructorItem
|
|
2
|
-
import {
|
|
1
|
+
import { Block, ConstructorItem } from './';
|
|
2
|
+
import { MetrikaGoal, NewMetrikaGoal } from './index';
|
|
3
3
|
export declare function isBlock(block: ConstructorItem): block is Block;
|
|
4
4
|
export declare function isNewMetrikaFormat(metrika: MetrikaGoal): metrika is NewMetrikaGoal[];
|
|
5
|
-
export declare function headerHasMediaBackground(background: HeaderBlockBackground): background is MediaProps;
|
package/server/models/guards.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isNewMetrikaFormat = exports.isBlock = void 0;
|
|
4
4
|
const _1 = require("./");
|
|
5
5
|
function isBlock(block) {
|
|
6
6
|
return block.type in _1.BlockTypes;
|
|
@@ -10,7 +10,3 @@ function isNewMetrikaFormat(metrika) {
|
|
|
10
10
|
return Boolean(Array.isArray(metrika) && metrika.length && typeof metrika[0] === 'object');
|
|
11
11
|
}
|
|
12
12
|
exports.isNewMetrikaFormat = isNewMetrikaFormat;
|
|
13
|
-
function headerHasMediaBackground(background) {
|
|
14
|
-
return 'image' in background || 'video' in background || 'youtube' in background;
|
|
15
|
-
}
|
|
16
|
-
exports.headerHasMediaBackground = headerHasMediaBackground;
|