@gravity-ui/page-constructor 2.22.0 → 2.22.2

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.22.2](https://github.com/gravity-ui/page-constructor/compare/v2.22.1...v2.22.2) (2023-06-01)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **MediaBlock:** add border property into schema ([#371](https://github.com/gravity-ui/page-constructor/issues/371)) ([5365791](https://github.com/gravity-ui/page-constructor/commit/5365791550bdb2ed8258d9582605e620ab0e1b11))
9
+
10
+ ## [2.22.1](https://github.com/gravity-ui/page-constructor/compare/v2.22.0...v2.22.1) (2023-06-01)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * filter block nesting ([#364](https://github.com/gravity-ui/page-constructor/issues/364)) ([5b62522](https://github.com/gravity-ui/page-constructor/commit/5b62522e5e34eeacbb2fb9ec6de957bba69cd758))
16
+
3
17
  ## [2.22.0](https://github.com/gravity-ui/page-constructor/compare/v2.21.0...v2.22.0) (2023-05-31)
4
18
 
5
19
 
@@ -12,6 +12,6 @@ const DEFAULT_SIZES = {
12
12
  };
13
13
  const b = (0, utils_1.block)('card-layout-block');
14
14
  const CardLayout = ({ title, description, animated, colSizes = DEFAULT_SIZES, children, }) => (react_1.default.createElement(components_1.AnimateBlock, { className: b(), animate: animated },
15
- react_1.default.createElement(components_1.BlockHeader, { title: title, description: description }),
15
+ (title || description) && react_1.default.createElement(components_1.BlockHeader, { title: title, description: description }),
16
16
  react_1.default.createElement(grid_1.Row, null, react_1.default.Children.map(children, (child, index) => (react_1.default.createElement(grid_1.Col, { key: index, sizes: colSizes, className: b('item') }, child))))));
17
17
  exports.default = CardLayout;
@@ -1,6 +1,6 @@
1
1
  export declare const CardLayoutProps: {
2
2
  additionalProperties: boolean;
3
- required: string[];
3
+ required: never[];
4
4
  properties: {
5
5
  colSizes: {
6
6
  type: string;
@@ -76,7 +76,7 @@ export declare const CardLayoutProps: {
76
76
  export declare const CardLayoutBlock: {
77
77
  'card-layout-block': {
78
78
  additionalProperties: boolean;
79
- required: string[];
79
+ required: never[];
80
80
  properties: {
81
81
  colSizes: {
82
82
  type: string;
@@ -4,7 +4,7 @@ exports.CardLayoutBlock = exports.CardLayoutProps = void 0;
4
4
  const common_1 = require("../../schema/validators/common");
5
5
  exports.CardLayoutProps = {
6
6
  additionalProperties: false,
7
- required: ['title'],
7
+ required: [],
8
8
  properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BlockBaseProps), common_1.AnimatableProps), common_1.BlockHeaderProps), { colSizes: common_1.containerSizesObject, children: common_1.ChildrenCardsProps }),
9
9
  };
10
10
  exports.CardLayoutBlock = {
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
+ const __1 = require("..");
5
6
  const components_1 = require("../../components");
6
7
  const ButtonTabs_1 = tslib_1.__importDefault(require("../../components/ButtonTabs/ButtonTabs"));
7
- const ConstructorBlocks_1 = require("../../containers/PageConstructor/components/ConstructorBlocks");
8
+ const ConstructorItem_1 = require("../../containers/PageConstructor/components/ConstructorItem");
8
9
  const grid_1 = require("../../grid");
9
- const models_1 = require("../../models");
10
10
  const utils_1 = require("../../utils");
11
11
  const i18n_1 = tslib_1.__importDefault(require("./i18n"));
12
12
  const b = (0, utils_1.block)('filter-block');
@@ -24,25 +24,21 @@ const FilterBlock = ({ title, description, tags, tagButtonSize, allTag, items, c
24
24
  ? tabButtons[0].id
25
25
  : selectedTag;
26
26
  }, [tabButtons, selectedTag]);
27
- const container = (0, react_1.useMemo)(() => {
27
+ const cards = (0, react_1.useMemo)(() => {
28
28
  const itemsToShow = actualTag
29
29
  ? items.filter((item) => item.tags.includes(actualTag))
30
30
  : items;
31
- return [
32
- {
33
- type: models_1.BlockType.CardLayoutBlock,
34
- title: '',
35
- colSizes: colSizes,
36
- children: itemsToShow.map((item) => item.card),
37
- },
38
- ];
39
- }, [actualTag, items, colSizes]);
31
+ return itemsToShow.map((item) => item.card);
32
+ }, [actualTag, items]);
40
33
  return (react_1.default.createElement(components_1.AnimateBlock, { className: b(), animate: animated },
41
34
  title && (react_1.default.createElement(components_1.BlockHeader, { className: b('title', { centered: centered }), title: title, description: description })),
42
35
  tabButtons.length && (react_1.default.createElement(grid_1.Row, null,
43
36
  react_1.default.createElement(grid_1.Col, null,
44
37
  react_1.default.createElement(ButtonTabs_1.default, { className: b('tabs', { centered: centered }), items: tabButtons, activeTab: selectedTag, onSelectTab: setSelectedTag, tabSize: tagButtonSize })))),
45
38
  react_1.default.createElement(grid_1.Row, { className: b('block-container') },
46
- react_1.default.createElement(ConstructorBlocks_1.ConstructorBlocks, { items: container }))));
39
+ react_1.default.createElement(__1.CardLayoutBlock, { title: "", colSizes: colSizes }, cards.map((card, index) => {
40
+ const key = (0, utils_1.getBlockKey)(card, index);
41
+ return react_1.default.createElement(ConstructorItem_1.ConstructorItem, { data: card, blockKey: key, key: key });
42
+ })))));
47
43
  };
48
44
  exports.default = FilterBlock;
@@ -246,7 +246,7 @@ export interface LinkTableBlockProps extends BlockHeaderProps {
246
246
  linkTheme?: LinkTheme;
247
247
  }
248
248
  export interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {
249
- title: TitleProps | string;
249
+ title?: TitleProps | string;
250
250
  description?: string;
251
251
  colSizes?: GridColumnSizesType;
252
252
  }
@@ -140,6 +140,10 @@ export declare const MediaCardBlock: {
140
140
  fullscreen: {
141
141
  type: string;
142
142
  };
143
+ border: {
144
+ type: string;
145
+ enum: string[];
146
+ };
143
147
  type: {};
144
148
  when: {};
145
149
  };
@@ -6,6 +6,6 @@ exports.MediaCardBlock = {
6
6
  'media-card': {
7
7
  additionalProperties: false,
8
8
  required: [],
9
- properties: Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), common_1.MediaProps), common_1.AnimatableProps),
9
+ properties: Object.assign(Object.assign(Object.assign(Object.assign({}, common_1.BaseProps), common_1.CardBase), common_1.MediaProps), common_1.AnimatableProps),
10
10
  },
