@gravity-ui/page-constructor 3.8.1 → 3.8.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/build/cjs/blocks/ContentLayout/schema.d.ts +2 -6
  3. package/build/cjs/blocks/Slider/utils.d.ts +2 -2
  4. package/build/cjs/blocks/Slider/utils.js +3 -1
  5. package/build/cjs/components/Image/schema.d.ts +1 -1
  6. package/build/cjs/components/Image/schema.js +7 -7
  7. package/build/cjs/editor/containers/Form/Form.js +2 -2
  8. package/build/cjs/editor/dynamic-forms-custom/parser/index.js +2 -3
  9. package/build/cjs/editor/dynamic-forms-custom/parser/types.d.ts +1 -2
  10. package/build/cjs/editor/store/utils.js +3 -1
  11. package/build/cjs/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.js +2 -3
  12. package/build/cjs/navigation/schema.js +1 -1
  13. package/build/cjs/schema/constants.d.ts +0 -1
  14. package/build/cjs/schema/validators/common.js +1 -1
  15. package/build/cjs/sub-blocks/Quote/schema.d.ts +0 -1
  16. package/build/cjs/sub-blocks/Quote/schema.js +1 -2
  17. package/build/esm/blocks/ContentLayout/schema.d.ts +2 -6
  18. package/build/esm/blocks/Slider/utils.d.ts +2 -2
  19. package/build/esm/blocks/Slider/utils.js +2 -1
  20. package/build/esm/components/Image/schema.d.ts +1 -1
  21. package/build/esm/components/Image/schema.js +6 -6
  22. package/build/esm/editor/containers/Form/Form.js +2 -2
  23. package/build/esm/editor/dynamic-forms-custom/parser/index.js +2 -3
  24. package/build/esm/editor/dynamic-forms-custom/parser/types.d.ts +1 -2
  25. package/build/esm/editor/store/utils.js +2 -1
  26. package/build/esm/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.js +2 -4
  27. package/build/esm/navigation/schema.js +2 -2
  28. package/build/esm/schema/constants.d.ts +0 -1
  29. package/build/esm/schema/validators/common.js +2 -2
  30. package/build/esm/sub-blocks/Quote/schema.d.ts +0 -1
  31. package/build/esm/sub-blocks/Quote/schema.js +2 -3
  32. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.8.2](https://github.com/gravity-ui/page-constructor/compare/v3.8.1...v3.8.2) (2023-06-23)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * quote validation ([#402](https://github.com/gravity-ui/page-constructor/issues/402)) ([3920561](https://github.com/gravity-ui/page-constructor/commit/3920561ebe0bac727826caf690d06d74d7affaef))
9
+
3
10
  ## [3.8.1](https://github.com/gravity-ui/page-constructor/compare/v3.8.0...v3.8.1) (2023-06-22)
4
11
 
5
12
 
@@ -12,9 +12,7 @@ export declare const ContentLayoutBlock: {
12
12
  required: string[];
13
13
  properties: {
14
14
  src: {
15
- type: string; /**
16
- * @deprecated Use params on top level instead
17
- */
15
+ type: string;
18
16
  pattern: string;
19
17
  };
20
18
  alt: {
@@ -143,9 +141,7 @@ export declare const ContentLayoutBlock: {
143
141
  required: string[];
144
142
  properties: {
145
143
  src: {
146
- type: string; /**
147
- * @deprecated Use params on top level instead
148
- */
144
+ type: string;
149
145
  pattern: string;
150
146
  };
151
147
  alt: {
@@ -12,9 +12,9 @@ export interface GetSlidesToShowParams {
12
12
  }
13
13
  export declare function getSlidesToShowWithDefaults({ contentLength, breakpoints, mobileFullscreen, }: GetSlidesToShowParams): {
14
14
  sm: number;
15
- md: number;
16
- lg: number;
17
15
  xl: number;
16
+ lg: number;
17
+ md: number;
18
18
  };
19
19
  export declare function getSliderResponsiveParams(breakpoints: SliderBreakpointParams): {
20
20
  breakpoint: number;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSlidesToShowCount = exports.getSlidesCountByBreakpoint = exports.getSliderResponsiveParams = exports.getSlidesToShowWithDefaults = exports.DEFAULT_SLIDE_BREAKPOINTS = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const lodash_1 = tslib_1.__importDefault(require("lodash"));
4
6
  const constants_1 = require("../../constants");
5
7
  const models_1 = require("./models");
6
8
  exports.DEFAULT_SLIDE_BREAKPOINTS = {
@@ -18,7 +20,7 @@ function getSlidesToShowWithDefaults({ contentLength, breakpoints, mobileFullscr
18
20
  else {
19
21
  result = breakpoints || exports.DEFAULT_SLIDE_BREAKPOINTS;
20
22
  }
21
- return Object.assign(Object.assign(Object.assign({}, exports.DEFAULT_SLIDE_BREAKPOINTS), result), { sm: !mobileFullscreen && contentLength > 1 ? exports.DEFAULT_SLIDE_BREAKPOINTS.sm : 1 });
23
+ return Object.assign(Object.assign(Object.assign({}, exports.DEFAULT_SLIDE_BREAKPOINTS), lodash_1.default.pickBy(result, (value) => !isNaN(value))), { sm: !mobileFullscreen && contentLength > 1 ? exports.DEFAULT_SLIDE_BREAKPOINTS.sm : 1 });
22
24
  }
23
25
  exports.getSlidesToShowWithDefaults = getSlidesToShowWithDefaults;
24
26
  function getSliderResponsiveParams(breakpoints) {
@@ -1,4 +1,4 @@
1
- export declare const urlPattern = "^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?(#[\\w\\-]+)?$";
1
+ export declare const imageUrlPattern = "^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?(#[\\w\\-]+)?$";
2
2
  export declare const ImageDeviceProps: {
3
3
  type: string;
4
4
  additionalProperties: boolean;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ImageProps = exports.ImageObjectProps = exports.ImageDeviceProps = exports.urlPattern = void 0;
3
+ exports.ImageProps = exports.ImageObjectProps = exports.ImageDeviceProps = exports.imageUrlPattern = void 0;
4
4
  const utils_1 = require("../../schema/validators/utils");
5
- exports.urlPattern = '^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?(#[\\w\\-]+)?$';
5
+ exports.imageUrlPattern = '^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?(#[\\w\\-]+)?$';
6
6
  const ImageBase = {
7
7
  alt: {
8
8
  type: 'string',
@@ -16,12 +16,12 @@ exports.ImageDeviceProps = {
16
16
  type: 'object',
17
17
  additionalProperties: false,
18
18
  required: ['desktop', 'mobile'],
19
- properties: Object.assign(Object.assign({}, ImageBase), { desktop: { type: 'string', pattern: exports.urlPattern }, tablet: {
19
+ properties: Object.assign(Object.assign({}, ImageBase), { desktop: { type: 'string', pattern: exports.imageUrlPattern }, tablet: {
20
20
  type: 'string',
21
- pattern: exports.urlPattern,
21
+ pattern: exports.imageUrlPattern,
22
22
  }, mobile: {
23
23
  type: 'string',
24
- pattern: exports.urlPattern,
24
+ pattern: exports.imageUrlPattern,
25
25
  } }),
26
26
  };
27
27
  exports.ImageObjectProps = {
@@ -30,14 +30,14 @@ exports.ImageObjectProps = {
30
30
  required: ['src'],
31
31
  properties: Object.assign(Object.assign({}, ImageBase), { src: {
32
32
  type: 'string',
33
- pattern: exports.urlPattern,
33
+ pattern: exports.imageUrlPattern,
34
34
  } }),
35
35
  };
36
36
  exports.ImageProps = {
37
37
  oneOf: [
38
38
  {
39
39
  type: 'string',
40
- pattern: exports.urlPattern,
40
+ pattern: exports.imageUrlPattern,
41
41
  optionName: 'url',
42
42
  },
43
43
  (0, utils_1.filteredItem)(Object.assign(Object.assign({}, exports.ImageObjectProps), { optionName: 'options' })),
@@ -30,13 +30,13 @@ exports.Form = (0, react_1.memo)(({ content, onChange, activeBlockIndex, onSelec
30
30
  break;
31
31
  }
32
32
  case FormTab.Blocks: {
33
- form = (react_1.default.createElement(react_1.Fragment, null, blocks.map((blockData, index) => (react_1.default.createElement(BlockForm_1.BlockForm, { spec: blocksSpec[blockData.type], key: (0, utils_1.getBlockKey)(blockData, index), data: blockData, active: activeBlockIndex === index, onChange: (data) => {
33
+ form = (react_1.default.createElement(react_1.Fragment, null, blocks.map((blockData, index) => blocksSpec[blockData.type] ? (react_1.default.createElement(BlockForm_1.BlockForm, { spec: blocksSpec[blockData.type], key: (0, utils_1.getBlockKey)(blockData, index), data: blockData, active: activeBlockIndex === index, onChange: (data) => {
34
34
  onChange(Object.assign(Object.assign({}, content), { blocks: [
35
35
  ...blocks.slice(0, index),
36
36
  data,
37
37
  ...blocks.slice(index + 1),
38
38
  ] }));
39
- }, onSelect: () => onSelect(index) })))));
39
+ }, onSelect: () => onSelect(index) })) : null)));
40
40
  break;
41
41
  }
42
42
  }
@@ -4,7 +4,6 @@ const tslib_1 = require("tslib");
4
4
  /* eslint-disable no-param-reassign */
5
5
  /* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
6
6
  const dynamic_forms_1 = require("@gravity-ui/dynamic-forms");
7
- const models_1 = require("../../../models");
8
7
  const detect_1 = require("./detect");
9
8
  const views_1 = require("./views");
10
9
  class FormSpecParser {
@@ -140,10 +139,10 @@ class FormSpecParser {
140
139
  }
141
140
  getBlocksSpec() {
142
141
  const blocks = this.definitions.children;
143
- return Object.values(models_1.BlockType).reduce((result, blockName) => {
142
+ return Object.entries(blocks).reduce((result, [blockName, blockData]) => {
144
143
  result[blockName] = this.parseSchemaProperty({
145
144
  name: blockName,
146
- data: Object.assign({}, blocks[blockName]),
145
+ data: Object.assign({}, blockData),
147
146
  required: true,
148
147
  });
149
148
  return result;
@@ -1,5 +1,4 @@
1
1
  import { Spec as DynamicFormSpec, ObjectSpec } from '@gravity-ui/dynamic-forms';
2
- import { BlockType } from '../../../models';
3
2
  import { Schema } from '../../../schema';
4
3
  export type OneOfSpec = {
5
4
  oneOf: DynamicFormSpec[];
@@ -15,7 +14,7 @@ export interface SpecCustomProps {
15
14
  }
16
15
  export type Spec = Exclude<DynamicFormSpec, 'ObjectSpec'> | CustomObjectSpec | OneOfSpec;
17
16
  export type CustomSpec = Spec & SpecCustomProps;
18
- export type BlocksSpec = Record<BlockType, CustomSpec>;
17
+ export type BlocksSpec = Record<string, CustomSpec>;
19
18
  export type PageSpec = CustomSpec;
20
19
  export interface FormSpecs {
21
20
  blocks: BlocksSpec;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getErrorBoundaryState = exports.addEditorProps = exports.addBlock = exports.getNewBlockIndex = exports.duplicateBlock = exports.changeBlocksOrder = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const lodash_1 = tslib_1.__importDefault(require("lodash"));
4
6
  const changeBlocksOrder = (array, oldIndex, newIndex) => {
5
7
  const result = [...array];
6
8
  const element = result.splice(oldIndex, 1)[0];
@@ -10,7 +12,7 @@ const changeBlocksOrder = (array, oldIndex, newIndex) => {
10
12
  exports.changeBlocksOrder = changeBlocksOrder;
11
13
  const duplicateBlock = (array, index) => {
12
14
  const result = [...array];
13
- result.splice(index + 1, 0, result[index]);
15
+ result.splice(index + 1, 0, lodash_1.default.cloneDeep(result[index]));
14
16
  return result;
15
17
  };
16
18
  exports.duplicateBlock = duplicateBlock;
@@ -9,10 +9,9 @@ const utils_2 = require("../../../../../utils");
9
9
  const ContentWrapper_1 = require("../ContentWrapper/ContentWrapper");
10
10
  const b = (0, utils_2.block)('navigation-dropdown');
11
11
  const TOGGLE_ARROW_SIZE = 12;
12
- exports.NavigationDropdown = react_1.default.forwardRef((_a, ref) => {
13
- var { text, icon, isOpened, className, iconSize, type: _ } = _a, props = tslib_1.__rest(_a, ["text", "icon", "isOpened", "className", "iconSize", "type"]);
12
+ exports.NavigationDropdown = react_1.default.forwardRef(({ text, icon, isOpened, className, iconSize, onClick }, ref) => {
14
13
  const iconData = icon && (0, utils_1.getMediaImage)(icon);
15
- return (react_1.default.createElement("span", Object.assign({ ref: ref }, props, { className: b(null, className) }),
14
+ return (react_1.default.createElement("span", { ref: ref, onClick: onClick, className: b(null, className) },
16
15
  react_1.default.createElement(ContentWrapper_1.ContentWrapper, { text: text, icon: iconData, iconSize: iconSize }),
17
16
  react_1.default.createElement(components_1.ToggleArrow, { className: b('arrow'), size: TOGGLE_ARROW_SIZE, type: 'vertical', iconType: "navigation", open: isOpened })));
18
17
  });
@@ -34,7 +34,7 @@ const NavigationItemBaseProps = {
34
34
  },
35
35
  icon: {
36
36
  type: 'string',
37
- pattern: schema_1.urlPattern,
37
+ pattern: schema_1.imageUrlPattern,
38
38
  },
39
39
  iconSize: {
40
40
  type: 'number',
@@ -135,7 +135,6 @@ export declare const cardSchemas: {
135
135
  };
136
136
  url: {
137
137
  type: string;
138
- pattern: string;
139
138
  };
140
139
  buttonText: {
141
140
  type: string;
@@ -240,7 +240,7 @@ exports.authorItem = {
240
240
  },
241
241
  avatar: {
242
242
  type: 'string',
243
- pattern: schema_1.urlPattern,
243
+ pattern: schema_1.imageUrlPattern,
244
244
  },
245
245
  description: {
246
246
  type: 'string',
@@ -40,7 +40,6 @@ export declare const Quote: {
40
40
  };
41
41
  url: {
42
42
  type: string;
43
- pattern: string;
44
43
  };
45
44
  buttonText: {
46
45
  type: string;
@@ -12,12 +12,11 @@ exports.Quote = {
12
12
  contentType: 'text',
13
13
  }, image: (0, common_1.withTheme)(schema_1.ImageProps), logo: {
14
14
  type: 'string',
15
- pattern: schema_1.urlPattern,
15
+ pattern: schema_1.imageUrlPattern,
16
16
  }, color: {
17
17
  type: 'string',
18
18
  }, url: {
19
19
  type: 'string',
20
- pattern: schema_1.urlPattern,
21
20
  }, buttonText: {
22
21
  type: 'string',
23
22
  }, theme: common_1.ThemeProps, author: common_1.authorItem }),
@@ -12,9 +12,7 @@ export declare const ContentLayoutBlock: {
12
12
  required: string[];
13
13
  properties: {
14
14
  src: {
15
- type: string; /**
16
- * @deprecated Use params on top level instead
17
- */
15
+ type: string;
18
16
  pattern: string;
19
17
  };
20
18
  alt: {
@@ -143,9 +141,7 @@ export declare const ContentLayoutBlock: {
143
141
  required: string[];
144
142
  properties: {
145
143
  src: {
146
- type: string; /**
147
- * @deprecated Use params on top level instead
148
- */
144
+ type: string;
149
145
  pattern: string;
150
146
  };
151
147
  alt: {
@@ -12,9 +12,9 @@ export interface GetSlidesToShowParams {
12
12
  }
13
13
  export declare function getSlidesToShowWithDefaults({ contentLength, breakpoints, mobileFullscreen, }: GetSlidesToShowParams): {
14
14
  sm: number;
15
- md: number;
16
- lg: number;
17
15
  xl: number;
16
+ lg: number;
17
+ md: number;
18
18
  };
19
19
  export declare function getSliderResponsiveParams(breakpoints: SliderBreakpointParams): {
20
20
  breakpoint: number;
@@ -1,3 +1,4 @@
1
+ import _ from 'lodash';
1
2
  import { BREAKPOINTS } from '../../constants';
2
3
  import { SliderBreakpointNames } from './models';
3
4
  export const DEFAULT_SLIDE_BREAKPOINTS = {
@@ -15,7 +16,7 @@ export function getSlidesToShowWithDefaults({ contentLength, breakpoints, mobile
15
16
  else {
16
17
  result = breakpoints || DEFAULT_SLIDE_BREAKPOINTS;
17
18
  }
18
- return Object.assign(Object.assign(Object.assign({}, DEFAULT_SLIDE_BREAKPOINTS), result), { sm: !mobileFullscreen && contentLength > 1 ? DEFAULT_SLIDE_BREAKPOINTS.sm : 1 });
19
+ return Object.assign(Object.assign(Object.assign({}, DEFAULT_SLIDE_BREAKPOINTS), _.pickBy(result, (value) => !isNaN(value))), { sm: !mobileFullscreen && contentLength > 1 ? DEFAULT_SLIDE_BREAKPOINTS.sm : 1 });
19
20
  }
20
21
  export function getSliderResponsiveParams(breakpoints) {
21
22
  return Object.entries(breakpoints).map(([breakpointName, slidesToShow]) => ({
@@ -1,4 +1,4 @@
1
- export declare const urlPattern = "^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?(#[\\w\\-]+)?$";
1
+ export declare const imageUrlPattern = "^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?(#[\\w\\-]+)?$";
2
2
  export declare const ImageDeviceProps: {
3
3
  type: string;
4
4
  additionalProperties: boolean;
@@ -1,5 +1,5 @@
1
1
  import { filteredItem } from '../../schema/validators/utils';
2
- export const urlPattern = '^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?(#[\\w\\-]+)?$';
2
+ export const imageUrlPattern = '^((http[s]?|ftp):\\/)?\\/?([^:\\/\\s]+)((\\/\\w+)*\\/)([\\w\\-\\.]+[^#?\\s]+)(.*)?(#[\\w\\-]+)?$';
3
3
  const ImageBase = {
4
4
  alt: {
5
5
  type: 'string',
@@ -13,12 +13,12 @@ export const ImageDeviceProps = {
13
13
  type: 'object',
14
14
  additionalProperties: false,
15
15
  required: ['desktop', 'mobile'],
16
- properties: Object.assign(Object.assign({}, ImageBase), { desktop: { type: 'string', pattern: urlPattern }, tablet: {
16
+ properties: Object.assign(Object.assign({}, ImageBase), { desktop: { type: 'string', pattern: imageUrlPattern }, tablet: {
17
17
  type: 'string',
18
- pattern: urlPattern,
18
+ pattern: imageUrlPattern,
19
19
  }, mobile: {
20
20
  type: 'string',
21
- pattern: urlPattern,
21
+ pattern: imageUrlPattern,
22
22
  } }),
23
23
  };
24
24
  export const ImageObjectProps = {
@@ -27,14 +27,14 @@ export const ImageObjectProps = {
27
27
  required: ['src'],
28
28
  properties: Object.assign(Object.assign({}, ImageBase), { src: {
29
29
  type: 'string',
30
- pattern: urlPattern,
30
+ pattern: imageUrlPattern,
31
31
  } }),
32
32
  };
33
33
  export const ImageProps = {
34
34
  oneOf: [
35
35
  {
36
36
  type: 'string',
37
- pattern: urlPattern,
37
+ pattern: imageUrlPattern,
38
38
  optionName: 'url',
39
39
  },
40
40
  filteredItem(Object.assign(Object.assign({}, ImageObjectProps), { optionName: 'options' })),
@@ -28,13 +28,13 @@ export const Form = memo(({ content, onChange, activeBlockIndex, onSelect, spec
28
28
  break;
29
29
  }
30
30
  case FormTab.Blocks: {
31
- form = (React.createElement(Fragment, null, blocks.map((blockData, index) => (React.createElement(BlockForm, { spec: blocksSpec[blockData.type], key: getBlockKey(blockData, index), data: blockData, active: activeBlockIndex === index, onChange: (data) => {
31
+ form = (React.createElement(Fragment, null, blocks.map((blockData, index) => blocksSpec[blockData.type] ? (React.createElement(BlockForm, { spec: blocksSpec[blockData.type], key: getBlockKey(blockData, index), data: blockData, active: activeBlockIndex === index, onChange: (data) => {
32
32
  onChange(Object.assign(Object.assign({}, content), { blocks: [
33
33
  ...blocks.slice(0, index),
34
34
  data,
35
35
  ...blocks.slice(index + 1),
36
36
  ] }));
37
- }, onSelect: () => onSelect(index) })))));
37
+ }, onSelect: () => onSelect(index) })) : null)));
38
38
  break;
39
39
  }
40
40
  }
@@ -2,7 +2,6 @@ import { __rest } from "tslib";
2
2
  /* eslint-disable no-param-reassign */
3
3
  /* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
4
4
  import { SpecTypes } from '@gravity-ui/dynamic-forms';
5
- import { BlockType } from '../../../models';
6
5
  import { ParserType, detectParserType } from './detect';
7
6
  import { getArrayViewSpec, getObjectViewSpec, getOneOfViewSpec, getPrimitiveViewSpec } from './views';
8
7
  class FormSpecParser {
@@ -138,10 +137,10 @@ class FormSpecParser {
138
137
  }
139
138
  getBlocksSpec() {
140
139
  const blocks = this.definitions.children;
141
- return Object.values(BlockType).reduce((result, blockName) => {
140
+ return Object.entries(blocks).reduce((result, [blockName, blockData]) => {
142
141
  result[blockName] = this.parseSchemaProperty({
143
142
  name: blockName,
144
- data: Object.assign({}, blocks[blockName]),
143
+ data: Object.assign({}, blockData),
145
144
  required: true,
146
145
  });
147
146
  return result;
@@ -1,5 +1,4 @@
1
1
  import { Spec as DynamicFormSpec, ObjectSpec } from '@gravity-ui/dynamic-forms';
2
- import { BlockType } from '../../../models';
3
2
  import { Schema } from '../../../schema';
4
3
  export type OneOfSpec = {
5
4
  oneOf: DynamicFormSpec[];
@@ -15,7 +14,7 @@ export interface SpecCustomProps {
15
14
  }
16
15
  export type Spec = Exclude<DynamicFormSpec, 'ObjectSpec'> | CustomObjectSpec | OneOfSpec;
17
16
  export type CustomSpec = Spec & SpecCustomProps;
18
- export type BlocksSpec = Record<BlockType, CustomSpec>;
17
+ export type BlocksSpec = Record<string, CustomSpec>;
19
18
  export type PageSpec = CustomSpec;
20
19
  export interface FormSpecs {
21
20
  blocks: BlocksSpec;
@@ -1,3 +1,4 @@
1
+ import _ from 'lodash';
1
2
  export const changeBlocksOrder = (array, oldIndex, newIndex) => {
2
3
  const result = [...array];
3
4
  const element = result.splice(oldIndex, 1)[0];
@@ -6,7 +7,7 @@ export const changeBlocksOrder = (array, oldIndex, newIndex) => {
6
7
  };
7
8
  export const duplicateBlock = (array, index) => {
8
9
  const result = [...array];
9
- result.splice(index + 1, 0, result[index]);
10
+ result.splice(index + 1, 0, _.cloneDeep(result[index]));
10
11
  return result;
11
12
  };
12
13
  export const getNewBlockIndex = (id, orderedBlocksCount) => {
@@ -1,4 +1,3 @@
1
- import { __rest } from "tslib";
2
1
  import React from 'react';
3
2
  import { ToggleArrow } from '../../../../../components';
4
3
  import { getMediaImage } from '../../../../../components/Media/Image/utils';
@@ -7,10 +6,9 @@ import { ContentWrapper } from '../ContentWrapper/ContentWrapper';
7
6
  import './NavigationDropdown.css';
8
7
  const b = block('navigation-dropdown');
9
8
  const TOGGLE_ARROW_SIZE = 12;
10
- export const NavigationDropdown = React.forwardRef((_a, ref) => {
11
- var { text, icon, isOpened, className, iconSize, type: _ } = _a, props = __rest(_a, ["text", "icon", "isOpened", "className", "iconSize", "type"]);
9
+ export const NavigationDropdown = React.forwardRef(({ text, icon, isOpened, className, iconSize, onClick }, ref) => {
12
10
  const iconData = icon && getMediaImage(icon);
13
- return (React.createElement("span", Object.assign({ ref: ref }, props, { className: b(null, className) }),
11
+ return (React.createElement("span", { ref: ref, onClick: onClick, className: b(null, className) },
14
12
  React.createElement(ContentWrapper, { text: text, icon: iconData, iconSize: iconSize }),
15
13
  React.createElement(ToggleArrow, { className: b('arrow'), size: TOGGLE_ARROW_SIZE, type: 'vertical', iconType: "navigation", open: isOpened })));
16
14
  });
@@ -1,5 +1,5 @@
1
1
  import { omit } from 'lodash';
2
- import { ImageProps, urlPattern } from '../components/Image/schema';
2
+ import { ImageProps, imageUrlPattern } from '../components/Image/schema';
3
3
  import { ButtonProps } from '../schema/validators/common';
4
4
  import { filteredArray } from '../schema/validators/utils';
5
5
  const NavigationItemType = {
@@ -31,7 +31,7 @@ const NavigationItemBaseProps = {
31
31
  },
32
32
  icon: {
33
33
  type: 'string',
34
- pattern: urlPattern,
34
+ pattern: imageUrlPattern,
35
35
  },
36
36
  iconSize: {
37
37
  type: 'number',
@@ -135,7 +135,6 @@ export declare const cardSchemas: {
135
135
  };
136
136
  url: {
137
137
  type: string;
138
- pattern: string;
139
138
  };
140
139
  buttonText: {
141
140
  type: string;
@@ -1,4 +1,4 @@
1
- import { ImageProps, urlPattern } from '../../components/Image/schema';
1
+ import { ImageProps, imageUrlPattern } from '../../components/Image/schema';
2
2
  import { Theme } from '../../models';
3
3
  import { AnalyticsEventSchema } from './event';
4
4
  import { pixelEvents } from './pixel';
@@ -237,7 +237,7 @@ export const authorItem = {
237
237
  },
238
238
  avatar: {
239
239
  type: 'string',
240
- pattern: urlPattern,
240
+ pattern: imageUrlPattern,
241
241
  },
242
242
  description: {
243
243
  type: 'string',
@@ -40,7 +40,6 @@ export declare const Quote: {
40
40
  };
41
41
  url: {
42
42
  type: string;
43
- pattern: string;
44
43
  };
45
44
  buttonText: {
46
45
  type: string;
@@ -1,4 +1,4 @@
1
- import { ImageProps, urlPattern } from '../../components/Image/schema';
1
+ import { ImageProps, imageUrlPattern } from '../../components/Image/schema';
2
2
  import { BaseProps, ThemeProps, authorItem, withTheme } from '../../schema/validators/common';
3
3
  export const Quote = {
4
4
  quote: {
@@ -9,12 +9,11 @@ export const Quote = {
9
9
  contentType: 'text',
10
10
  }, image: withTheme(ImageProps), logo: {
11
11
  type: 'string',
12
- pattern: urlPattern,
12
+ pattern: imageUrlPattern,
13
13
  }, color: {
14
14
  type: 'string',
15
15
  }, url: {
16
16
  type: 'string',
17
- pattern: urlPattern,
18
17
  }, buttonText: {
19
18
  type: 'string',
20
19
  }, theme: ThemeProps, author: authorItem }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "3.8.1",
3
+ "version": "3.8.2",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {