@gravity-ui/dynamic-forms 5.29.1 → 5.30.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 (29) hide show
  1. package/build/cjs/lib/unstable/kit/components/EntityContainer/EntityContainer.d.ts +1 -0
  2. package/build/cjs/lib/unstable/kit/entities/FewOfNested/FewOfNested.d.ts +1 -0
  3. package/build/cjs/lib/unstable/kit/entities/FewOfNested/FewOfNested.js +8 -3
  4. package/build/cjs/lib/unstable/kit/entities/OneOfNested/OneOfNested.d.ts +1 -0
  5. package/build/cjs/lib/unstable/kit/entities/OneOfNested/OneOfNested.js +8 -3
  6. package/build/cjs/lib/unstable/kit/form-entities/SegmentedRadioGroupInput/SegmentedRadioGroupInput.css +9 -4
  7. package/build/cjs/lib/unstable/kit/form-entities/SegmentedRadioGroupInput/SegmentedRadioGroupInput.js +14 -15
  8. package/build/cjs/lib/unstable/kit/form-layouts/FormColumn/FormColumn.js +1 -1
  9. package/build/cjs/lib/unstable/kit/form-layouts/FormRow/FormRow.js +1 -1
  10. package/build/cjs/lib/unstable/kit/layouts/Accordeon/Accordeon.js +1 -1
  11. package/build/cjs/lib/unstable/kit/layouts/Card/Card.js +1 -1
  12. package/build/cjs/lib/unstable/kit/layouts/Section/Section.js +1 -1
  13. package/build/cjs/lib/unstable/kit/utils/transformer.d.ts +6 -2
  14. package/build/cjs/lib/unstable/kit/utils/transformer.js +103 -72
  15. package/build/esm/lib/unstable/kit/components/EntityContainer/EntityContainer.d.ts +1 -0
  16. package/build/esm/lib/unstable/kit/entities/FewOfNested/FewOfNested.d.ts +1 -0
  17. package/build/esm/lib/unstable/kit/entities/FewOfNested/FewOfNested.js +8 -3
  18. package/build/esm/lib/unstable/kit/entities/OneOfNested/OneOfNested.d.ts +1 -0
  19. package/build/esm/lib/unstable/kit/entities/OneOfNested/OneOfNested.js +8 -3
  20. package/build/esm/lib/unstable/kit/form-entities/SegmentedRadioGroupInput/SegmentedRadioGroupInput.css +9 -4
  21. package/build/esm/lib/unstable/kit/form-entities/SegmentedRadioGroupInput/SegmentedRadioGroupInput.js +14 -15
  22. package/build/esm/lib/unstable/kit/form-layouts/FormColumn/FormColumn.js +1 -1
  23. package/build/esm/lib/unstable/kit/form-layouts/FormRow/FormRow.js +1 -1
  24. package/build/esm/lib/unstable/kit/layouts/Accordeon/Accordeon.js +1 -1
  25. package/build/esm/lib/unstable/kit/layouts/Card/Card.js +1 -1
  26. package/build/esm/lib/unstable/kit/layouts/Section/Section.js +1 -1
  27. package/build/esm/lib/unstable/kit/utils/transformer.d.ts +6 -2
  28. package/build/esm/lib/unstable/kit/utils/transformer.js +103 -72
  29. package/package.json +1 -1
@@ -9,12 +9,14 @@ const core_1 = require("../../../core");
9
9
  const core_2 = require("../../core");
