@gravity-ui/page-constructor 3.15.0 → 3.17.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.
Files changed (56) hide show
  1. package/build/cjs/blocks/ContentLayout/ContentLayout.css +0 -3
  2. package/build/cjs/blocks/ContentLayout/schema.d.ts +16 -7
  3. package/build/cjs/blocks/Info/schema.d.ts +22 -0
  4. package/build/cjs/blocks/Map/schema.d.ts +11 -0
  5. package/build/cjs/blocks/Media/schema.d.ts +22 -0
  6. package/build/cjs/blocks/Questions/schema.d.ts +11 -0
  7. package/build/cjs/blocks/Tabs/schema.d.ts +11 -0
  8. package/build/cjs/components/MediaBase/MediaBaseContent.js +2 -2
  9. package/build/cjs/models/constructor-items/blocks.d.ts +8 -5
  10. package/build/cjs/models/constructor-items/sub-blocks.d.ts +5 -0
  11. package/build/cjs/models/constructor-items/sub-blocks.js +6 -1
  12. package/build/cjs/schema/constants.d.ts +26 -0
  13. package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +11 -0
  14. package/build/cjs/sub-blocks/BasicCard/BasicCard.css +15 -0
  15. package/build/cjs/sub-blocks/BasicCard/BasicCard.js +5 -3
  16. package/build/cjs/sub-blocks/BasicCard/schema.d.ts +15 -0
  17. package/build/cjs/sub-blocks/BasicCard/schema.js +3 -0
  18. package/build/cjs/sub-blocks/Content/Content.js +3 -1
  19. package/build/cjs/sub-blocks/Content/ContentList/ContentList.css +48 -0
  20. package/build/cjs/sub-blocks/Content/ContentList/ContentList.d.ts +7 -0
  21. package/build/cjs/sub-blocks/Content/ContentList/ContentList.js +25 -0
  22. package/build/cjs/sub-blocks/Content/schema.d.ts +60 -0
  23. package/build/cjs/sub-blocks/Content/schema.js +18 -1
  24. package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +11 -0
  25. package/build/cjs/text-transform/config.js +19 -1
  26. package/build/esm/blocks/ContentLayout/ContentLayout.css +0 -3
  27. package/build/esm/blocks/ContentLayout/schema.d.ts +16 -7
  28. package/build/esm/blocks/Info/schema.d.ts +22 -0
  29. package/build/esm/blocks/Map/schema.d.ts +11 -0
  30. package/build/esm/blocks/Media/schema.d.ts +22 -0
  31. package/build/esm/blocks/Questions/schema.d.ts +11 -0
  32. package/build/esm/blocks/Tabs/schema.d.ts +11 -0
  33. package/build/esm/components/MediaBase/MediaBaseContent.js +2 -2
  34. package/build/esm/models/constructor-items/blocks.d.ts +8 -5
  35. package/build/esm/models/constructor-items/sub-blocks.d.ts +5 -0
  36. package/build/esm/models/constructor-items/sub-blocks.js +5 -0
  37. package/build/esm/schema/constants.d.ts +26 -0
  38. package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +11 -0
  39. package/build/esm/sub-blocks/BasicCard/BasicCard.css +15 -0
  40. package/build/esm/sub-blocks/BasicCard/BasicCard.js +5 -3
  41. package/build/esm/sub-blocks/BasicCard/schema.d.ts +15 -0
  42. package/build/esm/sub-blocks/BasicCard/schema.js +3 -0
  43. package/build/esm/sub-blocks/Content/Content.js +3 -1
  44. package/build/esm/sub-blocks/Content/ContentList/ContentList.css +48 -0
  45. package/build/esm/sub-blocks/Content/ContentList/ContentList.d.ts +8 -0
  46. package/build/esm/sub-blocks/Content/ContentList/ContentList.js +23 -0
  47. package/build/esm/sub-blocks/Content/schema.d.ts +60 -0
  48. package/build/esm/sub-blocks/Content/schema.js +18 -1
  49. package/build/esm/sub-blocks/LayoutItem/schema.d.ts +11 -0
  50. package/build/esm/text-transform/config.js +19 -1
  51. package/package.json +2 -2
  52. package/server/models/constructor-items/blocks.d.ts +8 -5
  53. package/server/models/constructor-items/sub-blocks.d.ts +5 -0
  54. package/server/models/constructor-items/sub-blocks.js +6 -1
  55. package/server/text-transform/config.js +19 -1
  56. package/widget/index.js +1 -1