11
11
  };
@@ -10,6 +10,6 @@ const DEFAULT_SIZES = {
10
10
  };
11
11
  const b = block('card-layout-block');
12
12
  const CardLayout = ({ title, description, animated, colSizes = DEFAULT_SIZES, children, }) => (React.createElement(AnimateBlock, { className: b(), animate: animated },
13
- React.createElement(BlockHeader, { title: title, description: description }),
13
+ (title || description) && React.createElement(BlockHeader, { title: title, description: description }),
14
14
  React.createElement(Row, null, React.Children.map(children, (child, index) => (React.createElement(Col, { key: index, sizes: colSizes, className: b('item') }, child))))));
15
15
  export default CardLayout;
@@ -1,6 +1,6 @@
1
1
  export declare const CardLayoutProps: {
2
2
  additionalProperties: boolean;
3
- required: string[];
3
+ required: never[];
4
4
  properties: {
5
5
  colSizes: {
6
6
  type: string;
@@ -76,7 +76,7 @@ export declare const CardLayoutProps: {
76
76
  export declare const CardLayoutBlock: {
77
77
  'card-layout-block': {
78
78
  additionalProperties: boolean;
79
- required: string[];
79
+ required: never[];
80
80
  properties: {
81
81
  colSizes: {
82
82
  type: string;
@@ -1,7 +1,7 @@
1
1
  import { AnimatableProps, BlockBaseProps, BlockHeaderProps, ChildrenCardsProps, containerSizesObject, } from '../../schema/validators/common';
2
2
  export const CardLayoutProps = {
3
3
  additionalProperties: false,
4
- required: ['title'],
4
+ required: [],
5
5
  properties: Object.assign(Object.assign(Object.assign(Object.assign({}, BlockBaseProps), AnimatableProps), BlockHeaderProps), { colSizes: containerSizesObject, children: ChildrenCardsProps }),
6
6
  };
7
7
  export const CardLayoutBlock = {
@@ -1,10 +1,10 @@
1
1
  import React, { useMemo, useState } from 'react';
2
+ import { CardLayoutBlock } from '..';
2
3
  import { AnimateBlock, BlockHeader } from '../../components';
3
4
  import ButtonTabs from '../../components/ButtonTabs/ButtonTabs';
4
- import { ConstructorBlocks } from '../../containers/PageConstructor/components/ConstructorBlocks';
5
+ import { ConstructorItem } from '../../containers/PageConstructor/components/ConstructorItem';
5
6
  import { Col, Row } from '../../grid';
6
- import { BlockType } from '../../models';
7
- import { block } from '../../utils';
7
+ import { block, getBlockKey } from '../../utils';
8
8
  import i18n from './i18n';
9
9
  import './FilterBlock.css';
10
10
  const b = block('filter-block');
@@ -22,25 +22,21 @@ const FilterBlock = ({ title, description, tags, tagButtonSize, allTag, items, c
22
22
  ? tabButtons[0].id
23
23
  : selectedTag;
24
24
  }, [tabButtons, selectedTag]);
25
- const container = useMemo(() => {
25
+ const cards = useMemo(() => {
26
26
  const itemsToShow = actualTag
27
27
  ? items.filter((item) => item.tags.includes(actualTag))
28
28
  : items;
29
- return [
30
- {
31
- type: BlockType.CardLayoutBlock,
32
- title: '',
33
- colSizes: colSizes,
34
- children: itemsToShow.map((item) => item.card),
35
- },
36
- ];
37
- }, [actualTag, items, colSizes]);
29
+ return itemsToShow.map((item) => item.card);
30
+ }, [actualTag, items]);
38
31
  return (React.createElement(AnimateBlock, { className: b(), animate: animated },
39
32
  title && (React.createElement(BlockHeader, { className: b('title', { centered: centered }), title: title, description: description })),
40
33
  tabButtons.length && (React.createElement(Row, null,
41
34
  React.createElement(Col, null,
42
35
  React.createElement(ButtonTabs, { className: b('tabs', { centered: centered }), items: tabButtons, activeTab: selectedTag, onSelectTab: setSelectedTag, tabSize: tagButtonSize })))),
43
36
  React.createElement(Row, { className: b('block-container') },
44
- React.createElement(ConstructorBlocks, { items: container }))));
37
+ React.createElement(CardLayoutBlock, { title: "", colSizes: colSizes }, cards.map((card, index) => {
38
+ const key = getBlockKey(card, index);
39
+ return React.createElement(ConstructorItem, { data: card, blockKey: key, key: key });
40
+ })))));
45
41
  };
46
42
  export default FilterBlock;
@@ -246,7 +246,7 @@ export interface LinkTableBlockProps extends BlockHeaderProps {
246
246
  linkTheme?: LinkTheme;
247
247
  }
248
248
  export interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {
249
- title: TitleProps | string;
249
+ title?: TitleProps | string;
250
250
  description?: string;
251
251
  colSizes?: GridColumnSizesType;
252
252
  }
@@ -140,6 +140,10 @@ export declare const MediaCardBlock: {
140
140
  fullscreen: {
141
141
  type: string;
142
142
  };
143
+ border: {
144
+ type: string;
145
+ enum: string[];
146
+ };
143
147
  type: {};
144
148
  when: {};
145
149
  };
@@ -1,8 +1,8 @@
1
- import { AnimatableProps, BaseProps, MediaProps } from '../../schema/validators/common';
1
+ import { AnimatableProps, BaseProps, CardBase, MediaProps } from '../../schema/validators/common';
2
2
  export const MediaCardBlock = {
3
3
  'media-card': {
4
4
  additionalProperties: false,
5
5
  required: [],
6
- properties: Object.assign(Object.assign(Object.assign({}, BaseProps), MediaProps), AnimatableProps),
6
+ properties: Object.assign(Object.assign(Object.assign(Object.assign({}, BaseProps), CardBase), MediaProps), AnimatableProps),
7
7
  },
8
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "2.22.0",
3
+ "version": "2.22.2",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -246,7 +246,7 @@ export interface LinkTableBlockProps extends BlockHeaderProps {
246
246
  linkTheme?: LinkTheme;
247
247
  }
248
248
  export interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {
249
- title: TitleProps | string;
249
+ title?: TitleProps | string;
250
250
  description?: string;
251
251
  colSizes?: GridColumnSizesType;
252
252
  }