10
10
  const viewSpecRules = {
11
11
  disabled: (spec, mutableSchema) => {
12
- if (spec.viewSpec.disabled) {
12
+ var _a;
13
+ if ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.disabled) {
13
14
  (0, set_1.default)(mutableSchema, 'nodeParameters.flags.disabled', true);
14
15
  }
15
16
  },
16
17
  layout: (spec, mutableSchema) => {
17
- const layout = spec.viewSpec.layout;
18
+ var _a;
19
+ const layout = (_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.layout;
18
20
  if (!layout) {
19
21
  return;
20
22
  }
@@ -59,35 +61,38 @@ const viewSpecRules = {
59
61
  }
60
62
  },
61
63
  layoutTitle: (spec, mutableSchema) => {
62
- if (spec.viewSpec.layoutTitle) {
64
+ var _a;
65
+ if ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.layoutTitle) {
63
66
  (0, set_1.default)(mutableSchema, 'title', spec.viewSpec.layoutTitle);
64
67
  }
65
68
  },
66
69
  layoutDescription: (spec, mutableSchema) => {
67
- if (spec.viewSpec.layoutDescription) {
70
+ var _a;
71
+ if ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.layoutDescription) {
68
72
  (0, set_1.default)(mutableSchema, 'description', spec.viewSpec.layoutDescription);
69
73
  }
70
74
  },
71
75
  layoutOpen: (spec, mutableSchema) => {
72
- if (spec.viewSpec.layoutOpen !== undefined) {
76
+ var _a;
77
+ if (((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.layoutOpen) !== undefined) {
73
78
  (0, set_1.default)(mutableSchema, 'nodeParameters.flags.open', spec.viewSpec.layoutOpen);
74
79
  }
75
80
  },
76
81
  itemLabel: (spec, mutableSchema) => {
77
- if ('itemLabel' in spec.viewSpec && spec.viewSpec.itemLabel) {
82
+ if ((spec === null || spec === void 0 ? void 0 : spec.viewSpec) && 'itemLabel' in spec.viewSpec && spec.viewSpec.itemLabel) {
78
83
  (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.addButtonText', spec.viewSpec.itemLabel);
79
84
  }
80
85
  },
81
86
  itemPrefix: (spec, mutableSchema) => {
82
- if ('itemPrefix' in spec.viewSpec && spec.viewSpec.itemPrefix) {
87
+ if ((spec === null || spec === void 0 ? void 0 : spec.viewSpec) && 'itemPrefix' in spec.viewSpec && spec.viewSpec.itemPrefix) {
83
88
  (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.itemPrefix', spec.viewSpec.itemPrefix);
84
89
  }
85
90
  },
86
91
  table: (spec, mutableSchema) => {
87
- var _a;
88
- if (spec.type === core_1.SpecTypes.Array &&
89
- spec.viewSpec.table &&
90
- ((_a = spec.items) === null || _a === void 0 ? void 0 : _a.type) === core_1.SpecTypes.Object) {
92
+ var _a, _b;
93
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.Array &&
94
+ ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.table) &&
95
+ ((_b = spec === null || spec === void 0 ? void 0 : spec.items) === null || _b === void 0 ? void 0 : _b.type) === core_1.SpecTypes.Object) {
91
96
  const order = [];
92
97
  spec.viewSpec.table.forEach(({ description, label, property }) => {
93
98
  order.push(property);
@@ -102,32 +107,39 @@ const viewSpecRules = {
102
107
  }
103
108
  },
104
109
  link: (spec, mutableSchema) => {
105
- if (spec.viewSpec.link) {
110
+ var _a;
111
+ if ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.link) {
106
112
  (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.link', spec.viewSpec.link);
107
113
  }
108
114
  },
109
115
  placeholder: (spec, mutableSchema) => {
110
- if ('placeholder' in spec.viewSpec && spec.viewSpec.placeholder) {
116
+ if ((spec === null || spec === void 0 ? void 0 : spec.viewSpec) && 'placeholder' in spec.viewSpec && spec.viewSpec.placeholder) {
111
117
  if (spec.type === core_1.SpecTypes.String) {
112
118
  (0, set_1.default)(mutableSchema, 'examples', [spec.viewSpec.placeholder]);
113
119
  }
114
120
  else if (spec.type === core_1.SpecTypes.Array) {
115
121
  (0, set_1.default)(mutableSchema, 'examples', [[spec.viewSpec.placeholder]]);
116
122
  }
123
+ else {
124
+ (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.placeholder', spec.viewSpec.placeholder);
125
+ }
117
126
  }
118
127
  },
119
128
  addButtonPosition: (spec, mutableSchema) => {
120
- if ('addButtonPosition' in spec.viewSpec && spec.viewSpec.addButtonPosition) {
129
+ if ((spec === null || spec === void 0 ? void 0 : spec.viewSpec) &&
130
+ 'addButtonPosition' in spec.viewSpec &&
131
+ spec.viewSpec.addButtonPosition) {
121
132
  (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.addButtonPosition', spec.viewSpec.addButtonPosition);
122
133
  }
123
134
  },
124
135
  hidden: (spec, mutableSchema) => {
125
- if (spec.viewSpec.hidden) {
136
+ var _a;
137
+ if ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.hidden) {
126
138
  (0, set_1.default)(mutableSchema, 'nodeParameters.flags.hidden', true);
127
139
  }
128
140
  },
129
141
  selectParams: (spec, mutableSchema) => {
130
- if ('selectParams' in spec.viewSpec && spec.viewSpec.selectParams) {
142
+ if ((spec === null || spec === void 0 ? void 0 : spec.viewSpec) && 'selectParams' in spec.viewSpec && spec.viewSpec.selectParams) {
131
143
  if (spec.viewSpec.selectParams.filterPlaceholder) {
132
144
  (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.filterPlaceholder', spec.viewSpec.selectParams.filterPlaceholder);
133
145
  }
@@ -137,7 +149,8 @@ const viewSpecRules = {
137
149
  }
138
150
  },
139
151
  checkboxGroupParams: (spec, mutableSchema) => {
140
- if (spec.type === core_1.SpecTypes.Array && spec.viewSpec.checkboxGroupParams) {
152
+ var _a;
153
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.Array && ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.checkboxGroupParams)) {
141
154
  if (spec.viewSpec.checkboxGroupParams.placement) {
142
155
  (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.direction', spec.viewSpec.checkboxGroupParams.placement === 'vertical' ? 'column' : 'row');
143
156
  }
@@ -147,31 +160,35 @@ const viewSpecRules = {
147
160
  }
148
161
  },
149
162
  viewColor: (spec, mutableSchema) => {
150
- if (spec.type === core_1.SpecTypes.Boolean && spec.viewSpec.viewColor) {
163
+ var _a;
164
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.Boolean && ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.viewColor)) {
151
165
  (0, set_1.default)(mutableSchema, 'nodeParameters.overviewEntityProps.viewColor', spec.viewSpec.viewColor);
152
166
  }
153
167
  },
154
168
  copy: (spec, mutableSchema) => {
155
- if ('copy' in spec.viewSpec && spec.viewSpec.copy) {
169
+ if ((spec === null || spec === void 0 ? void 0 : spec.viewSpec) && 'copy' in spec.viewSpec && spec.viewSpec.copy) {
156
170
  (0, set_1.default)(mutableSchema, 'nodeParameters.flags.copy', true);
157
171
  }
158
172
  },
159
173
  order: (spec, mutableSchema) => {
160
- if (spec.type === core_1.SpecTypes.Object &&
161
- spec.viewSpec.order &&
174
+ var _a;
175
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.Object &&
176
+ ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.order) &&
162
177
  Object.keys(spec.viewSpec.order).length) {
163
178
  (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.order', spec.viewSpec.order);
164
179
  }
165
180
  },
166
181
  delimiter: (spec, mutableSchema) => {
167
- if (spec.type === core_1.SpecTypes.Object &&
168
- spec.viewSpec.delimiter &&
182
+ var _a;
183
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.Object &&
184
+ ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.delimiter) &&
169
185
  Object.keys(spec.viewSpec.delimiter).length) {
170
186
  (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.delimiter', spec.viewSpec.delimiter);
171
187
  }
172
188
  },
173
189
  sizeParams: (spec, mutableSchema) => {
174
- if (spec.type === core_1.SpecTypes.String && spec.viewSpec.sizeParams) {
190
+ var _a;
191
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.String && ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.sizeParams)) {
175
192
  if (spec.viewSpec.sizeParams.defaultType) {
176
193
  (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.defaultType', spec.viewSpec.sizeParams.defaultType);
177
194
  }
@@ -184,7 +201,8 @@ const viewSpecRules = {
184
201
  }
185
202
  },
186
203
  monacoParams: (spec, mutableSchema) => {
187
- if (spec.type === core_1.SpecTypes.String && spec.viewSpec.monacoParams) {
204
+ var _a;
205
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.String && ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.monacoParams)) {
188
206
  if (spec.viewSpec.monacoParams.language) {
189
207
  (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.language', spec.viewSpec.monacoParams.language);
190
208
  }
@@ -194,12 +212,14 @@ const viewSpecRules = {
194
212
  }
195
213
  },
196
214
  hideValues: (spec, mutableSchema) => {
197
- if (spec.type === core_1.SpecTypes.String && spec.viewSpec.hideValues) {
215
+ var _a;
216
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.String && ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.hideValues)) {
198
217
  (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.hideValues', spec.viewSpec.hideValues);
199
218
  }
200
219
  },
201
220
  textContentParams: (spec, mutableSchema) => {
202
- if (spec.type !== core_1.SpecTypes.String || !spec.viewSpec.textContentParams) {
221
+ var _a;
222
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) !== core_1.SpecTypes.String || !((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.textContentParams)) {
203
223
  return;
204
224
  }
205
225
  const textContentParams = spec.viewSpec.textContentParams;
@@ -232,7 +252,8 @@ const viewSpecRules = {
232
252
  }
233
253
  },
234
254
  fileInput: (spec, mutableSchema) => {
235
- if (spec.type === core_1.SpecTypes.String && spec.viewSpec.fileInput) {
255
+ var _a;
256
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.String && ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.fileInput)) {
236
257
  if (spec.viewSpec.fileInput.accept) {
237
258
  (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.accept', [
238
259
  spec.viewSpec.fileInput.accept,
@@ -244,7 +265,8 @@ const viewSpecRules = {
244
265
  }
245
266
  },
246
267
  dateInput: (spec, mutableSchema) => {
247
- if (spec.type === core_1.SpecTypes.String && spec.viewSpec.dateInput) {
268
+ var _a;
269
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.String && ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.dateInput)) {
248
270
  if (spec.viewSpec.dateInput.outputFormat) {
249
271
  (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.outputFormat', spec.viewSpec.dateInput.outputFormat);
250
272
  }
@@ -257,7 +279,8 @@ const viewSpecRules = {
257
279
  }
258
280
  },
259
281
  radioGroupParams: (spec, mutableSchema) => {
260
- if (spec.type === core_1.SpecTypes.String && spec.viewSpec.radioGroupParams) {
282
+ var _a;
283
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.String && ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.radioGroupParams)) {
261
284
  if (spec.viewSpec.radioGroupParams.direction) {
262
285
  (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.direction', spec.viewSpec.radioGroupParams.direction);
263
286
  }
@@ -267,19 +290,22 @@ const viewSpecRules = {
267
290
  }
268
291
  },
269
292
  generateRandomValueButton: (spec, mutableSchema) => {
270
- if (spec.type === core_1.SpecTypes.String && spec.viewSpec.generateRandomValueButton) {
293
+ var _a;
294
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.String && ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.generateRandomValueButton)) {
271
295
  (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.generateRandomValueButton', true);
272
296
  }
273
297
  },
274
298
  inputProps: (spec, mutableSchema) => {
275
- if (spec.viewSpec.inputProps) {
299
+ var _a;
300
+ if ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.inputProps) {
276
301
  Object.entries(spec.viewSpec.inputProps).forEach(([key, value]) => {
277
302
  (0, set_1.default)(mutableSchema, `nodeParameters.entityProps.${key}`, value);
278
303
  });
279
304
  }
280
305
  },
281
306
  layoutProps: (spec, mutableSchema) => {
282
- if (spec.viewSpec.layoutProps) {
307
+ var _a;
308
+ if ((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.layoutProps) {
283
309
  Object.entries(spec.viewSpec.layoutProps).forEach(([key, value]) => {
284
310
  (0, set_1.default)(mutableSchema, `nodeParameters.layoutProps.${key}`, value);
285
311
  });
@@ -287,7 +313,8 @@ const viewSpecRules = {
287
313
  },
288
314
  // eslint-disable-next-line complexity -- old viewSpec.type mapping, isolated per viewType
289
315
  type: (spec, mutableSchema) => {
290
- if (spec.viewSpec.type === 'oneof') {
316
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
317
+ if (((_a = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _a === void 0 ? void 0 : _a.type) === 'oneof') {
291
318
  (0, set_1.default)(mutableSchema, 'nodeParameters.entity', 'one_of_nested');
292
319
  if (spec.type === core_1.SpecTypes.Object) {
293
320
  const { toggler, booleanMap } = spec.viewSpec.oneOfParams || {};
@@ -333,7 +360,7 @@ const viewSpecRules = {
333
360
  }
334
361
  }
335
362
  }
336
- else if (spec.viewSpec.type === 'oneof_flat') {
363
+ else if (((_b = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _b === void 0 ? void 0 : _b.type) === 'oneof_flat') {
337
364
  (0, set_1.default)(mutableSchema, 'nodeParameters.entity', 'one_of_nested');
338
365
  if (spec.type === core_1.SpecTypes.Object) {
339
366
  const { toggler, booleanMap } = spec.viewSpec.oneOfParams || {};
@@ -378,7 +405,7 @@ const viewSpecRules = {
378
405
  }
379
406
  }
380
407
  }
381
- else if (spec.viewSpec.type === 'card_oneof') {
408
+ else if (((_c = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _c === void 0 ? void 0 : _c.type) === 'card_oneof') {
382
409
  (0, set_1.default)(mutableSchema, 'nodeParameters.entity', 'one_of_nested');
383
410
  if (spec.type === core_1.SpecTypes.Object) {
384
411
  const { toggler, booleanMap } = spec.viewSpec.oneOfParams || {};
@@ -423,7 +450,7 @@ const viewSpecRules = {
423
450
  }
424
451
  }
425
452
  }
426
- else if (spec.viewSpec.type === 'multi_oneof') {
453
+ else if (((_d = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _d === void 0 ? void 0 : _d.type) === 'multi_oneof') {
427
454
  (0, set_1.default)(mutableSchema, 'nodeParameters.entity', 'few_of_nested');
428
455
  if (spec.type === core_1.SpecTypes.Object) {
429
456
  const { toggler } = spec.viewSpec.oneOfParams || {};
@@ -459,7 +486,7 @@ const viewSpecRules = {
459
486
  (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.toggler.items.enum', spec.viewSpec.order || Object.keys(spec.properties || {}));
460
487
  }
461
488
  }
462
- else if (spec.viewSpec.type === 'multi_oneof_flat') {
489
+ else if (((_e = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _e === void 0 ? void 0 : _e.type) === 'multi_oneof_flat') {
463
490
  (0, set_1.default)(mutableSchema, 'nodeParameters.entity', 'few_of_nested');
464
491
  if (spec.type === core_1.SpecTypes.Object) {
465
492
  const { toggler } = spec.viewSpec.oneOfParams || {};
@@ -494,10 +521,10 @@ const viewSpecRules = {
494
521
  (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.toggler.items.enum', spec.viewSpec.order || Object.keys(spec.properties || {}));
495
522
  }
496
523
  }
497
- else if (spec.viewSpec.type === 'object_value') {
524
+ else if (((_f = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _f === void 0 ? void 0 : _f.type) === 'object_value') {
498
525
  (0, set_1.default)(mutableSchema, 'nodeParameters.entity', 'dot_value');
499
526
  }
500
- else if (spec.viewSpec.type === 'text_content') {
527
+ else if (((_g = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _g === void 0 ? void 0 : _g.type) === 'text_content') {
501
528
  const textContentParams = spec.type === core_1.SpecTypes.String ? spec.viewSpec.textContentParams : undefined;
502
529
  if (textContentParams === null || textContentParams === void 0 ? void 0 : textContentParams.themeAlert) {
503
530
  (0, set_1.default)(mutableSchema, 'nodeParameters.entity', 'alert');
@@ -509,31 +536,31 @@ const viewSpecRules = {
509
536
  (0, set_1.default)(mutableSchema, 'nodeParameters.entity', 'text_content');
510
537
  }
511
538
  }
512
- else if (spec.viewSpec.type === 'date_input') {
539
+ else if (((_h = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _h === void 0 ? void 0 : _h.type) === 'date_input') {
513
540
  (0, set_1.default)(mutableSchema, 'type', undefined);
514
541
  (0, set_1.default)(mutableSchema, 'nodeParameters.entity', 'date');
515
542
  (0, set_1.default)(mutableSchema, 'nodeParameters.type', core_2.NodeType.Any);
516
543
  }
517
- else if (spec.viewSpec.type === 'file_input') {
544
+ else if (((_j = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _j === void 0 ? void 0 : _j.type) === 'file_input') {
518
545
  (0, set_1.default)(mutableSchema, 'nodeParameters.entity', 'file');
519
546
  }
520
- else if (spec.viewSpec.type === 'monaco_input') {
547
+ else if (((_k = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _k === void 0 ? void 0 : _k.type) === 'monaco_input') {
521
548
  (0, set_1.default)(mutableSchema, 'nodeParameters.entity', 'monaco_input');
522
549
  }
523
- else if (spec.viewSpec.type === 'number_with_scale') {
550
+ else if (((_l = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _l === void 0 ? void 0 : _l.type) === 'number_with_scale') {
524
551
  (0, set_1.default)(mutableSchema, 'nodeParameters.entity', 'string_number_with_scale');
525
552
  }
526
- else if (spec.viewSpec.type === 'range_input_picker') {
553
+ else if (((_m = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _m === void 0 ? void 0 : _m.type) === 'range_input_picker') {
527
554
  (0, set_1.default)(mutableSchema, 'nodeParameters.entity', spec.type === core_1.SpecTypes.Number ? 'slider' : 'range_input');
528
555
  }
529
556
  else {
530
- (0, set_1.default)(mutableSchema, 'nodeParameters.entity', spec.viewSpec.type);
557
+ (0, set_1.default)(mutableSchema, 'nodeParameters.entity', (_o = spec === null || spec === void 0 ? void 0 : spec.viewSpec) === null || _o === void 0 ? void 0 : _o.type);
531
558
  }
532
559
  },
533
560
  };
534
561
  const specRules = {
535
562
  defaultValue: (spec, mutableSchema) => {
536
- if (spec.defaultValue !== undefined) {
563
+ if ((spec === null || spec === void 0 ? void 0 : spec.defaultValue) !== undefined) {
537
564
  (0, set_1.default)(mutableSchema, 'default', spec.defaultValue);
538
565
  }
539
566
  },
@@ -552,13 +579,13 @@ const specRules = {
552
579
  [core_1.SpecTypes.Object]: core_2.NodeType.Object,
553
580
  [core_1.SpecTypes.String]: core_2.NodeType.String,
554
581
  };
555
- if (spec.type) {
582
+ if (spec === null || spec === void 0 ? void 0 : spec.type) {
556
583
  (0, set_1.default)(mutableSchema, 'type', specTypeToJsonSchemaType[spec.type]);
557
584
  (0, set_1.default)(mutableSchema, 'nodeParameters.type', specTypeToNodeType[spec.type]);
558
585
  }
559
586
  },
560
587
  required: (spec, mutableSchema, _rules, errorMessages) => {
561
- if (spec.required) {
588
+ if (spec === null || spec === void 0 ? void 0 : spec.required) {
562
589
  (0, set_1.default)(mutableSchema, 'allOf', [
563
590
  ...(mutableSchema.allOf || []),
564
591
  {
@@ -572,13 +599,13 @@ const specRules = {
572
599
  }
573
600
  },
574
601
  maxLength: (spec, mutableSchema) => {
575
- if (spec.type === core_1.SpecTypes.Array && spec.maxLength !== undefined) {
602
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.Array && (spec === null || spec === void 0 ? void 0 : spec.maxLength) !== undefined) {
576
603
  const maxItems = Number(spec.maxLength);
577
604
  if (!Number.isNaN(maxItems)) {
578
605
  (0, set_1.default)(mutableSchema, 'maxItems', maxItems);
579
606
  }
580
607
  }
581
- if (spec.type === core_1.SpecTypes.String && spec.maxLength !== undefined) {
608
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.String && (spec === null || spec === void 0 ? void 0 : spec.maxLength) !== undefined) {
582
609
  const maxLength = Number(spec.maxLength);
583
610
  if (!Number.isNaN(maxLength)) {
584
611
  (0, set_1.default)(mutableSchema, 'maxLength', maxLength);
@@ -586,13 +613,13 @@ const specRules = {
586
613
  }
587
614
  },
588
615
  minLength: (spec, mutableSchema) => {
589
- if (spec.type === core_1.SpecTypes.Array && spec.minLength !== undefined) {
616
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.Array && (spec === null || spec === void 0 ? void 0 : spec.minLength) !== undefined) {
590
617
  const minItems = Number(spec.minLength);
591
618
  if (!Number.isNaN(minItems)) {
592
619
  (0, set_1.default)(mutableSchema, 'minItems', minItems);
593
620
  }
594
621
  }
595
- if (spec.type === core_1.SpecTypes.String && spec.minLength !== undefined) {
622
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.String && (spec === null || spec === void 0 ? void 0 : spec.minLength) !== undefined) {
596
623
  const minLength = Number(spec.minLength);
597
624
  if (!Number.isNaN(minLength)) {
598
625
  (0, set_1.default)(mutableSchema, 'minLength', minLength);
@@ -600,7 +627,7 @@ const specRules = {
600
627
  }
601
628
  },
602
629
  items: (spec, mutableSchema, rules, errorMessages) => {
603
- if (spec.type === core_1.SpecTypes.Array && spec.items) {
630
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.Array && (spec === null || spec === void 0 ? void 0 : spec.items)) {
604
631
  const childSchema = specToJsonSchema(spec.items, 'items' in mutableSchema &&
605
632
  mutableSchema.items &&
606
633
  !Array.isArray(mutableSchema.items)
@@ -610,35 +637,36 @@ const specRules = {
610
637
  },
611
638
  enum: (spec, mutableSchema) => {
612
639
  var _a, _b, _c, _d;
613
- if (spec.type === core_1.SpecTypes.Array &&
640
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.Array &&
614
641
  ((_a = spec.enum) === null || _a === void 0 ? void 0 : _a.length) &&
615
642
  (((_b = spec.items) === null || _b === void 0 ? void 0 : _b.type) === core_1.SpecTypes.String || !((_c = spec.items) === null || _c === void 0 ? void 0 : _c.type))) {
616
643
  (0, set_1.default)(mutableSchema, 'items.enum', spec.enum);
617
644
  }
618
- if (spec.type === core_1.SpecTypes.String && ((_d = spec.enum) === null || _d === void 0 ? void 0 : _d.length)) {
645
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.String && ((_d = spec === null || spec === void 0 ? void 0 : spec.enum) === null || _d === void 0 ? void 0 : _d.length)) {
619
646
  (0, set_1.default)(mutableSchema, 'enum', spec.enum);
620
647
  }
621
648
  },
622
649
  description: (spec, mutableSchema) => {
623
- if ('description' in spec &&
650
+ if (spec &&
651
+ 'description' in spec &&
624
652
  (0, isObject_1.default)(spec.description) &&
625
653
  Object.keys(spec.description).length) {
626
654
  (0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.enumDescriptions', spec.description);
627
655
  }
628
656
  },
629
657
  validator: (spec, mutableSchema) => {
630
- if (spec.validator && spec.validator !== 'base') {
658
+ if ((spec === null || spec === void 0 ? void 0 : spec.validator) && (spec === null || spec === void 0 ? void 0 : spec.validator) !== 'base') {
631
659
  (0, set_1.default)(mutableSchema, 'nodeParameters.validator', spec.validator);
632
660
  }
633
661
  },
634
662
  maximum: (spec, mutableSchema) => {
635
- if (spec.type === core_1.SpecTypes.Number && spec.maximum !== undefined) {
663
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.Number && (spec === null || spec === void 0 ? void 0 : spec.maximum) !== undefined) {
636
664
  const maximum = Number(spec.maximum);
637
665
  if (!Number.isNaN(maximum)) {
638
666
  (0, set_1.default)(mutableSchema, 'maximum', maximum);
639
667
  }
640
668
  }
641
- if (spec.type === core_1.SpecTypes.String && 'maximum' in spec && spec.maximum !== undefined) {
669
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.String && 'maximum' in spec && (spec === null || spec === void 0 ? void 0 : spec.maximum) !== undefined) {
642
670
  const maximum = Number(spec.maximum);
643
671
  if (!Number.isNaN(maximum)) {
644
672
  (0, set_1.default)(mutableSchema, 'stringNumber.maximum', `${spec.maximum}`);
@@ -646,13 +674,13 @@ const specRules = {
646
674
  }
647
675
  },
648
676
  minimum: (spec, mutableSchema) => {
649
- if (spec.type === core_1.SpecTypes.Number && spec.minimum !== undefined) {
677
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.Number && spec.minimum !== undefined) {
650
678
  const minimum = Number(spec.minimum);
651
679
  if (!Number.isNaN(minimum)) {
652
680
  (0, set_1.default)(mutableSchema, 'minimum', minimum);
653
681
  }
654
682
  }
655
- if (spec.type === core_1.SpecTypes.String && 'minimum' in spec && spec.minimum !== undefined) {
683
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.String && 'minimum' in spec && (spec === null || spec === void 0 ? void 0 : spec.minimum) !== undefined) {
656
684
  const minimum = Number(spec.minimum);
657
685
  if (!Number.isNaN(minimum)) {
658
686
  (0, set_1.default)(mutableSchema, 'stringNumber.minimum', `${spec.minimum}`);
@@ -660,21 +688,22 @@ const specRules = {
660
688
  }
661
689
  },
662
690
  format: (spec, mutableSchema) => {
663
- if (spec.type === core_1.SpecTypes.Number && spec.format === 'int64') {
691
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.Number && spec.format === 'int64') {
664
692
  (0, set_1.default)(mutableSchema, 'type', core_2.JsonSchemaType.Integer);
665
693
  }
666
694
  },
667
695
  properties: (spec, mutableSchema, rules, errorMessages) => {
668
- if (spec.type === core_1.SpecTypes.Object && spec.properties) {
696
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.Object && spec.properties) {
669
697
  Object.entries(spec.properties).forEach(([key, childSpec]) => {
698
+ var _a, _b, _c, _d, _e;
670
699
  const childSchema = specToJsonSchema(childSpec, Object.assign({}, ((0, get_1.default)(mutableSchema, ['properties', key]) || {})), rules, errorMessages);
671
700
  (0, set_1.default)(mutableSchema, ['properties', key], childSchema);
672
701
  if (childSpec.required &&
673
- !(spec.viewSpec.type === 'oneof' ||
674
- spec.viewSpec.type === 'oneof_flat' ||
675
- spec.viewSpec.type === 'card_oneof' ||
676
- spec.viewSpec.type === 'multi_oneof' ||
677
- spec.viewSpec.type === 'multi_oneof_flat')) {
702
+ !(((_a = spec.viewSpec) === null || _a === void 0 ? void 0 : _a.type) === 'oneof' ||
703
+ ((_b = spec.viewSpec) === null || _b === void 0 ? void 0 : _b.type) === 'oneof_flat' ||
704
+ ((_c = spec.viewSpec) === null || _c === void 0 ? void 0 : _c.type) === 'card_oneof' ||
705
+ ((_d = spec.viewSpec) === null || _d === void 0 ? void 0 : _d.type) === 'multi_oneof' ||
706
+ ((_e = spec.viewSpec) === null || _e === void 0 ? void 0 : _e.type) === 'multi_oneof_flat')) {
678
707
  (0, set_1.default)(mutableSchema, ['required'], [...((0, get_1.default)(mutableSchema, 'required') || []), key]);
679
708
  (0, set_1.default)(mutableSchema, 'nodeParameters.errorMessages.required', errorMessages.required);
680
709
  }
@@ -682,12 +711,12 @@ const specRules = {
682
711
  }
683
712
  },
684
713
  pattern: (spec, mutableSchema) => {
685
- if (spec.type === core_1.SpecTypes.String && spec.pattern) {
714
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.String && spec.pattern) {
686
715
  (0, set_1.default)(mutableSchema, 'pattern', spec.pattern);
687
716
  }
688
717
  },
689
718
  patternError: (spec, mutableSchema) => {
690
- if (spec.type === core_1.SpecTypes.String && spec.patternError) {
719
+ if ((spec === null || spec === void 0 ? void 0 : spec.type) === core_1.SpecTypes.String && (spec === null || spec === void 0 ? void 0 : spec.patternError)) {
691
720
  (0, set_1.default)(mutableSchema, 'nodeParameters.errorMessages.pattern', spec.patternError);
692
721
  }
693
722
  },
@@ -698,6 +727,8 @@ const specRules = {
698
727
  function specToJsonSchema(spec, mutableSchema = {}, rules, errorMessages = {}) {
699
728
  const mergedSpecRules = Object.assign(Object.assign({}, specRules), rules === null || rules === void 0 ? void 0 : rules.specRules);
700
729
  const mergedViewSpecRules = Object.assign(Object.assign({}, viewSpecRules), rules === null || rules === void 0 ? void 0 : rules.viewSpecRules);
701
- Object.values(mergedSpecRules).forEach((rule) => rule(spec, mutableSchema, { specRules: mergedSpecRules, viewSpecRules: mergedViewSpecRules }, errorMessages));
730
+ if (spec) {
731
+ Object.values(mergedSpecRules).forEach((rule) => rule(spec, mutableSchema, { specRules: mergedSpecRules, viewSpecRules: mergedViewSpecRules }, errorMessages));
732
+ }
702
733
  return mutableSchema;
703
734
  }
@@ -4,6 +4,7 @@ import './EntityContainer.css';
4
4
  export interface EntityContainerProps extends FlexProps {
5
5
  children: React.ReactNode;
6
6
  fill?: 'populated' | 'empty' | 'by-child';
7
+ ref?: React.ComponentPropsWithRef<'div'>['ref'];
7
8
  stretch: 'max' | 'fit' | 'by-child';
8
9
  }
9
10
  export declare const EntityContainer: React.FC<EntityContainerProps>;
@@ -4,5 +4,6 @@ export interface FewOfNestedProps {
4
4
  toggler: JsonSchema;
5
5
  withIndent?: boolean;
6
6
  togglerArrayRemoveButton?: boolean;
7
+ order?: string[];
7
8
  }
8
9
  export declare const FewOfNested: NodeEntity<JsonSchemaObject, FewOfNestedProps>;
@@ -7,7 +7,7 @@ import './FewOfNested.css';
7
7
  const b = block('few-of-nested');
8
8
  export const FewOfNested = ({ Layout, headName, input, layoutProps, meta, mode, props, schema, schemaPath, }) => {
9
9
  const { name, value } = input;
10
- const { togglerArrayRemoveButton = false, toggler: togglerSchema = {}, withIndent = false, } = props;
10
+ const { togglerArrayRemoveButton = false, toggler: togglerSchema = {}, withIndent = false, order, } = props;
11
11
  const overviewFlag = mode === SchemaRendererMode.Overview;
12
12
  const srState = useSchemaRendererState({
13
13
  headName,
@@ -17,8 +17,13 @@ export const FewOfNested = ({ Layout, headName, input, layoutProps, meta, mode,
17
17
  if (value && Object.keys(value).length) {
18
18
  return Object.keys(value);
19
19
  }
20
- if (!overviewFlag && schema.properties && Object.keys(schema.properties).length) {
21
- return [Object.keys(schema.properties)[0]];
20
+ if (!overviewFlag) {
21
+ if ((order === null || order === void 0 ? void 0 : order[0]) !== undefined) {
22
+ return [order[0]];
23
+ }
24
+ if (schema.properties && Object.keys(schema.properties).length) {
25
+ return [Object.keys(schema.properties)[0]];
26
+ }
22
27
  }
23
28
  return [];
24
29
  });
@@ -8,5 +8,6 @@ export interface OneOfNestedProps {
8
8
  };
9
9
  withIndent?: boolean;
10
10
  togglerArrayRemoveButton?: boolean;
11
+ order?: string[];
11
12
  }
12
13
  export declare const OneOfNested: NodeEntity<JsonSchemaObject, OneOfNestedProps>;
@@ -6,7 +6,7 @@ import './OneOfNested.css';
6
6
  const b = block('one-of-nested');
7
7
  export const OneOfNested = ({ Layout, headName, input, layoutProps, meta, mode, props, schema, schemaPath, }) => {
8
8
  const { name, value } = input;
9
- const { booleanToKey, togglerArrayRemoveButton = false, toggler: togglerSchema = {}, withIndent = false, } = props;
9
+ const { booleanToKey, togglerArrayRemoveButton = false, toggler: togglerSchema = {}, withIndent = false, order, } = props;
10
10
  const overviewFlag = mode === SchemaRendererMode.Overview;
11
11
  const srState = useSchemaRendererState({
12
12
  headName,
@@ -16,8 +16,13 @@ export const OneOfNested = ({ Layout, headName, input, layoutProps, meta, mode,
16
16
  if (value && Object.keys(value).length) {
17
17
  return Object.keys(value)[0];
18
18
  }
19
- if (!overviewFlag && schema.properties) {
20
- return Object.keys(schema.properties)[0];
19
+ if (!overviewFlag) {
20
+ if ((order === null || order === void 0 ? void 0 : order[0]) !== undefined) {
21
+ return order[0];
22
+ }
23
+ if (schema.properties) {
24
+ return Object.keys(schema.properties)[0];
25
+ }
21
26
  }
22
27
  return undefined;
23
28
  });
@@ -1,11 +1,16 @@
1
+ .sr-segmented-radio-group-input {
2
+ position: relative;
3
+ }
1
4
  .sr-segmented-radio-group-input_error .g-segmented-radio-group .g-segmented-radio-group__option_checked:hover::after {
2
5
  border: 1px solid var(--g-color-text-danger);
3
6
  }
4
7
  .sr-segmented-radio-group-input_error .g-segmented-radio-group .g-segmented-radio-group__option_checked::after {
5
8
  border: 1px solid var(--g-color-text-danger);
6
9
  }
7
- .sr-segmented-radio-group-input_overflowed {
8
- height: 0;
9
- opacity: 0;
10
- overflow: hidden;
10
+ .sr-segmented-radio-group-input__checker {
11
+ position: absolute;
12
+ left: 0;
13
+ top: 0;
14
+ width: max-content;
15
+ visibility: hidden;
11
16
  }