@@ -293,6 +293,17 @@ export declare const LayoutItem: {
293
293
  type: string;
294
294
  enum: string[];
295
295
  };
296
+ list: {
297
+ type: string;
298
+ items: {
299
+ type: string;
300
+ properties: {
301
+ when: {
302
+ type: string;
303
+ };
304
+ };
305
+ };
306
+ };
296
307
  }>;
297
308
  metaInfo: {
298
309
  type: string;
@@ -48,7 +48,7 @@ function parsePriceDetailedBlock(transformer, block) {
48
48
  }
49
49
  const parseContentLayout = (transformer, content) => {
50
50
  if (content) {
51
- const { text, additionalInfo } = content;
51
+ const { text, additionalInfo, list } = content;
52
52
  /* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
53
53
  if (text) {
54
54
  content.text = transformer(text);
@@ -56,6 +56,14 @@ const parseContentLayout = (transformer, content) => {
56
56
  if (additionalInfo) {
57
57
  content.additionalInfo = transformer(additionalInfo);
58
58
  }
59
+ if (list) {
60
+ content.list = list.map((item) => {
61
+ if (item === null || item === void 0 ? void 0 : item.text) {
62
+ return Object.assign(Object.assign({}, item), { text: transformer(item.text) });
63
+ }
64
+ return item;
65
+ });
66
+ }
59
67
  /* eslint-enable no-not-accumulator-reassign/no-not-accumulator-reassign */
60
68
  }
61
69
  return content;
@@ -184,6 +192,11 @@ export const config = {
184
192
  fields: ['title', 'additionalInfo'],
185
193
  transformer: yfmTransformer,
186
194
  },
195
+ {
196
+ fields: ['list'],
197
+ transformer: yfmTransformer,
198
+ parser: createItemsParser(['text']),
199
+ },
187
200
  ],
188
201
  [BlockType.MapBlock]: [
189
202
  ...blockHeaderTransformer,
@@ -258,6 +271,11 @@ export const config = {
258
271
  transformer: typografTransformer,
259
272
  parser: parseTitle,
260
273
  },
274
+ {
275
+ fields: ['list'],
276
+ transformer: yfmTransformer,
277
+ parser: createItemsParser(['text']),
278
+ },
261
279
  ],
262
280
  [BlockType.InfoBlock]: [
263
281
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "3.15.0",
3
+ "version": "3.17.0",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -80,7 +80,7 @@
80
80
  "test:watch": "jest --watchAll"
81
81
  },
82
82
  "dependencies": {
83
- "@gravity-ui/dynamic-forms": "^1.9.2",
83
+ "@gravity-ui/dynamic-forms": "^1.11.0",
84
84
  "@gravity-ui/i18n": "^1.0.0",
85
85
  "ajv": "^8.12.0",
86
86
  "bem-cn-lite": "^4.0.0",
@@ -154,14 +154,11 @@ export interface MediaBaseBlockProps extends Animatable, MediaContentProps {
154
154
  mediaOnly?: boolean;
155
155
  disableShadow?: boolean;
156
156
  }
157
- export interface MediaContentProps {
157
+ export interface MediaContentProps extends Omit<ContentBlockProps, 'colSizes' | 'text' | 'title' | 'theme' | 'centered'> {
158
158
  title: string;
159
159
  description?: string;
160
- additionalInfo?: string;
160
+ /** @deprecated Use array of buttons from ContentBlockProps instead**/
161
161
  button?: ButtonProps;
162
- links?: LinkProps[];
163
- buttons?: ButtonProps[];
164
- size?: ContentSize;
165
162
  }
166
163
  export interface MediaBlockProps extends MediaBaseBlockProps {
167
164
  media: ThemeSupporting<MediaProps>;
@@ -259,6 +256,11 @@ export interface ContentLayoutBlockProps extends ContentLayoutBlockParams {
259
256
  textContent: ContentBlockProps;
260
257
  fileContent?: FileLinkProps[];
261
258
  }
259
+ export interface ContentItemProps {
260
+ title?: string;
261
+ text?: string;
262
+ icon: ThemedImage;
263
+ }
262
264
  export interface ContentBlockProps {
263
265
  title?: TitleItemBaseProps | string;
264
266
  text?: string;
@@ -269,6 +271,7 @@ export interface ContentBlockProps {
269
271
  colSizes?: GridColumnSizesType;
270
272
  centered?: boolean;
271
273
  theme?: ContentTheme;
274
+ list?: ContentItemProps[];
272
275
  }
273
276
  export declare enum PCShareSocialNetwork {
274
277
  Vk = "vk",
@@ -23,6 +23,10 @@ export declare enum SubBlockType {
23
23
  */
24
24
  Card = "card"
25
25
  }
26
+ export declare enum IconPosition {
27
+ Top = "top",
28
+ Left = "left"
29
+ }
26
30
  export declare const SubBlockTypes: SubBlockType[];
27
31
  export interface DividerProps {
28
32
  size?: DividerSize;
@@ -77,6 +81,7 @@ export interface BasicCardProps extends CardBaseProps, Omit<ContentBlockProps, '
77
81
  url: string;
78
82
  icon?: ImageProps;
79
83
  target?: string;
84
+ iconPosition?: IconPosition;
80
85
  }
81
86
  export interface BannerCardProps {
82
87
  title: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SubBlockTypes = exports.SubBlockType = void 0;
3
+ exports.SubBlockTypes = exports.IconPosition = exports.SubBlockType = void 0;
4
4
  var SubBlockType;
5
5
  (function (SubBlockType) {
6
6
  SubBlockType["Divider"] = "divider";
@@ -21,4 +21,9 @@ var SubBlockType;
21
21
  */
22
22
  SubBlockType["Card"] = "card";
23
23
  })(SubBlockType = exports.SubBlockType || (exports.SubBlockType = {}));
24
+ var IconPosition;
25
+ (function (IconPosition) {
26
+ IconPosition["Top"] = "top";
27
+ IconPosition["Left"] = "left";
28
+ })(IconPosition = exports.IconPosition || (exports.IconPosition = {}));
24
29
  exports.SubBlockTypes = Object.values(SubBlockType);
@@ -61,7 +61,7 @@ function parsePriceDetailedBlock(transformer, block) {
61
61
  }
62
62
  const parseContentLayout = (transformer, content) => {
63
63
  if (content) {
64
- const { text, additionalInfo } = content;
64
+ const { text, additionalInfo, list } = content;
65
65
  /* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
66
66
  if (text) {
67
67
  content.text = transformer(text);
@@ -69,6 +69,14 @@ const parseContentLayout = (transformer, content) => {
69
69
  if (additionalInfo) {
70
70
  content.additionalInfo = transformer(additionalInfo);
71
71
  }
72
+ if (list) {
73
+ content.list = list.map((item) => {
74
+ if (item === null || item === void 0 ? void 0 : item.text) {
75
+ return Object.assign(Object.assign({}, item), { text: transformer(item.text) });
76
+ }
77
+ return item;
78
+ });
79
+ }
72
80
  /* eslint-enable no-not-accumulator-reassign/no-not-accumulator-reassign */
73
81
  }
74
82
  return content;
@@ -197,6 +205,11 @@ exports.config = {
197
205
  fields: ['title', 'additionalInfo'],
198
206
  transformer: common_1.yfmTransformer,
199
207
  },
208
+ {
209
+ fields: ['list'],
210
+ transformer: common_1.yfmTransformer,
211
+ parser: (0, common_1.createItemsParser)(['text']),
212
+ },
200
213
  ],
201
214
  [models_1.BlockType.MapBlock]: [
202
215
  ...exports.blockHeaderTransformer,
@@ -271,6 +284,11 @@ exports.config = {
271
284
  transformer: common_1.typografTransformer,
272
285
  parser: parseTitle,
273
286
  },
287
+ {
288
+ fields: ['list'],
289
+ transformer: common_1.yfmTransformer,
290
+ parser: (0, common_1.createItemsParser)(['text']),
291
+ },
274
292
  ],
275
293
  [models_1.BlockType.InfoBlock]: [
276
294
  {