@gravity-ui/page-constructor 4.41.1-alpha.0 → 4.42.1
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/build/cjs/blocks/CardLayout/schema.d.ts +24 -0
- package/build/cjs/blocks/ContentLayout/schema.d.ts +12 -0
- package/build/cjs/blocks/ExtendedFeatures/schema.d.ts +12 -0
- package/build/cjs/blocks/FilterBlock/schema.d.ts +24 -0
- package/build/cjs/blocks/Form/schema.d.ts +12 -0
- package/build/cjs/blocks/Header/schema.d.ts +12 -0
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +12 -0
- package/build/cjs/blocks/Icons/schema.d.ts +24 -0
- package/build/cjs/blocks/Map/schema.d.ts +12 -0
- package/build/cjs/blocks/Media/schema.d.ts +24 -0
- package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +12 -0
- package/build/cjs/blocks/Questions/schema.d.ts +12 -0
- package/build/cjs/blocks/Slider/schema.d.ts +12 -0
- package/build/cjs/blocks/Table/schema.d.ts +12 -0
- package/build/cjs/blocks/Tabs/schema.d.ts +12 -0
- package/build/cjs/components/ContentList/ContentList.css +16 -16
- package/build/cjs/components/ContentList/ContentList.js +2 -2
- package/build/cjs/constructor-items.d.ts +1 -0
- package/build/cjs/constructor-items.js +1 -0
- package/build/cjs/editor/components/CodeEditor/CodeEditor.css +2 -5
- package/build/cjs/editor/components/CodeEditor/CodeEditor.d.ts +2 -2
- package/build/cjs/editor/components/CodeEditor/CodeEditor.js +12 -9
- package/build/cjs/editor/containers/Editor/Editor.d.ts +1 -1
- package/build/cjs/editor/containers/Editor/Editor.js +19 -8
- package/build/cjs/editor/containers/Form/Form.js +3 -1
- package/build/cjs/editor/containers/Form/hooks.d.ts +8 -0
- package/build/cjs/editor/containers/Form/hooks.js +39 -0
- package/build/cjs/editor/context.d.ts +2 -0
- package/build/cjs/editor/types/index.d.ts +2 -0
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +6 -3
- package/build/cjs/schema/validators/common.d.ts +13 -1
- package/build/cjs/schema/validators/common.js +8 -1
- package/build/cjs/sub-blocks/Content/Content.css +6 -0
- package/build/cjs/sub-blocks/Content/Content.js +2 -1
- package/build/cjs/sub-blocks/Divider/schema.d.ts +1 -1
- package/build/cjs/sub-blocks/PriceCard/PriceCard.css +23 -2
- package/build/cjs/sub-blocks/PriceCard/PriceCard.js +3 -3
- package/build/esm/blocks/CardLayout/schema.d.ts +24 -0
- package/build/esm/blocks/ContentLayout/schema.d.ts +12 -0
- package/build/esm/blocks/ExtendedFeatures/schema.d.ts +12 -0
- package/build/esm/blocks/FilterBlock/schema.d.ts +24 -0
- package/build/esm/blocks/Form/schema.d.ts +12 -0
- package/build/esm/blocks/Header/schema.d.ts +12 -0
- package/build/esm/blocks/HeaderSlider/schema.d.ts +12 -0
- package/build/esm/blocks/Icons/schema.d.ts +24 -0
- package/build/esm/blocks/Map/schema.d.ts +12 -0
- package/build/esm/blocks/Media/schema.d.ts +24 -0
- package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +12 -0
- package/build/esm/blocks/Questions/schema.d.ts +12 -0
- package/build/esm/blocks/Slider/schema.d.ts +12 -0
- package/build/esm/blocks/Table/schema.d.ts +12 -0
- package/build/esm/blocks/Tabs/schema.d.ts +12 -0
- package/build/esm/components/ContentList/ContentList.css +16 -16
- package/build/esm/components/ContentList/ContentList.js +2 -2
- package/build/esm/constructor-items.d.ts +1 -0
- package/build/esm/constructor-items.js +2 -1
- package/build/esm/editor/components/CodeEditor/CodeEditor.css +2 -5
- package/build/esm/editor/components/CodeEditor/CodeEditor.d.ts +2 -2
- package/build/esm/editor/components/CodeEditor/CodeEditor.js +13 -10
- package/build/esm/editor/containers/Editor/Editor.d.ts +1 -1
- package/build/esm/editor/containers/Editor/Editor.js +19 -8
- package/build/esm/editor/containers/Form/Form.js +3 -1
- package/build/esm/editor/containers/Form/hooks.d.ts +8 -0
- package/build/esm/editor/containers/Form/hooks.js +34 -0
- package/build/esm/editor/context.d.ts +2 -0
- package/build/esm/editor/types/index.d.ts +2 -0
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +7 -4
- package/build/esm/schema/validators/common.d.ts +13 -1
- package/build/esm/schema/validators/common.js +8 -1
- package/build/esm/sub-blocks/Content/Content.css +6 -0
- package/build/esm/sub-blocks/Content/Content.js +2 -1
- package/build/esm/sub-blocks/Divider/schema.d.ts +1 -1
- package/build/esm/sub-blocks/PriceCard/PriceCard.css +23 -2
- package/build/esm/sub-blocks/PriceCard/PriceCard.js +3 -3
- package/package.json +1 -1
- package/widget/index.js +1 -1
|
@@ -78,6 +78,18 @@ export declare const CardLayoutProps: {
|
|
|
78
78
|
context: {
|
|
79
79
|
type: string;
|
|
80
80
|
};
|
|
81
|
+
indent: {
|
|
82
|
+
type: string;
|
|
83
|
+
additionalProperties: boolean;
|
|
84
|
+
properties: {
|
|
85
|
+
top: {
|
|
86
|
+
enum: string[];
|
|
87
|
+
};
|
|
88
|
+
bottom: {
|
|
89
|
+
enum: string[];
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
};
|
|
81
93
|
type: {};
|
|
82
94
|
when: {
|
|
83
95
|
type: string;
|
|
@@ -165,6 +177,18 @@ export declare const CardLayoutBlock: {
|
|
|
165
177
|
context: {
|
|
166
178
|
type: string;
|
|
167
179
|
};
|
|
180
|
+
indent: {
|
|
181
|
+
type: string;
|
|
182
|
+
additionalProperties: boolean;
|
|
183
|
+
properties: {
|
|
184
|
+
top: {
|
|
185
|
+
enum: string[];
|
|
186
|
+
};
|
|
187
|
+
bottom: {
|
|
188
|
+
enum: string[];
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
};
|
|
168
192
|
type: {};
|
|
169
193
|
when: {
|
|
170
194
|
type: string;
|
|
@@ -242,6 +242,18 @@ export declare const ContentLayoutBlock: {
|
|
|
242
242
|
context: {
|
|
243
243
|
type: string;
|
|
244
244
|
};
|
|
245
|
+
indent: {
|
|
246
|
+
type: string;
|
|
247
|
+
additionalProperties: boolean;
|
|
248
|
+
properties: {
|
|
249
|
+
top: {
|
|
250
|
+
enum: string[];
|
|
251
|
+
};
|
|
252
|
+
bottom: {
|
|
253
|
+
enum: string[];
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
};
|
|
245
257
|
type: {};
|
|
246
258
|
when: {
|
|
247
259
|
type: string;
|
|
@@ -243,6 +243,18 @@ export declare const ExtendedFeaturesBlock: {
|
|
|
243
243
|
context: {
|
|
244
244
|
type: string;
|
|
245
245
|
};
|
|
246
|
+
indent: {
|
|
247
|
+
type: string;
|
|
248
|
+
additionalProperties: boolean;
|
|
249
|
+
properties: {
|
|
250
|
+
top: {
|
|
251
|
+
enum: string[];
|
|
252
|
+
};
|
|
253
|
+
bottom: {
|
|
254
|
+
enum: string[];
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
};
|
|
246
258
|
type: {};
|
|
247
259
|
when: {
|
|
248
260
|
type: string;
|
|
@@ -134,6 +134,18 @@ export declare const FilterProps: {
|
|
|
134
134
|
context: {
|
|
135
135
|
type: string;
|
|
136
136
|
};
|
|
137
|
+
indent: {
|
|
138
|
+
type: string;
|
|
139
|
+
additionalProperties: boolean;
|
|
140
|
+
properties: {
|
|
141
|
+
top: {
|
|
142
|
+
enum: string[];
|
|
143
|
+
};
|
|
144
|
+
bottom: {
|
|
145
|
+
enum: string[];
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
};
|
|
137
149
|
type: {};
|
|
138
150
|
when: {
|
|
139
151
|
type: string;
|
|
@@ -250,6 +262,18 @@ export declare const FilterBlock: {
|
|
|
250
262
|
context: {
|
|
251
263
|
type: string;
|
|
252
264
|
};
|
|
265
|
+
indent: {
|
|
266
|
+
type: string;
|
|
267
|
+
additionalProperties: boolean;
|
|
268
|
+
properties: {
|
|
269
|
+
top: {
|
|
270
|
+
enum: string[];
|
|
271
|
+
};
|
|
272
|
+
bottom: {
|
|
273
|
+
enum: string[];
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
};
|
|
253
277
|
type: {};
|
|
254
278
|
when: {
|
|
255
279
|
type: string;
|
|
@@ -193,6 +193,18 @@ export declare const FormBlock: {
|
|
|
193
193
|
context: {
|
|
194
194
|
type: string;
|
|
195
195
|
};
|
|
196
|
+
indent: {
|
|
197
|
+
type: string;
|
|
198
|
+
additionalProperties: boolean;
|
|
199
|
+
properties: {
|
|
200
|
+
top: {
|
|
201
|
+
enum: string[];
|
|
202
|
+
};
|
|
203
|
+
bottom: {
|
|
204
|
+
enum: string[];
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
};
|
|
196
208
|
type: {};
|
|
197
209
|
when: {
|
|
198
210
|
type: string;
|
|
@@ -1318,6 +1318,18 @@ export declare const HeaderBlock: {
|
|
|
1318
1318
|
context: {
|
|
1319
1319
|
type: string;
|
|
1320
1320
|
};
|
|
1321
|
+
indent: {
|
|
1322
|
+
type: string;
|
|
1323
|
+
additionalProperties: boolean;
|
|
1324
|
+
properties: {
|
|
1325
|
+
top: {
|
|
1326
|
+
enum: string[];
|
|
1327
|
+
};
|
|
1328
|
+
bottom: {
|
|
1329
|
+
enum: string[];
|
|
1330
|
+
};
|
|
1331
|
+
};
|
|
1332
|
+
};
|
|
1321
1333
|
type: {};
|
|
1322
1334
|
when: {
|
|
1323
1335
|
type: string;
|
|
@@ -587,6 +587,18 @@ export declare const HeaderSliderBlock: {
|
|
|
587
587
|
context: {
|
|
588
588
|
type: string;
|
|
589
589
|
};
|
|
590
|
+
indent: {
|
|
591
|
+
type: string;
|
|
592
|
+
additionalProperties: boolean;
|
|
593
|
+
properties: {
|
|
594
|
+
top: {
|
|
595
|
+
enum: string[];
|
|
596
|
+
};
|
|
597
|
+
bottom: {
|
|
598
|
+
enum: string[];
|
|
599
|
+
};
|
|
600
|
+
};
|
|
601
|
+
};
|
|
590
602
|
type: {};
|
|
591
603
|
when: {
|
|
592
604
|
type: string;
|
|
@@ -142,6 +142,18 @@ export declare const IconsProps: {
|
|
|
142
142
|
context: {
|
|
143
143
|
type: string;
|
|
144
144
|
};
|
|
145
|
+
indent: {
|
|
146
|
+
type: string;
|
|
147
|
+
additionalProperties: boolean;
|
|
148
|
+
properties: {
|
|
149
|
+
top: {
|
|
150
|
+
enum: string[];
|
|
151
|
+
};
|
|
152
|
+
bottom: {
|
|
153
|
+
enum: string[];
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
};
|
|
145
157
|
type: {};
|
|
146
158
|
when: {
|
|
147
159
|
type: string;
|
|
@@ -293,6 +305,18 @@ export declare const IconsBlock: {
|
|
|
293
305
|
context: {
|
|
294
306
|
type: string;
|
|
295
307
|
};
|
|
308
|
+
indent: {
|
|
309
|
+
type: string;
|
|
310
|
+
additionalProperties: boolean;
|
|
311
|
+
properties: {
|
|
312
|
+
top: {
|
|
313
|
+
enum: string[];
|
|
314
|
+
};
|
|
315
|
+
bottom: {
|
|
316
|
+
enum: string[];
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
};
|
|
296
320
|
type: {};
|
|
297
321
|
when: {
|
|
298
322
|
type: string;
|
|
@@ -473,6 +473,18 @@ export declare const MapBlock: {
|
|
|
473
473
|
context: {
|
|
474
474
|
type: string;
|
|
475
475
|
};
|
|
476
|
+
indent: {
|
|
477
|
+
type: string;
|
|
478
|
+
additionalProperties: boolean;
|
|
479
|
+
properties: {
|
|
480
|
+
top: {
|
|
481
|
+
enum: string[];
|
|
482
|
+
};
|
|
483
|
+
bottom: {
|
|
484
|
+
enum: string[];
|
|
485
|
+
};
|
|
486
|
+
};
|
|
487
|
+
};
|
|
476
488
|
type: {};
|
|
477
489
|
when: {
|
|
478
490
|
type: string;
|
|
@@ -637,6 +637,18 @@ export declare const MediaBlockBaseProps: {
|
|
|
637
637
|
context: {
|
|
638
638
|
type: string;
|
|
639
639
|
};
|
|
640
|
+
indent: {
|
|
641
|
+
type: string;
|
|
642
|
+
additionalProperties: boolean;
|
|
643
|
+
properties: {
|
|
644
|
+
top: {
|
|
645
|
+
enum: string[];
|
|
646
|
+
};
|
|
647
|
+
bottom: {
|
|
648
|
+
enum: string[];
|
|
649
|
+
};
|
|
650
|
+
};
|
|
651
|
+
};
|
|
640
652
|
type: {};
|
|
641
653
|
when: {
|
|
642
654
|
type: string;
|
|
@@ -1295,6 +1307,18 @@ export declare const MediaBlock: {
|
|
|
1295
1307
|
context: {
|
|
1296
1308
|
type: string;
|
|
1297
1309
|
};
|
|
1310
|
+
indent: {
|
|
1311
|
+
type: string;
|
|
1312
|
+
additionalProperties: boolean;
|
|
1313
|
+
properties: {
|
|
1314
|
+
top: {
|
|
1315
|
+
enum: string[];
|
|
1316
|
+
};
|
|
1317
|
+
bottom: {
|
|
1318
|
+
enum: string[];
|
|
1319
|
+
};
|
|
1320
|
+
};
|
|
1321
|
+
};
|
|
1298
1322
|
type: {};
|
|
1299
1323
|
when: {
|
|
1300
1324
|
type: string;
|
|
@@ -374,6 +374,18 @@ export declare const PromoFeaturesBlock: {
|
|
|
374
374
|
context: {
|
|
375
375
|
type: string;
|
|
376
376
|
};
|
|
377
|
+
indent: {
|
|
378
|
+
type: string;
|
|
379
|
+
additionalProperties: boolean;
|
|
380
|
+
properties: {
|
|
381
|
+
top: {
|
|
382
|
+
enum: string[];
|
|
383
|
+
};
|
|
384
|
+
bottom: {
|
|
385
|
+
enum: string[];
|
|
386
|
+
};
|
|
387
|
+
};
|
|
388
|
+
};
|
|
377
389
|
type: {};
|
|
378
390
|
when: {
|
|
379
391
|
type: string;
|
|
@@ -115,6 +115,18 @@ export declare const QuestionsBlock: {
|
|
|
115
115
|
context: {
|
|
116
116
|
type: string;
|
|
117
117
|
};
|
|
118
|
+
indent: {
|
|
119
|
+
type: string;
|
|
120
|
+
additionalProperties: boolean;
|
|
121
|
+
properties: {
|
|
122
|
+
top: {
|
|
123
|
+
enum: string[];
|
|
124
|
+
};
|
|
125
|
+
bottom: {
|
|
126
|
+
enum: string[];
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
};
|
|
118
130
|
type: {};
|
|
119
131
|
when: {
|
|
120
132
|
type: string;
|
|
@@ -215,6 +215,18 @@ export declare const SliderBlock: {
|
|
|
215
215
|
context: {
|
|
216
216
|
type: string;
|
|
217
217
|
};
|
|
218
|
+
indent: {
|
|
219
|
+
type: string;
|
|
220
|
+
additionalProperties: boolean;
|
|
221
|
+
properties: {
|
|
222
|
+
top: {
|
|
223
|
+
enum: string[];
|
|
224
|
+
};
|
|
225
|
+
bottom: {
|
|
226
|
+
enum: string[];
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
};
|
|
218
230
|
type: {};
|
|
219
231
|
when: {
|
|
220
232
|
type: string;
|
|
@@ -81,6 +81,18 @@ export declare const TableBlock: {
|
|
|
81
81
|
context: {
|
|
82
82
|
type: string;
|
|
83
83
|
};
|
|
84
|
+
indent: {
|
|
85
|
+
type: string;
|
|
86
|
+
additionalProperties: boolean;
|
|
87
|
+
properties: {
|
|
88
|
+
top: {
|
|
89
|
+
enum: string[];
|
|
90
|
+
};
|
|
91
|
+
bottom: {
|
|
92
|
+
enum: string[];
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
84
96
|
type: {};
|
|
85
97
|
when: {
|
|
86
98
|
type: string;
|
|
@@ -607,6 +607,18 @@ export declare const TabsBlock: {
|
|
|
607
607
|
context: {
|
|
608
608
|
type: string;
|
|
609
609
|
};
|
|
610
|
+
indent: {
|
|
611
|
+
type: string;
|
|
612
|
+
additionalProperties: boolean;
|
|
613
|
+
properties: {
|
|
614
|
+
top: {
|
|
615
|
+
enum: string[];
|
|
616
|
+
};
|
|
617
|
+
bottom: {
|
|
618
|
+
enum: string[];
|
|
619
|
+
};
|
|
620
|
+
};
|
|
621
|
+
};
|
|
610
622
|
type: {};
|
|
611
623
|
when: {
|
|
612
624
|
type: string;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
/* use this for style redefinitions to awoid problems with
|
|
2
2
|
unpredictable css rules order in build */
|
|
3
|
-
.pc-content-list_size_l {
|
|
4
|
-
margin-top: 24px;
|
|
5
|
-
}
|
|
6
3
|
.pc-content-list_size_l .pc-content-list__title {
|
|
7
4
|
font-size: var(--g-text-header-1-font-size);
|
|
8
5
|
line-height: var(--g-text-header-1-line-height);
|
|
@@ -15,19 +12,19 @@ unpredictable css rules order in build */
|
|
|
15
12
|
margin-bottom: 1px;
|
|
16
13
|
margin-right: 12px;
|
|
17
14
|
}
|
|
18
|
-
.pc-content-list_size_l .pc-content-
|
|
15
|
+
.pc-content-list_size_l .pc-content-list__item:not(:last-child) {
|
|
16
|
+
margin-bottom: 16px;
|
|
17
|
+
}
|
|
18
|
+
.pc-content-list_size_l .pc-content-list__item_without-title:not(:last-child) {
|
|
19
|
+
margin-bottom: 12px;
|
|
20
|
+
}
|
|
21
|
+
.pc-content-list_size_l .pc-content-list__item_without-title .pc-content-list__icon {
|
|
19
22
|
width: 20px;
|
|
20
23
|
height: 20px;
|
|
21
24
|
margin-top: 0;
|
|
22
25
|
margin-bottom: 0;
|
|
23
26
|
margin-right: 8px;
|
|
24
27
|
}
|
|
25
|
-
.pc-content-list_size_l .pc-content-list__item:not(:last-child) {
|
|
26
|
-
margin-bottom: 16px;
|
|
27
|
-
}
|
|
28
|
-
.pc-content-list_size_s {
|
|
29
|
-
margin-top: 16px;
|
|
30
|
-
}
|
|
31
28
|
.pc-content-list_size_s .pc-content-list__title {
|
|
32
29
|
font-size: var(--g-text-subheader-3-font-size);
|
|
33
30
|
line-height: var(--g-text-subheader-3-line-height);
|
|
@@ -40,12 +37,6 @@ unpredictable css rules order in build */
|
|
|
40
37
|
margin-bottom: 2px;
|
|
41
38
|
margin-right: 8px;
|
|
42
39
|
}
|
|
43
|
-
.pc-content-list_size_s .pc-content-list__icon_without_title {
|
|
44
|
-
width: 18px;
|
|
45
|
-
height: 18px;
|
|
46
|
-
margin-top: 0;
|
|
47
|
-
margin-bottom: 0;
|
|
48
|
-
}
|
|
49
40
|
.pc-content-list_size_s .pc-content-list__text {
|
|
50
41
|
font-size: var(--g-text-body-1-font-size);
|
|
51
42
|
line-height: var(--g-text-body-1-line-height);
|
|
@@ -53,6 +44,15 @@ unpredictable css rules order in build */
|
|
|
53
44
|
.pc-content-list_size_s .pc-content-list__item:not(:last-child) {
|
|
54
45
|
margin-bottom: 12px;
|
|
55
46
|
}
|
|
47
|
+
.pc-content-list_size_s .pc-content-list__item_without-title:not(:last-child) {
|
|
48
|
+
margin-bottom: 8px;
|
|
49
|
+
}
|
|
50
|
+
.pc-content-list_size_s .pc-content-list__item_without-title .pc-content-list__icon {
|
|
51
|
+
width: 18px;
|
|
52
|
+
height: 18px;
|
|
53
|
+
margin-top: 0;
|
|
54
|
+
margin-bottom: 0;
|
|
55
|
+
}
|
|
56
56
|
.pc-content-list__icon {
|
|
57
57
|
display: block;
|
|
58
58
|
}
|
|
@@ -21,8 +21,8 @@ const ContentList = ({ list, size = 'l', qa }) => {
|
|
|
21
21
|
const qaAttributes = (0, blocks_1.getQaAttrubutes)(qa, ['image', 'title', 'text']);
|
|
22
22
|
return (react_1.default.createElement("div", { className: b({ size }), "data-qa": qa }, list === null || list === void 0 ? void 0 : list.map((item) => {
|
|
23
23
|
const { icon, title, text } = item;
|
|
24
|
-
return (react_1.default.createElement("div", { className: b('item'), key: (0, uuid_1.v4)() },
|
|
25
|
-
react_1.default.createElement(ContentListItemIcon_1.default, { icon: icon, className: b('icon'
|
|
24
|
+
return (react_1.default.createElement("div", { className: b('item', { 'without-title': !title }), key: (0, uuid_1.v4)() },
|
|
25
|
+
react_1.default.createElement(ContentListItemIcon_1.default, { icon: icon, className: b('icon'), qa: qaAttributes.image }),
|
|
26
26
|
react_1.default.createElement("div", null,
|
|
27
27
|
title &&
|
|
28
28
|
react_1.default.createElement(getHeadingLevel(size), { className: b('title'), 'data-qa': qaAttributes.title }, react_1.default.createElement(YFMWrapper_1.default, { content: title, modifiers: { constructor: true } })),
|
|
@@ -29,6 +29,7 @@ export declare const subBlockMap: {
|
|
|
29
29
|
"basic-card": (props: import("./models").BasicCardProps) => JSX.Element;
|
|
30
30
|
content: (props: import("./sub-blocks/Content/Content").ContentProps) => JSX.Element;
|
|
31
31
|
quote: (props: import("./models").QuoteProps) => JSX.Element;
|
|
32
|
+
"price-card": (props: import("./models").PriceCardProps) => JSX.Element;
|
|
32
33
|
};
|
|
33
34
|
export declare const navItemMap: {
|
|
34
35
|
button: import("react").FC<Pick<import("./navigation/models").NavigationItemProps, "className"> & import("./models").ButtonProps>;
|
|
@@ -38,6 +38,7 @@ exports.subBlockMap = {
|
|
|
38
38
|
[models_1.SubBlockType.BasicCard]: sub_blocks_1.BasicCard,
|
|
39
39
|
[models_1.SubBlockType.Content]: sub_blocks_1.Content,
|
|
40
40
|
[models_1.SubBlockType.Quote]: sub_blocks_1.Quote,
|
|
41
|
+
[models_1.SubBlockType.PriceCard]: sub_blocks_1.PriceCard,
|
|
41
42
|
};
|
|
42
43
|
exports.navItemMap = {
|
|
43
44
|
[models_1.NavigationItemType.Button]: NavigationItem_1.NavigationButton,
|
|
@@ -4,17 +4,14 @@
|
|
|
4
4
|
overflow: hidden;
|
|
5
5
|
}
|
|
6
6
|
.pc-code-editor_fullscreen {
|
|
7
|
-
position:
|
|
7
|
+
position: absolute;
|
|
8
8
|
top: 0;
|
|
9
9
|
left: 0;
|
|
10
10
|
width: 100%;
|
|
11
|
-
height:
|
|
11
|
+
height: 100%;
|
|
12
12
|
z-index: 1000;
|
|
13
13
|
background: var(--g-color-base-background);
|
|
14
14
|
}
|
|
15
|
-
.pc-code-editor_fullscreen .pc-code-editor__header {
|
|
16
|
-
margin-top: var(--pc-editor-header-height);
|
|
17
|
-
}
|
|
18
15
|
.pc-code-editor__code {
|
|
19
16
|
width: 100%;
|
|
20
17
|
height: 100%;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { PageContent } from '../../../models';
|
|
2
2
|
import { CodeEditorMessageProps } from '../../utils/validation';
|
|
3
3
|
interface CodeEditorProps {
|
|
4
|
-
|
|
4
|
+
code: string;
|
|
5
5
|
fullscreenModeOn: boolean;
|
|
6
6
|
validator: (code: string) => CodeEditorMessageProps;
|
|
7
7
|
onFullscreenModeOnUpdate: (fullscreenModeOn: boolean) => void;
|
|
8
8
|
onChange: (content: PageContent) => void;
|
|
9
9
|
message?: CodeEditorMessageProps;
|
|
10
10
|
}
|
|
11
|
-
export declare const CodeEditor: ({
|
|
11
|
+
export declare const CodeEditor: ({ onChange, validator, fullscreenModeOn, onFullscreenModeOnUpdate, code, }: CodeEditorProps) => JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -5,26 +5,29 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const icons_1 = require("@gravity-ui/icons");
|
|
7
7
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
8
|
-
const
|
|
8
|
+
const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
|
|
9
9
|
const react_monaco_editor_1 = tslib_1.__importDefault(require("react-monaco-editor"));
|
|
10
|
+
const models_1 = require("../../../models");
|
|
10
11
|
const utils_1 = require("../../../utils");
|
|
12
|
+
const context_1 = require("../../context");
|
|
11
13
|
const code_1 = require("../../utils/code");
|
|
12
14
|
const constants_1 = require("./constants");
|
|
13
15
|
const b = (0, utils_1.block)('code-editor');
|
|
14
|
-
const CodeEditor = ({
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const CodeEditor = ({ onChange, validator, fullscreenModeOn, onFullscreenModeOnUpdate, code, }) => {
|
|
17
|
+
const [message, setMessage] = (0, react_1.useState)(() => validator(code));
|
|
18
|
+
const { theme = models_1.Theme.Light } = (0, react_1.useContext)(context_1.EditorContext);
|
|
19
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20
|
+
const onChangeWithValidation = (0, react_1.useCallback)((0, debounce_1.default)((newCode) => {
|
|
21
|
+
const validationResult = validator(newCode);
|
|
19
22
|
setMessage(validationResult);
|
|
20
|
-
onChange((0, code_1.parseCode)(
|
|
21
|
-
}, [onChange, validator]);
|
|
23
|
+
onChange((0, code_1.parseCode)(newCode));
|
|
24
|
+
}, 200), [onChange, validator]);
|
|
22
25
|
return (react_1.default.createElement("div", { className: b({ fullscreen: fullscreenModeOn }) },
|
|
23
26
|
react_1.default.createElement("div", { className: b('header') },
|
|
24
27
|
react_1.default.createElement(uikit_1.Button, { view: "flat-secondary", onClick: () => onFullscreenModeOnUpdate(!fullscreenModeOn) },
|
|
25
28
|
react_1.default.createElement(uikit_1.Icon, { data: fullscreenModeOn ? icons_1.ChevronsCollapseUpRight : icons_1.ChevronsExpandUpRight, size: 16 }))),
|
|
26
29
|
react_1.default.createElement("div", { className: b('code') },
|
|
27
|
-
react_1.default.createElement(react_monaco_editor_1.default, { key: String(fullscreenModeOn), value:
|
|
30
|
+
react_1.default.createElement(react_monaco_editor_1.default, { key: String(fullscreenModeOn), value: code, language: "yaml", options: constants_1.options, onChange: onChangeWithValidation, theme: theme === models_1.Theme.Dark ? 'vs-dark' : 'vs' })),
|
|
28
31
|
react_1.default.createElement("div", { className: b('footer') }, message && (react_1.default.createElement("div", { className: b('message-container') },
|
|
29
32
|
react_1.default.createElement("div", { className: b('message', { status: message.status }) }, message.text))))));
|
|
30
33
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { EditorProps } from '../../types';
|
|
2
|
-
export declare const Editor: ({ customSchema, onChange, providerProps, transformContent, deviceEmulationSettings, ...rest }: EditorProps) => JSX.Element;
|
|
2
|
+
export declare const Editor: ({ customSchema, onChange, providerProps, transformContent, deviceEmulationSettings, theme: editorTheme, ...rest }: EditorProps) => JSX.Element;
|
|
@@ -15,13 +15,15 @@ const useCodeValidator_1 = require("../../hooks/useCodeValidator");
|
|
|
15
15
|
const main_1 = require("../../store/main");
|
|
16
16
|
const settings_1 = require("../../store/settings");
|
|
17
17
|
const types_1 = require("../../types");
|
|
18
|
+
const index_1 = require("../../types/index");
|
|
18
19
|
const utils_1 = require("../../utils");
|
|
19
20
|
const Form_1 = require("../Form/Form");
|
|
20
21
|
const Editor = (_a) => {
|
|
21
|
-
var { customSchema, onChange, providerProps, transformContent, deviceEmulationSettings } = _a, rest = tslib_1.__rest(_a, ["customSchema", "onChange", "providerProps", "transformContent", "deviceEmulationSettings"]);
|
|
22
|
+
var { customSchema, onChange, providerProps, transformContent, deviceEmulationSettings, theme: editorTheme } = _a, rest = tslib_1.__rest(_a, ["customSchema", "onChange", "providerProps", "transformContent", "deviceEmulationSettings", "theme"]);
|
|
22
23
|
const { content, activeBlockIndex, errorBoundaryState, onContentUpdate, onAdd, onSelect, injectEditBlockProps, } = (0, main_1.useMainState)(rest);
|
|
23
|
-
const { viewMode, theme, onViewModeUpdate, onThemeUpdate, formTab, onFormTabUpdate, codeFullscreeModeOn, onCodeFullscreeModeOnUpdate, } = (0, settings_1.useSettingsState)();
|
|
24
|
+
const { viewMode, theme: constructorTheme, onViewModeUpdate, onThemeUpdate, formTab, onFormTabUpdate, codeFullscreeModeOn, onCodeFullscreeModeOnUpdate, } = (0, settings_1.useSettingsState)();
|
|
24
25
|
const isEditingMode = viewMode === types_1.ViewModeItem.Edititng;
|
|
26
|
+
const isCodeOnlyMode = codeFullscreeModeOn && formTab === index_1.FormTab.Code && viewMode === types_1.ViewModeItem.Edititng;
|
|
25
27
|
const transformedContent = (0, react_1.useMemo)(() => (transformContent ? transformContent(content, { viewMode }) : content), [content, transformContent, viewMode]);
|
|
26
28
|
const schema = (0, react_1.useMemo)(() => (0, schema_1.generateDefaultSchema)(customSchema), [customSchema]);
|
|
27
29
|
const codeValidator = (0, useCodeValidator_1.useCodeValidator)(schema);
|
|
@@ -52,20 +54,29 @@ const Editor = (_a) => {
|
|
|
52
54
|
content: transformedContent,
|
|
53
55
|
custom: rest.custom,
|
|
54
56
|
},
|
|
55
|
-
providerProps: Object.assign(Object.assign({}, providerProps), { isMobile: (0, utils_1.checkIsMobile)(viewMode), theme }),
|
|
57
|
+
providerProps: Object.assign(Object.assign({}, providerProps), { isMobile: (0, utils_1.checkIsMobile)(viewMode), theme: constructorTheme }),
|
|
56
58
|
deviceEmulationSettings,
|
|
57
|
-
|
|
59
|
+
theme: editorTheme,
|
|
60
|
+
}), [
|
|
61
|
+
providerProps,
|
|
62
|
+
rest.custom,
|
|
63
|
+
viewMode,
|
|
64
|
+
transformedContent,
|
|
65
|
+
deviceEmulationSettings,
|
|
66
|
+
constructorTheme,
|
|
67
|
+
editorTheme,
|
|
68
|
+
]);
|
|
58
69
|
(0, react_1.useEffect)(() => {
|
|
59
70
|
onChange === null || onChange === void 0 ? void 0 : onChange(content);
|
|
60
71
|
}, [content, onChange]);
|
|
61
72
|
return (react_1.default.createElement(context_1.EditorContext.Provider, { value: context },
|
|
62
|
-
react_1.default.createElement(Layout_1.default, { mode: viewMode, onModeChange: onViewModeUpdate, theme:
|
|
73
|
+
react_1.default.createElement(Layout_1.default, { mode: viewMode, onModeChange: onViewModeUpdate, theme: constructorTheme, onThemeChange: onThemeUpdate },
|
|
63
74
|
isEditingMode && (react_1.default.createElement(Layout_1.default.Left, null,
|
|
64
75
|
react_1.default.createElement(Form_1.Form, { content: content, onChange: onContentUpdate, activeBlockIndex: activeBlockIndex, activeTab: formTab, codeFullscreeModeOn: codeFullscreeModeOn, schema: schema, codeValidator: codeValidator, onActiveTabUpdate: onFormTabUpdate, onCodeFullscreeModeOnUpdate: onCodeFullscreeModeOnUpdate, onSelect: onSelect }))),
|
|
65
|
-
react_1.default.createElement(Layout_1.default.Right, null,
|
|
76
|
+
!isCodeOnlyMode && (react_1.default.createElement(Layout_1.default.Right, null,
|
|
66
77
|
react_1.default.createElement(ErrorBoundary_1.ErrorBoundary, { key: errorBoundaryState },
|
|
67
|
-
react_1.default.createElement(PageConstructor_1.PageConstructorProvider, Object.assign({}, providerProps, { theme:
|
|
78
|
+
react_1.default.createElement(PageConstructor_1.PageConstructorProvider, Object.assign({}, providerProps, { theme: constructorTheme }),
|
|
68
79
|
react_1.default.createElement(PageConstructor_1.PageConstructor, Object.assign({}, outgoingProps)))),
|
|
69
|
-
isEditingMode && react_1.default.createElement(AddBlock_1.default, { onAdd: onAdd })))));
|
|
80
|
+
isEditingMode && react_1.default.createElement(AddBlock_1.default, { onAdd: onAdd }))))));
|
|
70
81
|
};
|
|
71
82
|
exports.Editor = Editor;
|
|
@@ -10,6 +10,7 @@ const CodeEditor_1 = require("../../components/CodeEditor/CodeEditor");
|
|
|
10
10
|
const PagePropsForm_1 = require("../../components/PagePropsForm/PagePropsForm");
|
|
11
11
|
const useFormSpec_1 = tslib_1.__importDefault(require("../../hooks/useFormSpec"));
|
|
12
12
|
const types_1 = require("../../types");
|
|
13
|
+
const hooks_1 = require("./hooks");
|
|
13
14
|
const b = (0, utils_1.block)('editor-form');
|
|
14
15
|
const tabsItems = Object.values(types_1.FormTab).map((tab) => ({
|
|
15
16
|
id: tab,
|
|
@@ -17,6 +18,7 @@ const tabsItems = Object.values(types_1.FormTab).map((tab) => ({
|
|
|
17
18
|
}));
|
|
18
19
|
exports.Form = (0, react_1.memo)(({ content, onChange, activeBlockIndex, onSelect, schema, codeValidator, activeTab, onActiveTabUpdate, codeFullscreeModeOn, onCodeFullscreeModeOnUpdate, }) => {
|
|
19
20
|
const _a = content || {}, { blocks } = _a, page = tslib_1.__rest(_a, ["blocks"]);
|
|
21
|
+
const code = (0, hooks_1.useCode)({ activeTab, content, codeFullscreeModeOn });
|
|
20
22
|
const spec = (0, useFormSpec_1.default)(schema);
|
|
21
23
|
const { blocks: blocksSpec, page: pageSpec } = spec || {};
|
|
22
24
|
let form;
|
|
@@ -39,7 +41,7 @@ exports.Form = (0, react_1.memo)(({ content, onChange, activeBlockIndex, onSelec
|
|
|
39
41
|
break;
|
|
40
42
|
}
|
|
41
43
|
case types_1.FormTab.Code: {
|
|
42
|
-
form = (react_1.default.createElement(CodeEditor_1.CodeEditor, {
|
|
44
|
+
form = (react_1.default.createElement(CodeEditor_1.CodeEditor, { code: code, onChange: onChange, validator: codeValidator, fullscreenModeOn: codeFullscreeModeOn, onFullscreenModeOnUpdate: onCodeFullscreeModeOnUpdate }));
|
|
43
45
|
break;
|
|
44
46
|
}
|
|
45
47
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FormProps } from './Form';
|
|
2
|
+
/**
|
|
3
|
+
* Transorms PageConstructor content in JSON to YAML on code editor mode switching
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} props - props parent from form
|
|
6
|
+
* @returns {string} - updated code
|
|
7
|
+
*/
|
|
8
|
+
export declare function useCode({ activeTab, content, codeFullscreeModeOn, }: Pick<FormProps, 'activeTab' | 'content' | 'codeFullscreeModeOn'>): string;
|