@gravity-ui/dynamic-forms 5.27.0 → 5.28.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.
- package/build/cjs/lib/unstable/core/SchemaRendererNode/SchemaRendererNode.js +8 -2
- package/build/cjs/lib/unstable/kit/utils/transformer.js +15 -9
- package/build/esm/lib/unstable/core/SchemaRendererNode/SchemaRendererNode.js +8 -2
- package/build/esm/lib/unstable/kit/utils/transformer.js +15 -9
- package/package.json +1 -1
|
@@ -120,10 +120,16 @@ const SchemaRendererNodeComponent = ({ headName, modeOverride, name, schemaOverr
|
|
|
120
120
|
return undefined;
|
|
121
121
|
}
|
|
122
122
|
const coercedCurrentValue = (0, utils_2.coerceToJsonSchemaType)(currentValue, schema === null || schema === void 0 ? void 0 : schema.type);
|
|
123
|
-
if (coercedCurrentValue !== undefined
|
|
123
|
+
if (coercedCurrentValue !== undefined) {
|
|
124
|
+
if (coercedCurrentValue === currentValue) {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
124
127
|
return { name, value: coercedCurrentValue };
|
|
125
128
|
}
|
|
126
|
-
if (defaultValue !== undefined
|
|
129
|
+
if (defaultValue !== undefined) {
|
|
130
|
+
if (defaultValue === currentValue) {
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
127
133
|
return { name, value: defaultValue };
|
|
128
134
|
}
|
|
129
135
|
return undefined;
|
|
@@ -157,12 +157,16 @@ const viewSpecRules = {
|
|
|
157
157
|
}
|
|
158
158
|
},
|
|
159
159
|
order: (spec, mutableSchema) => {
|
|
160
|
-
if (spec.type === core_1.SpecTypes.Object &&
|
|
160
|
+
if (spec.type === core_1.SpecTypes.Object &&
|
|
161
|
+
spec.viewSpec.order &&
|
|
162
|
+
Object.keys(spec.viewSpec.order).length) {
|
|
161
163
|
(0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.order', spec.viewSpec.order);
|
|
162
164
|
}
|
|
163
165
|
},
|
|
164
166
|
delimiter: (spec, mutableSchema) => {
|
|
165
|
-
if (spec.type === core_1.SpecTypes.Object &&
|
|
167
|
+
if (spec.type === core_1.SpecTypes.Object &&
|
|
168
|
+
spec.viewSpec.delimiter &&
|
|
169
|
+
Object.keys(spec.viewSpec.delimiter).length) {
|
|
166
170
|
(0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.delimiter', spec.viewSpec.delimiter);
|
|
167
171
|
}
|
|
168
172
|
},
|
|
@@ -307,7 +311,7 @@ const viewSpecRules = {
|
|
|
307
311
|
if (spec.description && Object.keys(spec.description).length) {
|
|
308
312
|
(0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', spec.description);
|
|
309
313
|
}
|
|
310
|
-
else if (spec.properties) {
|
|
314
|
+
else if (spec.properties && Object.keys(spec.properties).length) {
|
|
311
315
|
(0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', Object.fromEntries(Object.entries(spec.properties).map(([key, childSpec]) => [
|
|
312
316
|
key,
|
|
313
317
|
childSpec.viewSpec.layoutTitle || key,
|
|
@@ -352,7 +356,7 @@ const viewSpecRules = {
|
|
|
352
356
|
if (spec.description && Object.keys(spec.description).length) {
|
|
353
357
|
(0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', spec.description);
|
|
354
358
|
}
|
|
355
|
-
else if (spec.properties) {
|
|
359
|
+
else if (spec.properties && Object.keys(spec.properties).length) {
|
|
356
360
|
(0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', Object.fromEntries(Object.entries(spec.properties).map(([key, childSpec]) => [
|
|
357
361
|
key,
|
|
358
362
|
childSpec.viewSpec.layoutTitle || key,
|
|
@@ -397,7 +401,7 @@ const viewSpecRules = {
|
|
|
397
401
|
if (spec.description && Object.keys(spec.description).length) {
|
|
398
402
|
(0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', spec.description);
|
|
399
403
|
}
|
|
400
|
-
else if (spec.properties) {
|
|
404
|
+
else if (spec.properties && Object.keys(spec.properties).length) {
|
|
401
405
|
(0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', Object.fromEntries(Object.entries(spec.properties).map(([key, childSpec]) => [
|
|
402
406
|
key,
|
|
403
407
|
childSpec.viewSpec.layoutTitle || key,
|
|
@@ -443,7 +447,7 @@ const viewSpecRules = {
|
|
|
443
447
|
if (spec.description && Object.keys(spec.description).length) {
|
|
444
448
|
(0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', spec.description);
|
|
445
449
|
}
|
|
446
|
-
else if (spec.properties) {
|
|
450
|
+
else if (spec.properties && Object.keys(spec.properties).length) {
|
|
447
451
|
(0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', Object.fromEntries(Object.entries(spec.properties).map(([key, childSpec]) => [
|
|
448
452
|
key,
|
|
449
453
|
childSpec.viewSpec.layoutTitle || key,
|
|
@@ -478,7 +482,7 @@ const viewSpecRules = {
|
|
|
478
482
|
if (spec.description && Object.keys(spec.description).length) {
|
|
479
483
|
(0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', spec.description);
|
|
480
484
|
}
|
|
481
|
-
else if (spec.properties) {
|
|
485
|
+
else if (spec.properties && Object.keys(spec.properties).length) {
|
|
482
486
|
(0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', Object.fromEntries(Object.entries(spec.properties).map(([key, childSpec]) => [
|
|
483
487
|
key,
|
|
484
488
|
childSpec.viewSpec.layoutTitle || key,
|
|
@@ -514,7 +518,7 @@ const viewSpecRules = {
|
|
|
514
518
|
(0, set_1.default)(mutableSchema, 'nodeParameters.entity', 'file');
|
|
515
519
|
}
|
|
516
520
|
else if (spec.viewSpec.type === 'monaco_input') {
|
|
517
|
-
(0, set_1.default)(mutableSchema, 'nodeParameters.entity', '
|
|
521
|
+
(0, set_1.default)(mutableSchema, 'nodeParameters.entity', 'monaco_input');
|
|
518
522
|
}
|
|
519
523
|
else if (spec.viewSpec.type === 'number_with_scale') {
|
|
520
524
|
(0, set_1.default)(mutableSchema, 'nodeParameters.entity', 'string_number_with_scale');
|
|
@@ -616,7 +620,9 @@ const specRules = {
|
|
|
616
620
|
}
|
|
617
621
|
},
|
|
618
622
|
description: (spec, mutableSchema) => {
|
|
619
|
-
if ('description' in spec &&
|
|
623
|
+
if ('description' in spec &&
|
|
624
|
+
(0, isObject_1.default)(spec.description) &&
|
|
625
|
+
Object.keys(spec.description).length) {
|
|
620
626
|
(0, set_1.default)(mutableSchema, 'nodeParameters.entityProps.enumDescriptions', spec.description);
|
|
621
627
|
}
|
|
622
628
|
},
|
|
@@ -116,10 +116,16 @@ const SchemaRendererNodeComponent = ({ headName, modeOverride, name, schemaOverr
|
|
|
116
116
|
return undefined;
|
|
117
117
|
}
|
|
118
118
|
const coercedCurrentValue = coerceToJsonSchemaType(currentValue, schema === null || schema === void 0 ? void 0 : schema.type);
|
|
119
|
-
if (coercedCurrentValue !== undefined
|
|
119
|
+
if (coercedCurrentValue !== undefined) {
|
|
120
|
+
if (coercedCurrentValue === currentValue) {
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
120
123
|
return { name, value: coercedCurrentValue };
|
|
121
124
|
}
|
|
122
|
-
if (defaultValue !== undefined
|
|
125
|
+
if (defaultValue !== undefined) {
|
|
126
|
+
if (defaultValue === currentValue) {
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
123
129
|
return { name, value: defaultValue };
|
|
124
130
|
}
|
|
125
131
|
return undefined;
|
|
@@ -153,12 +153,16 @@ const viewSpecRules = {
|
|
|
153
153
|
}
|
|
154
154
|
},
|
|
155
155
|
order: (spec, mutableSchema) => {
|
|
156
|
-
if (spec.type === SpecTypes.Object &&
|
|
156
|
+
if (spec.type === SpecTypes.Object &&
|
|
157
|
+
spec.viewSpec.order &&
|
|
158
|
+
Object.keys(spec.viewSpec.order).length) {
|
|
157
159
|
set(mutableSchema, 'nodeParameters.entityProps.order', spec.viewSpec.order);
|
|
158
160
|
}
|
|
159
161
|
},
|
|
160
162
|
delimiter: (spec, mutableSchema) => {
|
|
161
|
-
if (spec.type === SpecTypes.Object &&
|
|
163
|
+
if (spec.type === SpecTypes.Object &&
|
|
164
|
+
spec.viewSpec.delimiter &&
|
|
165
|
+
Object.keys(spec.viewSpec.delimiter).length) {
|
|
162
166
|
set(mutableSchema, 'nodeParameters.entityProps.delimiter', spec.viewSpec.delimiter);
|
|
163
167
|
}
|
|
164
168
|
},
|
|
@@ -303,7 +307,7 @@ const viewSpecRules = {
|
|
|
303
307
|
if (spec.description && Object.keys(spec.description).length) {
|
|
304
308
|
set(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', spec.description);
|
|
305
309
|
}
|
|
306
|
-
else if (spec.properties) {
|
|
310
|
+
else if (spec.properties && Object.keys(spec.properties).length) {
|
|
307
311
|
set(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', Object.fromEntries(Object.entries(spec.properties).map(([key, childSpec]) => [
|
|
308
312
|
key,
|
|
309
313
|
childSpec.viewSpec.layoutTitle || key,
|
|
@@ -348,7 +352,7 @@ const viewSpecRules = {
|
|
|
348
352
|
if (spec.description && Object.keys(spec.description).length) {
|
|
349
353
|
set(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', spec.description);
|
|
350
354
|
}
|
|
351
|
-
else if (spec.properties) {
|
|
355
|
+
else if (spec.properties && Object.keys(spec.properties).length) {
|
|
352
356
|
set(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', Object.fromEntries(Object.entries(spec.properties).map(([key, childSpec]) => [
|
|
353
357
|
key,
|
|
354
358
|
childSpec.viewSpec.layoutTitle || key,
|
|
@@ -393,7 +397,7 @@ const viewSpecRules = {
|
|
|
393
397
|
if (spec.description && Object.keys(spec.description).length) {
|
|
394
398
|
set(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', spec.description);
|
|
395
399
|
}
|
|
396
|
-
else if (spec.properties) {
|
|
400
|
+
else if (spec.properties && Object.keys(spec.properties).length) {
|
|
397
401
|
set(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', Object.fromEntries(Object.entries(spec.properties).map(([key, childSpec]) => [
|
|
398
402
|
key,
|
|
399
403
|
childSpec.viewSpec.layoutTitle || key,
|
|
@@ -439,7 +443,7 @@ const viewSpecRules = {
|
|
|
439
443
|
if (spec.description && Object.keys(spec.description).length) {
|
|
440
444
|
set(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', spec.description);
|
|
441
445
|
}
|
|
442
|
-
else if (spec.properties) {
|
|
446
|
+
else if (spec.properties && Object.keys(spec.properties).length) {
|
|
443
447
|
set(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', Object.fromEntries(Object.entries(spec.properties).map(([key, childSpec]) => [
|
|
444
448
|
key,
|
|
445
449
|
childSpec.viewSpec.layoutTitle || key,
|
|
@@ -474,7 +478,7 @@ const viewSpecRules = {
|
|
|
474
478
|
if (spec.description && Object.keys(spec.description).length) {
|
|
475
479
|
set(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', spec.description);
|
|
476
480
|
}
|
|
477
|
-
else if (spec.properties) {
|
|
481
|
+
else if (spec.properties && Object.keys(spec.properties).length) {
|
|
478
482
|
set(mutableSchema, 'nodeParameters.entityProps.toggler.nodeParameters.entityProps.enumDescriptions', Object.fromEntries(Object.entries(spec.properties).map(([key, childSpec]) => [
|
|
479
483
|
key,
|
|
480
484
|
childSpec.viewSpec.layoutTitle || key,
|
|
@@ -510,7 +514,7 @@ const viewSpecRules = {
|
|
|
510
514
|
set(mutableSchema, 'nodeParameters.entity', 'file');
|
|
511
515
|
}
|
|
512
516
|
else if (spec.viewSpec.type === 'monaco_input') {
|
|
513
|
-
set(mutableSchema, 'nodeParameters.entity', '
|
|
517
|
+
set(mutableSchema, 'nodeParameters.entity', 'monaco_input');
|
|
514
518
|
}
|
|
515
519
|
else if (spec.viewSpec.type === 'number_with_scale') {
|
|
516
520
|
set(mutableSchema, 'nodeParameters.entity', 'string_number_with_scale');
|
|
@@ -612,7 +616,9 @@ const specRules = {
|
|
|
612
616
|
}
|
|
613
617
|
},
|
|
614
618
|
description: (spec, mutableSchema) => {
|
|
615
|
-
if ('description' in spec &&
|
|
619
|
+
if ('description' in spec &&
|
|
620
|
+
isObject(spec.description) &&
|
|
621
|
+
Object.keys(spec.description).length) {
|
|
616
622
|
set(mutableSchema, 'nodeParameters.entityProps.enumDescriptions', spec.description);
|
|
617
623
|
}
|
|
618
624
|
},
|