@gravity-ui/page-constructor 1.20.5 → 1.21.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/CardLayout/CardLayout.d.ts +3 -5
- package/build/cjs/blocks/CardLayout/CardLayout.js +2 -6
- package/build/cjs/blocks/FilterBlock/FilterBlock.css +50 -0
- package/build/cjs/blocks/FilterBlock/FilterBlock.d.ts +4 -0
- package/build/cjs/blocks/FilterBlock/FilterBlock.js +48 -0
- package/build/cjs/blocks/FilterBlock/i18n/en.json +3 -0
- package/build/cjs/blocks/FilterBlock/i18n/index.d.ts +2 -0
- package/build/cjs/blocks/FilterBlock/i18n/index.js +8 -0
- package/build/cjs/blocks/FilterBlock/i18n/ru.json +3 -0
- package/build/cjs/blocks/FilterBlock/schema.d.ts +229 -0
- package/build/cjs/blocks/FilterBlock/schema.js +41 -0
- package/build/cjs/blocks/Tabs/Tabs.css +27 -18
- package/build/cjs/blocks/index.d.ts +1 -0
- package/build/cjs/blocks/index.js +3 -1
- package/build/cjs/components/Button/Button.css +4 -0
- package/build/cjs/components/ButtonTabs/ButtonTabs.css +16 -3
- package/build/cjs/components/ButtonTabs/ButtonTabs.d.ts +7 -4
- package/build/cjs/components/ButtonTabs/ButtonTabs.js +2 -6
- package/build/cjs/constructor-items.d.ts +2 -1
- package/build/cjs/constructor-items.js +1 -0
- package/build/cjs/containers/PageConstructor/PageConstructor.css +8 -0
- package/build/cjs/containers/PageConstructor/PageConstructor.js +13 -14
- package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.d.ts +3 -5
- package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +3 -3
- package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.d.ts +3 -3
- package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +4 -4
- package/build/cjs/context/innerContext/InnerContext.d.ts +4 -1
- package/build/cjs/context/innerContext/InnerContext.js +2 -0
- package/build/cjs/models/constructor-items/blocks.d.ts +26 -3
- package/build/cjs/models/constructor-items/blocks.js +1 -0
- package/build/cjs/utils/blocks.d.ts +1 -0
- package/build/cjs/utils/blocks.js +6 -1
- package/build/esm/blocks/CardLayout/CardLayout.d.ts +3 -5
- package/build/esm/blocks/CardLayout/CardLayout.js +3 -7
- package/build/esm/blocks/FilterBlock/FilterBlock.css +50 -0
- package/build/esm/blocks/FilterBlock/FilterBlock.d.ts +5 -0
- package/build/esm/blocks/FilterBlock/FilterBlock.js +46 -0
- package/build/esm/blocks/FilterBlock/i18n/en.json +3 -0
- package/build/esm/blocks/FilterBlock/i18n/index.d.ts +2 -0
- package/build/esm/blocks/FilterBlock/i18n/index.js +5 -0
- package/build/esm/blocks/FilterBlock/i18n/ru.json +3 -0
- package/build/esm/blocks/FilterBlock/schema.d.ts +229 -0
- package/build/esm/blocks/FilterBlock/schema.js +38 -0
- package/build/esm/blocks/Tabs/Tabs.css +27 -18
- package/build/esm/blocks/index.d.ts +1 -0
- package/build/esm/blocks/index.js +1 -0
- package/build/esm/components/Button/Button.css +4 -0
- package/build/esm/components/ButtonTabs/ButtonTabs.css +16 -3
- package/build/esm/components/ButtonTabs/ButtonTabs.d.ts +7 -4
- package/build/esm/components/ButtonTabs/ButtonTabs.js +2 -6
- package/build/esm/constructor-items.d.ts +2 -1
- package/build/esm/constructor-items.js +2 -1
- package/build/esm/containers/PageConstructor/PageConstructor.css +8 -0
- package/build/esm/containers/PageConstructor/PageConstructor.js +15 -16
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.d.ts +3 -5
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js +3 -3
- package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.d.ts +3 -3
- package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +4 -4
- package/build/esm/context/innerContext/InnerContext.d.ts +4 -1
- package/build/esm/context/innerContext/InnerContext.js +2 -0
- package/build/esm/models/constructor-items/blocks.d.ts +26 -3
- package/build/esm/models/constructor-items/blocks.js +1 -0
- package/build/esm/utils/blocks.d.ts +1 -0
- package/build/esm/utils/blocks.js +4 -0
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +26 -3
- package/server/models/constructor-items/blocks.js +1 -0
- package/server/utils/blocks.d.ts +1 -0
- package/server/utils/blocks.js +6 -1
- package/styles/mixins.scss +62 -5
- package/styles/root.scss +10 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AnimatableProps, BlockBaseProps, BlockHeaderProps, containerSizesObject, } from '../../schema/validators/common';
|
|
2
|
+
import { filteredArray } from '../../schema/validators/utils';
|
|
3
|
+
export const FilterTagProps = {
|
|
4
|
+
additionalProperties: false,
|
|
5
|
+
required: ['id', 'label'],
|
|
6
|
+
properties: {
|
|
7
|
+
id: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
},
|
|
10
|
+
label: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
export const FilterItemProps = {
|
|
16
|
+
additionalProperties: false,
|
|
17
|
+
required: ['tags', 'card'],
|
|
18
|
+
properties: {
|
|
19
|
+
tags: {
|
|
20
|
+
type: 'array',
|
|
21
|
+
items: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
card: { $ref: 'self#/definitions/card' },
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export const FilterProps = {
|
|
29
|
+
additionalProperties: false,
|
|
30
|
+
required: ['filterTags', 'block'],
|
|
31
|
+
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, BlockBaseProps), AnimatableProps), BlockHeaderProps), { allTag: { oneOf: [{ type: 'boolean' }, { type: 'string' }] }, colSizes: containerSizesObject, tags: filteredArray(FilterTagProps), items: filteredArray(FilterItemProps), tagButtonSize: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
enum: ['s', 'm', 'l', 'xl'],
|
|
34
|
+
} }),
|
|
35
|
+
};
|
|
36
|
+
export const FilterBlock = {
|
|
37
|
+
'filterable-block': FilterProps,
|
|
38
|
+
};
|
|
@@ -13,11 +13,38 @@ unpredictable css rules order in build */
|
|
|
13
13
|
.pc-tabs-block__block-title_centered > * {
|
|
14
14
|
margin: 0 auto;
|
|
15
15
|
}
|
|
16
|
+
.pc-tabs-block__tabs {
|
|
17
|
+
margin-bottom: 20px;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-wrap: nowrap;
|
|
20
|
+
justify-content: flex-start;
|
|
21
|
+
overflow: auto;
|
|
22
|
+
}
|
|
16
23
|
.pc-tabs-block__tabs_centered {
|
|
17
24
|
display: flex;
|
|
18
25
|
justify-content: center;
|
|
19
26
|
flex-wrap: wrap;
|
|
20
27
|
}
|
|
28
|
+
@media (max-width: 769px) {
|
|
29
|
+
.pc-tabs-block__tabs {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-wrap: nowrap;
|
|
32
|
+
justify-content: flex-start;
|
|
33
|
+
overflow: auto;
|
|
34
|
+
margin-left: -48px;
|
|
35
|
+
margin-right: -48px;
|
|
36
|
+
padding-left: 48px;
|
|
37
|
+
padding-right: 40px;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
@media (max-width: 577px) {
|
|
41
|
+
.pc-tabs-block__tabs {
|
|
42
|
+
margin-left: -24px;
|
|
43
|
+
margin-right: -24px;
|
|
44
|
+
padding-left: 24px;
|
|
45
|
+
padding-right: 16px;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
21
48
|
.pc-tabs-block__row_reverse {
|
|
22
49
|
flex-direction: row-reverse;
|
|
23
50
|
}
|
|
@@ -65,16 +92,6 @@ unpredictable css rules order in build */
|
|
|
65
92
|
}
|
|
66
93
|
|
|
67
94
|
@media (max-width: 769px) {
|
|
68
|
-
.pc-tabs-block__tabs {
|
|
69
|
-
display: flex;
|
|
70
|
-
flex-wrap: nowrap;
|
|
71
|
-
justify-content: flex-start;
|
|
72
|
-
overflow: auto;
|
|
73
|
-
margin-left: -48px;
|
|
74
|
-
margin-right: -48px;
|
|
75
|
-
padding-left: 48px;
|
|
76
|
-
padding-right: 40px;
|
|
77
|
-
}
|
|
78
95
|
.pc-tabs-block__content-wrapper_margin {
|
|
79
96
|
margin: 0 0 32px 0;
|
|
80
97
|
}
|
|
@@ -86,14 +103,6 @@ unpredictable css rules order in build */
|
|
|
86
103
|
padding-bottom: 0;
|
|
87
104
|
}
|
|
88
105
|
}
|
|
89
|
-
@media (max-width: 577px) {
|
|
90
|
-
.pc-tabs-block__tabs {
|
|
91
|
-
margin-left: -24px;
|
|
92
|
-
margin-right: -24px;
|
|
93
|
-
padding-left: 24px;
|
|
94
|
-
padding-right: 16px;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
106
|
@media (min-width: 769px) {
|
|
98
107
|
.pc-tabs-block.pc-AnimateBlock .pc-tabs-block__media, .pc-AnimateBlock .pc-tabs-block .pc-tabs-block__media {
|
|
99
108
|
position: relative;
|
|
@@ -19,3 +19,4 @@ export { default as HeaderSliderBlock } from './HeaderSlider/HeaderSlider';
|
|
|
19
19
|
export { default as CardLayoutBlock } from './CardLayout/CardLayout';
|
|
20
20
|
export { default as ContentLayoutBlock } from './ContentLayout/ContentLayout';
|
|
21
21
|
export { default as ShareBlock } from './Share/Share';
|
|
22
|
+
export { default as FilterBlock } from './FilterBlock/FilterBlock';
|
|
@@ -19,3 +19,4 @@ export { default as HeaderSliderBlock } from './HeaderSlider/HeaderSlider';
|
|
|
19
19
|
export { default as CardLayoutBlock } from './CardLayout/CardLayout';
|
|
20
20
|
export { default as ContentLayoutBlock } from './ContentLayout/ContentLayout';
|
|
21
21
|
export { default as ShareBlock } from './Share/Share';
|
|
22
|
+
export { default as FilterBlock } from './FilterBlock/FilterBlock';
|
|
@@ -14,6 +14,8 @@ unpredictable css rules order in build */
|
|
|
14
14
|
.pc-button-block_theme_github.pc-button-block_theme_github {
|
|
15
15
|
--yc-button-background-color: var(--pc-monochrome-button-background-color);
|
|
16
16
|
--yc-button-background-color-hover: var(--pc-monochrome-button-background-color-hover);
|
|
17
|
+
}
|
|
18
|
+
.pc-button-block_theme_github.pc-button-block_theme_github, .pc-button-block_theme_github.pc-button-block_theme_github:link, .pc-button-block_theme_github.pc-button-block_theme_github:visited, .pc-button-block_theme_github.pc-button-block_theme_github:active, .pc-button-block_theme_github.pc-button-block_theme_github:focus {
|
|
17
19
|
color: var(--pc-monochrome-button-color);
|
|
18
20
|
}
|
|
19
21
|
.pc-button-block_theme_github.pc-button-block_theme_github:hover {
|
|
@@ -25,6 +27,8 @@ unpredictable css rules order in build */
|
|
|
25
27
|
.pc-button-block_theme_monochrome {
|
|
26
28
|
--yc-button-background-color: var(--pc-monochrome-button-background-color);
|
|
27
29
|
--yc-button-background-color-hover: var(--pc-monochrome-button-background-color-hover);
|
|
30
|
+
}
|
|
31
|
+
.pc-button-block_theme_monochrome, .pc-button-block_theme_monochrome:link, .pc-button-block_theme_monochrome:visited, .pc-button-block_theme_monochrome:active, .pc-button-block_theme_monochrome:focus {
|
|
28
32
|
color: var(--pc-monochrome-button-color);
|
|
29
33
|
}
|
|
30
34
|
.pc-button-block_theme_monochrome:hover {
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
/* use this for style redefinitions to awoid problems with
|
|
2
2
|
unpredictable css rules order in build */
|
|
3
|
-
.pc-button-tabs {
|
|
4
|
-
margin-bottom: 20px;
|
|
5
|
-
}
|
|
6
3
|
.pc-button-tabs__item {
|
|
7
4
|
margin-right: 8px;
|
|
8
5
|
margin-bottom: 12px;
|
|
6
|
+
--yc-button-background-color: var(--pc-tab-item-background-color);
|
|
7
|
+
--yc-button-background-color-hover: var(--pc-tab-item-background-color-hover);
|
|
8
|
+
}
|
|
9
|
+
.pc-button-tabs__item, .pc-button-tabs__item:link, .pc-button-tabs__item:visited, .pc-button-tabs__item:active, .pc-button-tabs__item:focus {
|
|
10
|
+
color: var(--pc-tab-item-color);
|
|
11
|
+
}
|
|
12
|
+
.pc-button-tabs__item:hover {
|
|
13
|
+
color: var(--pc-tab-item-color);
|
|
9
14
|
}
|
|
10
15
|
.pc-button-tabs__item_active {
|
|
11
16
|
pointer-events: none;
|
|
17
|
+
--yc-button-background-color: var(--pc-selected-tab-item-background-color);
|
|
18
|
+
--yc-button-background-color-hover: var(--pc-selected-tab-item-background-color-hover);
|
|
19
|
+
}
|
|
20
|
+
.pc-button-tabs__item_active, .pc-button-tabs__item_active:link, .pc-button-tabs__item_active:visited, .pc-button-tabs__item_active:active, .pc-button-tabs__item_active:focus {
|
|
21
|
+
color: var(--pc-selected-tab-item-color);
|
|
22
|
+
}
|
|
23
|
+
.pc-button-tabs__item_active:hover {
|
|
24
|
+
color: var(--pc-selected-tab-item-color);
|
|
12
25
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonSize } from '@gravity-ui/uikit';
|
|
1
3
|
import { ButtonProps } from '../../models';
|
|
2
4
|
import './ButtonTabs.css';
|
|
3
5
|
export interface ButtonTabsItemProps extends Omit<ButtonProps, 'url' | 'primary' | 'target' | 'text'> {
|
|
4
|
-
id: string;
|
|
6
|
+
id: string | null;
|
|
5
7
|
title: string;
|
|
6
8
|
}
|
|
7
9
|
export interface ButtonTabsProps {
|
|
8
10
|
className?: string;
|
|
9
11
|
items: ButtonTabsItemProps[];
|
|
10
|
-
activeTab?: string;
|
|
11
|
-
onSelectTab?: (tabId: string) => void;
|
|
12
|
+
activeTab?: string | null;
|
|
13
|
+
onSelectTab?: (tabId: string | null) => void;
|
|
14
|
+
tabSize?: ButtonSize;
|
|
12
15
|
}
|
|
13
|
-
declare const ButtonTabs:
|
|
16
|
+
declare const ButtonTabs: React.FC<ButtonTabsProps>;
|
|
14
17
|
export default ButtonTabs;
|
|
@@ -3,8 +3,7 @@ import { block } from '../../utils';
|
|
|
3
3
|
import { Button } from '../index';
|
|
4
4
|
import './ButtonTabs.css';
|
|
5
5
|
const b = block('button-tabs');
|
|
6
|
-
const ButtonTabs = (
|
|
7
|
-
const { className, items, activeTab, onSelectTab } = props;
|
|
6
|
+
const ButtonTabs = ({ className, items, activeTab, onSelectTab, tabSize = 'l', }) => {
|
|
8
7
|
const activeTabId = useMemo(() => {
|
|
9
8
|
if (activeTab) {
|
|
10
9
|
return activeTab;
|
|
@@ -16,9 +15,6 @@ const ButtonTabs = (props) => {
|
|
|
16
15
|
onSelectTab(tabId);
|
|
17
16
|
}
|
|
18
17
|
}, [onSelectTab]);
|
|
19
|
-
return (React.createElement("div", { className: b(null, className) }, items.map((item) =>
|
|
20
|
-
const isActive = item.id === activeTabId;
|
|
21
|
-
return (React.createElement(Button, { text: item.title, className: b('item', { active: isActive }), key: item.title, size: 'l', onClick: () => handleClick(item.id), theme: isActive ? 'monochrome' : 'normal' }));
|
|
22
|
-
})));
|
|
18
|
+
return (React.createElement("div", { className: b(null, className) }, items.map(({ id, title }) => (React.createElement(Button, { text: title, className: b('item', { active: id === activeTabId }), key: title, size: tabSize, onClick: () => handleClick(id) })))));
|
|
23
19
|
};
|
|
24
20
|
export default ButtonTabs;
|
|
@@ -16,10 +16,11 @@ export declare const blockMap: {
|
|
|
16
16
|
"header-block": (props: import("./models").WithChildren<import("./models").HeaderBlockProps & import("./models").ClassNameProps>) => JSX.Element;
|
|
17
17
|
"icons-block": ({ title, size, items }: import("./models").IconsBlockProps) => JSX.Element;
|
|
18
18
|
"header-slider-block": ({ items, arrows, ...props }: import("./models").HeaderSliderBlockProps) => JSX.Element;
|
|
19
|
-
"card-layout-block": (
|
|
19
|
+
"card-layout-block": import("react").FC<import("./blocks/CardLayout/CardLayout").CardLayoutBlockProps>;
|
|
20
20
|
"content-layout-block": (props: import("./models").ContentLayoutBlockProps) => JSX.Element;
|
|
21
21
|
"share-block": ({ items, title }: import("./models").ShareBlockProps) => JSX.Element;
|
|
22
22
|
"map-block": ({ map, ...props }: import("./models").MapBlockProps) => JSX.Element;
|
|
23
|
+
"filter-block": import("react").FC<import("./models").FilterBlockProps>;
|
|
23
24
|
};
|
|
24
25
|
export declare const subBlockMap: {
|
|
25
26
|
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, LayoutItem, BackgroundCard, Content, Quote, Divider, BannerCard, BasicCard, } from './sub-blocks';
|
|
3
|
-
import { BannerBlock, CompaniesBlock, SimpleBlock, MediaBlock, MapBlock, PreviewBlock, InfoBlock, SecurityBlock, SliderBlock, ExtendedFeaturesBlock, PromoFeaturesBlock, QuestionsBlock, TableBlock, TabsBlock, LinkTableBlock, HeaderBlock, IconsBlock, HeaderSliderBlock, CardLayoutBlock, ContentLayoutBlock, ShareBlock, } from './blocks';
|
|
3
|
+
import { BannerBlock, CompaniesBlock, SimpleBlock, MediaBlock, MapBlock, PreviewBlock, InfoBlock, SecurityBlock, SliderBlock, ExtendedFeaturesBlock, PromoFeaturesBlock, QuestionsBlock, TableBlock, TabsBlock, LinkTableBlock, HeaderBlock, IconsBlock, HeaderSliderBlock, CardLayoutBlock, ContentLayoutBlock, ShareBlock, FilterBlock, } from './blocks';
|
|
4
4
|
export const blockMap = {
|
|
5
5
|
[BlockType.SliderBlock]: SliderBlock,
|
|
6
6
|
[BlockType.SimpleBlock]: SimpleBlock,
|
|
@@ -23,6 +23,7 @@ export const blockMap = {
|
|
|
23
23
|
[BlockType.ContentLayoutBlock]: ContentLayoutBlock,
|
|
24
24
|
[BlockType.ShareBlock]: ShareBlock,
|
|
25
25
|
[BlockType.MapBlock]: MapBlock,
|
|
26
|
+
[BlockType.FilterBlock]: FilterBlock,
|
|
26
27
|
};
|
|
27
28
|
export const subBlockMap = {
|
|
28
29
|
[SubBlockType.Divider]: Divider,
|
|
@@ -19,6 +19,14 @@ unpredictable css rules order in build */
|
|
|
19
19
|
--pc-monochrome-button-color: var(--yc-color-text-light-primary);
|
|
20
20
|
--pc-text-header-color: var(--yc-color-text-primary);
|
|
21
21
|
--pc-media-card-meta-info-color: var(--yc-color-text-secondary);
|
|
22
|
+
--pc-tab-item-color: var(--yc-color-text-primary);
|
|
23
|
+
--pc-tab-item-background-color: var(--yc-color-base-generic);
|
|
24
|
+
--pc-tab-item-background-color-hover: var(--yc-color-base-generic-hover);
|
|
25
|
+
--pc-selected-tab-item-color: var(--pc-monochrome-button-color);
|
|
26
|
+
--pc-selected-tab-item-background-color: var(--pc-monochrome-button-background-color);
|
|
27
|
+
--pc-selected-tab-item-background-color-hover: var(
|
|
28
|
+
--pc-monochrome-button-background-color-hover
|
|
29
|
+
);
|
|
22
30
|
}
|
|
23
31
|
.yc-root.yc-root_theme_dark {
|
|
24
32
|
--pc-color-sfx-shadow: var(--yc-color-sfx-shadow);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React, { useContext, useMemo } from 'react';
|
|
3
3
|
import '@doc-tools/transform/dist/js/yfm';
|
|
4
|
-
import { HeaderBlockTypes, BlockTypes, } from '../../models';
|
|
4
|
+
import { HeaderBlockTypes, BlockTypes, SubBlockTypes, } from '../../models';
|
|
5
5
|
import { blockMap, subBlockMap } from '../../constructor-items';
|
|
6
6
|
import { Grid } from '../../grid';
|
|
7
7
|
import BackgroundMedia from '../../components/BackgroundMedia/BackgroundMedia';
|
|
8
|
-
import { block as cnBlock, getCustomBlockTypes, getCustomHeaderTypes, getThemedValue, getCustomItems, } from '../../utils';
|
|
8
|
+
import { block as cnBlock, getCustomBlockTypes, getCustomHeaderTypes, getThemedValue, getCustomItems, getCustomSubBlockTypes, } from '../../utils';
|
|
9
9
|
import { AnimateContext } from '../../context/animateContext';
|
|
10
10
|
import { InnerContext } from '../../context/innerContext';
|
|
11
11
|
import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
|
|
@@ -17,21 +17,20 @@ import Layout from '../../navigation/containers/Layout/Layout';
|
|
|
17
17
|
import './PageConstructor.css';
|
|
18
18
|
const b = cnBlock('page-constructor');
|
|
19
19
|
export const Constructor = (props) => {
|
|
20
|
-
const {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
}, [
|
|
20
|
+
const { content: { blocks = [], background = {}, footnotes = [] } = {}, renderMenu, shouldRenderBlock, navigation, custom, } = props;
|
|
21
|
+
const { context } = useMemo(() => ({
|
|
22
|
+
context: {
|
|
23
|
+
blockTypes: [...BlockTypes, ...getCustomBlockTypes(custom)],
|
|
24
|
+
subBlockTypes: [...SubBlockTypes, ...getCustomSubBlockTypes(custom)],
|
|
25
|
+
headerBlockTypes: [...HeaderBlockTypes, ...getCustomHeaderTypes(custom)],
|
|
26
|
+
itemMap: Object.assign(Object.assign(Object.assign({}, blockMap), subBlockMap), getCustomItems(custom)),
|
|
27
|
+
loadables: custom === null || custom === void 0 ? void 0 : custom.loadable,
|
|
28
|
+
shouldRenderBlock,
|
|
29
|
+
},
|
|
30
|
+
}), [custom, shouldRenderBlock]);
|
|
31
31
|
const { themeValue: theme } = useContext(ThemeValueContext);
|
|
32
|
-
const { content: { blocks = [], background = {}, footnotes = [] } = {}, renderMenu, shouldRenderBlock, navigation, } = props;
|
|
33
32
|
const hasFootnotes = footnotes.length > 0;
|
|
34
|
-
const isHeaderBlock = (block) => headerBlockTypes.includes(block.type);
|
|
33
|
+
const isHeaderBlock = (block) => context.headerBlockTypes.includes(block.type);
|
|
35
34
|
const header = blocks === null || blocks === void 0 ? void 0 : blocks.find(isHeaderBlock);
|
|
36
35
|
const restBlocks = blocks === null || blocks === void 0 ? void 0 : blocks.filter((block) => !isHeaderBlock(block));
|
|
37
36
|
const themedBackground = getThemedValue(background, theme);
|
|
@@ -44,7 +43,7 @@ export const Constructor = (props) => {
|
|
|
44
43
|
header && React.createElement(ConstructorHeader, { data: header }),
|
|
45
44
|
React.createElement(Grid, null,
|
|
46
45
|
restBlocks && (React.createElement(ConstructorRow, null,
|
|
47
|
-
React.createElement(ConstructorBlocks, { items: restBlocks
|
|
46
|
+
React.createElement(ConstructorBlocks, { items: restBlocks }))),
|
|
48
47
|
hasFootnotes && (React.createElement(ConstructorRow, null,
|
|
49
48
|
React.createElement(ConstructorFootnotes, { items: footnotes })))))))));
|
|
50
49
|
};
|
package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Block,
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Block, WithChildren } from '../../../../models';
|
|
3
3
|
interface ConstructorBlockProps {
|
|
4
4
|
data: Block;
|
|
5
|
-
Component: ReactElement;
|
|
6
|
-
shouldRenderBlock?: ShouldRenderBlock;
|
|
7
5
|
}
|
|
8
|
-
export declare const ConstructorBlock:
|
|
6
|
+
export declare const ConstructorBlock: React.FC<WithChildren<ConstructorBlockProps>>;
|
|
9
7
|
export {};
|
package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.js
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import BlockBase from '../../../../components/BlockBase/BlockBase';
|
|
3
3
|
import { block } from '../../../../utils';
|
|
4
4
|
const b = block('constructor-block');
|
|
5
|
-
export const ConstructorBlock = ({ data,
|
|
6
|
-
const { anchor, visible } = data;
|
|
7
|
-
return (React.createElement(BlockBase, { className: b({ type
|
|
5
|
+
export const ConstructorBlock = ({ data, children, }) => {
|
|
6
|
+
const { anchor, visible, type } = data;
|
|
7
|
+
return (React.createElement(BlockBase, { className: b({ type }), anchor: anchor, visible: visible, resetPaddings: data.resetPaddings }, children));
|
|
8
8
|
};
|
package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ConstructorItem as ConstructorItemType } from '../../../../models';
|
|
2
3
|
interface ConstructorBlocksProps {
|
|
3
4
|
items: ConstructorItemType[];
|
|
4
|
-
shouldRenderBlock?: ShouldRenderBlock;
|
|
5
5
|
}
|
|
6
|
-
export declare const ConstructorBlocks:
|
|
6
|
+
export declare const ConstructorBlocks: React.FC<ConstructorBlocksProps>;
|
|
7
7
|
export {};
|
package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js
CHANGED
|
@@ -5,13 +5,12 @@ import { InnerContext } from '../../../../context/innerContext';
|
|
|
5
5
|
import { ConstructorLoadable } from '../ConstructorLoadable';
|
|
6
6
|
import { ConstructorItem } from '../ConstructorItem';
|
|
7
7
|
import { ConstructorBlock } from '../ConstructorBlock/ConstructorBlock';
|
|
8
|
-
export const ConstructorBlocks = ({ items
|
|
9
|
-
const { blockTypes, loadables, itemMap } = useContext(InnerContext);
|
|
8
|
+
export const ConstructorBlocks = ({ items }) => {
|
|
9
|
+
const { blockTypes, loadables, itemMap, shouldRenderBlock } = useContext(InnerContext);
|
|
10
10
|
const renderer = (parentId = '', item, index) => {
|
|
11
11
|
if (!itemMap[item.type]) {
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
14
|
-
let children;
|
|
15
14
|
let itemElement;
|
|
16
15
|
const key = getBlockKey(item, index);
|
|
17
16
|
const blockId = parentId ? `${parentId}_${key}` : key;
|
|
@@ -27,12 +26,13 @@ export const ConstructorBlocks = ({ items, shouldRenderBlock }) => {
|
|
|
27
26
|
itemElement = (React.createElement(ConstructorLoadable, { block: item, key: blockId, blockKey: blockId, config: config, serviceId: serviceId, params: params }));
|
|
28
27
|
}
|
|
29
28
|
else {
|
|
29
|
+
let children;
|
|
30
30
|
if ('children' in item && item.children) {
|
|
31
31
|
children = item.children.map(renderer.bind(null, blockId));
|
|
32
32
|
}
|
|
33
33
|
itemElement = (React.createElement(ConstructorItem, { data: item, key: blockId, blockKey: blockId }, children));
|
|
34
34
|
}
|
|
35
|
-
return blockTypes.includes(item.type) ? (React.createElement(ConstructorBlock, { data: item, key: blockId,
|
|
35
|
+
return blockTypes.includes(item.type) ? (React.createElement(ConstructorBlock, { data: item, key: blockId }, itemElement)) : (itemElement);
|
|
36
36
|
};
|
|
37
37
|
return React.createElement(Fragment, null, items.map(renderer.bind(null, '')));
|
|
38
38
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ItemMap } from '../../containers/PageConstructor/PageConstructor';
|
|
3
|
-
import { LoadableConfig } from '../../models';
|
|
3
|
+
import { LoadableConfig, ShouldRenderBlock } from '../../models';
|
|
4
4
|
export interface InnerContextType {
|
|
5
5
|
blockTypes: string[];
|
|
6
|
+
subBlockTypes: string[];
|
|
7
|
+
headerBlockTypes: string[];
|
|
6
8
|
itemMap: ItemMap;
|
|
7
9
|
loadables?: LoadableConfig;
|
|
10
|
+
shouldRenderBlock?: ShouldRenderBlock;
|
|
8
11
|
}
|
|
9
12
|
export declare const InnerContext: React.Context<InnerContextType>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ButtonSize } from '@gravity-ui/uikit';
|
|
2
3
|
import { BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, Justify, LinkProps, LinkTheme, MediaDirection, MediaProps, MapProps, PreviewItemProps, PreviewRatioMediaContent, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleProps, LegendTableMarkerType, AnchorProps, TitleBaseProps, Animatable, BlockHeaderProps, ImageDeviceProps } from './common';
|
|
3
4
|
import { ThemeSupporting } from '../../utils';
|
|
4
5
|
import { GridColumnSize, GridColumnSizesType } from '../../grid/types';
|
|
5
|
-
import { BannerCardProps, SubBlock } from './sub-blocks';
|
|
6
|
+
import { BannerCardProps, SubBlock, SubBlockModels } from './sub-blocks';
|
|
6
7
|
export declare enum BlockType {
|
|
7
8
|
PromoFeaturesBlock = "promo-features-block",
|
|
8
9
|
ExtendedFeaturesBlock = "extended-features-block",
|
|
@@ -26,7 +27,8 @@ export declare enum BlockType {
|
|
|
26
27
|
CardLayoutBlock = "card-layout-block",
|
|
27
28
|
ContentLayoutBlock = "content-layout-block",
|
|
28
29
|
ShareBlock = "share-block",
|
|
29
|
-
MapBlock = "map-block"
|
|
30
|
+
MapBlock = "map-block",
|
|
31
|
+
FilterBlock = "filter-block"
|
|
30
32
|
}
|
|
31
33
|
export declare const BlockTypes: BlockType[];
|
|
32
34
|
export declare const HeaderBlockTypes: BlockType[];
|
|
@@ -251,6 +253,24 @@ export interface CardLayoutBlockProps extends Childable, Animatable, LoadableChi
|
|
|
251
253
|
description?: string;
|
|
252
254
|
colSizes?: GridColumnSizesType;
|
|
253
255
|
}
|
|
256
|
+
export type FilterTag = {
|
|
257
|
+
id: string;
|
|
258
|
+
label: string;
|
|
259
|
+
};
|
|
260
|
+
export type FilterItem = {
|
|
261
|
+
tags: string[];
|
|
262
|
+
card: SubBlockModels;
|
|
263
|
+
};
|
|
264
|
+
export interface FilterBlockProps extends Animatable, LoadableChildren {
|
|
265
|
+
title?: TitleProps | string;
|
|
266
|
+
description?: string;
|
|
267
|
+
tags: FilterTag[];
|
|
268
|
+
items: FilterItem[];
|
|
269
|
+
tagButtonSize?: ButtonSize;
|
|
270
|
+
allTag?: boolean | string;
|
|
271
|
+
colSizes?: GridColumnSizesType;
|
|
272
|
+
centered?: boolean;
|
|
273
|
+
}
|
|
254
274
|
export interface IconsBlockProps {
|
|
255
275
|
title?: string;
|
|
256
276
|
size?: 's' | 'm' | 'l';
|
|
@@ -350,6 +370,9 @@ export type LinkTableBlockModel = {
|
|
|
350
370
|
export type CardLayoutBlockModel = {
|
|
351
371
|
type: BlockType.CardLayoutBlock;
|
|
352
372
|
} & CardLayoutBlockProps;
|
|
373
|
+
export type FilterBlockModel = {
|
|
374
|
+
type: BlockType.FilterBlock;
|
|
375
|
+
} & FilterBlockProps;
|
|
353
376
|
export type IconsBlockModel = {
|
|
354
377
|
type: BlockType.IconsBlock;
|
|
355
378
|
} & IconsBlockProps;
|
|
@@ -362,6 +385,6 @@ export type ContentLayoutBlockModel = {
|
|
|
362
385
|
export type ShareBLockModel = {
|
|
363
386
|
type: BlockType.ShareBlock;
|
|
364
387
|
} & ShareBlockProps;
|
|
365
|
-
type BlockModels = SliderBlockModel | ServiceDemoBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | CalculatorBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | MapBlockModel | InfoBlockModel | SecurityBlockModel | TableBlockModel | TabsBlockModel | SimpleBlockModel | LinkTableBlockModel | HeaderBlockModel | PreviewBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | ShareBLockModel;
|
|
388
|
+
type BlockModels = SliderBlockModel | ServiceDemoBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | CalculatorBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | MapBlockModel | InfoBlockModel | SecurityBlockModel | TableBlockModel | TabsBlockModel | SimpleBlockModel | LinkTableBlockModel | HeaderBlockModel | PreviewBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | ShareBLockModel | FilterBlockModel;
|
|
366
389
|
export type Block = BlockModels & BlockBaseProps;
|
|
367
390
|
export {};
|
|
@@ -23,6 +23,7 @@ export var BlockType;
|
|
|
23
23
|
BlockType["ContentLayoutBlock"] = "content-layout-block";
|
|
24
24
|
BlockType["ShareBlock"] = "share-block";
|
|
25
25
|
BlockType["MapBlock"] = "map-block";
|
|
26
|
+
BlockType["FilterBlock"] = "filter-block";
|
|
26
27
|
})(BlockType || (BlockType = {}));
|
|
27
28
|
export const BlockTypes = Object.values(BlockType);
|
|
28
29
|
export const HeaderBlockTypes = [BlockType.HeaderBlock, BlockType.HeaderSliderBlock];
|
|
@@ -6,5 +6,6 @@ export declare const getCustomBlockTypes: ({ blocks, headers }?: CustomConfig) =
|
|
|
6
6
|
export declare const getCustomItems: ({ blocks, headers, subBlocks }?: CustomConfig) => {
|
|
7
7
|
[x: string]: any;
|
|
8
8
|
};
|
|
9
|
+
export declare const getCustomSubBlockTypes: (customBlocks?: CustomConfig) => string[];
|
|
9
10
|
export declare const getCustomHeaderTypes: (customBlocks?: CustomConfig) => string[];
|
|
10
11
|
export declare const getShareLink: (url: string, type: PCShareSocialNetwork, title?: string, text?: string) => string | undefined;
|
|
@@ -18,6 +18,10 @@ export const getCustomBlockTypes = ({ blocks = {}, headers = {} } = {}) => [
|
|
|
18
18
|
...Object.keys(headers),
|
|
19
19
|
];
|
|
20
20
|
export const getCustomItems = ({ blocks = {}, headers = {}, subBlocks = {} } = {}) => (Object.assign(Object.assign(Object.assign({}, blocks), headers), subBlocks));
|
|
21
|
+
export const getCustomSubBlockTypes = (customBlocks = {}) => {
|
|
22
|
+
const { subBlocks = {} } = customBlocks;
|
|
23
|
+
return Object.keys(subBlocks);
|
|
24
|
+
};
|
|
21
25
|
export const getCustomHeaderTypes = (customBlocks = {}) => {
|
|
22
26
|
const { headers = {} } = customBlocks;
|
|
23
27
|
return Object.keys(headers);
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ButtonSize } from '@gravity-ui/uikit';
|
|
2
3
|
import { BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, Justify, LinkProps, LinkTheme, MediaDirection, MediaProps, MapProps, PreviewItemProps, PreviewRatioMediaContent, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleProps, LegendTableMarkerType, AnchorProps, TitleBaseProps, Animatable, BlockHeaderProps, ImageDeviceProps } from './common';
|
|
3
4
|
import { ThemeSupporting } from '../../utils';
|
|
4
5
|
import { GridColumnSize, GridColumnSizesType } from '../../grid/types';
|
|
5
|
-
import { BannerCardProps, SubBlock } from './sub-blocks';
|
|
6
|
+
import { BannerCardProps, SubBlock, SubBlockModels } from './sub-blocks';
|
|
6
7
|
export declare enum BlockType {
|
|
7
8
|
PromoFeaturesBlock = "promo-features-block",
|
|
8
9
|
ExtendedFeaturesBlock = "extended-features-block",
|
|
@@ -26,7 +27,8 @@ export declare enum BlockType {
|
|
|
26
27
|
CardLayoutBlock = "card-layout-block",
|
|
27
28
|
ContentLayoutBlock = "content-layout-block",
|
|
28
29
|
ShareBlock = "share-block",
|
|
29
|
-
MapBlock = "map-block"
|
|
30
|
+
MapBlock = "map-block",
|
|
31
|
+
FilterBlock = "filter-block"
|
|
30
32
|
}
|
|
31
33
|
export declare const BlockTypes: BlockType[];
|
|
32
34
|
export declare const HeaderBlockTypes: BlockType[];
|
|
@@ -251,6 +253,24 @@ export interface CardLayoutBlockProps extends Childable, Animatable, LoadableChi
|
|
|
251
253
|
description?: string;
|
|
252
254
|
colSizes?: GridColumnSizesType;
|
|
253
255
|
}
|
|
256
|
+
export type FilterTag = {
|
|
257
|
+
id: string;
|
|
258
|
+
label: string;
|
|
259
|
+
};
|
|
260
|
+
export type FilterItem = {
|
|
261
|
+
tags: string[];
|
|
262
|
+
card: SubBlockModels;
|
|
263
|
+
};
|
|
264
|
+
export interface FilterBlockProps extends Animatable, LoadableChildren {
|
|
265
|
+
title?: TitleProps | string;
|
|
266
|
+
description?: string;
|
|
267
|
+
tags: FilterTag[];
|
|
268
|
+
items: FilterItem[];
|
|
269
|
+
tagButtonSize?: ButtonSize;
|
|
270
|
+
allTag?: boolean | string;
|
|
271
|
+
colSizes?: GridColumnSizesType;
|
|
272
|
+
centered?: boolean;
|
|
273
|
+
}
|
|
254
274
|
export interface IconsBlockProps {
|
|
255
275
|
title?: string;
|
|
256
276
|
size?: 's' | 'm' | 'l';
|
|
@@ -350,6 +370,9 @@ export type LinkTableBlockModel = {
|
|
|
350
370
|
export type CardLayoutBlockModel = {
|
|
351
371
|
type: BlockType.CardLayoutBlock;
|
|
352
372
|
} & CardLayoutBlockProps;
|
|
373
|
+
export type FilterBlockModel = {
|
|
374
|
+
type: BlockType.FilterBlock;
|
|
375
|
+
} & FilterBlockProps;
|
|
353
376
|
export type IconsBlockModel = {
|
|
354
377
|
type: BlockType.IconsBlock;
|
|
355
378
|
} & IconsBlockProps;
|
|
@@ -362,6 +385,6 @@ export type ContentLayoutBlockModel = {
|
|
|
362
385
|
export type ShareBLockModel = {
|
|
363
386
|
type: BlockType.ShareBlock;
|
|
364
387
|
} & ShareBlockProps;
|
|
365
|
-
type BlockModels = SliderBlockModel | ServiceDemoBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | CalculatorBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | MapBlockModel | InfoBlockModel | SecurityBlockModel | TableBlockModel | TabsBlockModel | SimpleBlockModel | LinkTableBlockModel | HeaderBlockModel | PreviewBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | ShareBLockModel;
|
|
388
|
+
type BlockModels = SliderBlockModel | ServiceDemoBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | CalculatorBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | MapBlockModel | InfoBlockModel | SecurityBlockModel | TableBlockModel | TabsBlockModel | SimpleBlockModel | LinkTableBlockModel | HeaderBlockModel | PreviewBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | ShareBLockModel | FilterBlockModel;
|
|
366
389
|
export type Block = BlockModels & BlockBaseProps;
|
|
367
390
|
export {};
|
|
@@ -26,6 +26,7 @@ var BlockType;
|
|
|
26
26
|
BlockType["ContentLayoutBlock"] = "content-layout-block";
|
|
27
27
|
BlockType["ShareBlock"] = "share-block";
|
|
28
28
|
BlockType["MapBlock"] = "map-block";
|
|
29
|
+
BlockType["FilterBlock"] = "filter-block";
|
|
29
30
|
})(BlockType = exports.BlockType || (exports.BlockType = {}));
|
|
30
31
|
exports.BlockTypes = Object.values(BlockType);
|
|
31
32
|
exports.HeaderBlockTypes = [BlockType.HeaderBlock, BlockType.HeaderSliderBlock];
|
package/server/utils/blocks.d.ts
CHANGED
|
@@ -6,5 +6,6 @@ export declare const getCustomBlockTypes: ({ blocks, headers }?: CustomConfig) =
|
|
|
6
6
|
export declare const getCustomItems: ({ blocks, headers, subBlocks }?: CustomConfig) => {
|
|
7
7
|
[x: string]: any;
|
|
8
8
|
};
|
|
9
|
+
export declare const getCustomSubBlockTypes: (customBlocks?: CustomConfig) => string[];
|
|
9
10
|
export declare const getCustomHeaderTypes: (customBlocks?: CustomConfig) => string[];
|
|
10
11
|
export declare const getShareLink: (url: string, type: PCShareSocialNetwork, title?: string, text?: string) => string | undefined;
|
package/server/utils/blocks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getShareLink = exports.getCustomHeaderTypes = exports.getCustomItems = exports.getCustomBlockTypes = exports.getBlockKey = exports.getHeaderTag = void 0;
|
|
3
|
+
exports.getShareLink = exports.getCustomHeaderTypes = exports.getCustomSubBlockTypes = exports.getCustomItems = exports.getCustomBlockTypes = exports.getBlockKey = exports.getHeaderTag = void 0;
|
|
4
4
|
const models_1 = require("../models");
|
|
5
5
|
function getHeaderTag(size) {
|
|
6
6
|
switch (size) {
|
|
@@ -25,6 +25,11 @@ const getCustomBlockTypes = ({ blocks = {}, headers = {} } = {}) => [
|
|
|
25
25
|
exports.getCustomBlockTypes = getCustomBlockTypes;
|
|
26
26
|
const getCustomItems = ({ blocks = {}, headers = {}, subBlocks = {} } = {}) => (Object.assign(Object.assign(Object.assign({}, blocks), headers), subBlocks));
|
|
27
27
|
exports.getCustomItems = getCustomItems;
|
|
28
|
+
const getCustomSubBlockTypes = (customBlocks = {}) => {
|
|
29
|
+
const { subBlocks = {} } = customBlocks;
|
|
30
|
+
return Object.keys(subBlocks);
|
|
31
|
+
};
|
|
32
|
+
exports.getCustomSubBlockTypes = getCustomSubBlockTypes;
|
|
28
33
|
const getCustomHeaderTypes = (customBlocks = {}) => {
|
|
29
34
|
const { headers = {} } = customBlocks;
|
|
30
35
|
return Object.keys(headers);
|