swoop-common 2.2.122 → 2.2.125
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.
|
@@ -68,11 +68,22 @@ const defaultConverter = (field, stage, omitTitle, isChild) => {
|
|
|
68
68
|
return enumOptions;
|
|
69
69
|
})()
|
|
70
70
|
: undefined;
|
|
71
|
+
let radioOpts = field.fieldType === "radio"
|
|
72
|
+
? (() => {
|
|
73
|
+
var _a;
|
|
74
|
+
let opts = (((_a = field.radioOptions) === null || _a === void 0 ? void 0 : _a.radioValues) ||
|
|
75
|
+
[]);
|
|
76
|
+
if (opts.length === 0)
|
|
77
|
+
opts.push("");
|
|
78
|
+
return opts;
|
|
79
|
+
})()
|
|
80
|
+
: undefined;
|
|
71
81
|
let templates = field.fieldType === "component" && field.componentOptions
|
|
72
82
|
? { "x-templateIds": field.componentOptions["templateIds"] }
|
|
73
83
|
: {};
|
|
74
84
|
const speciallyHandledKeys = new Set([
|
|
75
85
|
"enumValues",
|
|
86
|
+
"radioValues",
|
|
76
87
|
"itemDefinition",
|
|
77
88
|
"properties",
|
|
78
89
|
"templateIds",
|
|
@@ -83,5 +94,5 @@ const defaultConverter = (field, stage, omitTitle, isChild) => {
|
|
|
83
94
|
: {};
|
|
84
95
|
let title = omitTitle ? undefined : field.name;
|
|
85
96
|
let isReadonly = !isChild && !field.editableIn.map(Number).includes(stage);
|
|
86
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (isReadonly && { readOnly: true })), { title, type: schema.schema.type, "x-type": schema.schema["x-type"] }), templates), (schema.schema.type === "object" && { properties })), (field.fieldType === "object" && { required: requiredFields })), (enumOpts && { enum: enumOpts })), (stagedEnumOpts && { items: { enum: stagedEnumOpts, type: "string" } })), (arrayItems && { items: arrayItems })), (field.fieldType === "object" && { properties })), directOptions);
|
|
97
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (isReadonly && { readOnly: true })), { title, type: schema.schema.type, "x-type": schema.schema["x-type"] }), templates), (schema.schema.type === "object" && { properties })), (field.fieldType === "object" && { required: requiredFields })), (enumOpts && { enum: enumOpts })), (radioOpts && { enum: radioOpts })), (stagedEnumOpts && { items: { enum: stagedEnumOpts, type: "string" } })), (arrayItems && { items: arrayItems })), (field.fieldType === "object" && { properties })), directOptions);
|
|
87
98
|
};
|
|
@@ -15,10 +15,7 @@ const uiFieldSchemaFromFieldDefinition = (field, path = []) => {
|
|
|
15
15
|
var _a;
|
|
16
16
|
const scope = ["#", ...path, "properties", generateFieldId(field.name)].join("/");
|
|
17
17
|
if (field.fieldType !== "object" || getAllTypes().find((t => t.name === field.fieldType))) {
|
|
18
|
-
const uiElem = {
|
|
19
|
-
type: "Control",
|
|
20
|
-
scope,
|
|
21
|
-
};
|
|
18
|
+
const uiElem = Object.assign({ type: "Control", scope }, (field.fieldType === "radio" && { options: { format: "radio" } }));
|
|
22
19
|
return uiElem;
|
|
23
20
|
}
|
|
24
21
|
const children = ((_a = field.objectOptions) === null || _a === void 0 ? void 0 : _a.properties) || [];
|
|
@@ -40,6 +40,17 @@ registerType("enum", "Dropdown", { type: "string" }, {
|
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
42
|
}, true);
|
|
43
|
+
registerType("radio", "Radio Button", { type: "string" }, {
|
|
44
|
+
type: "object",
|
|
45
|
+
title: "Radio Options",
|
|
46
|
+
properties: {
|
|
47
|
+
radioValues: {
|
|
48
|
+
title: "Radio Values",
|
|
49
|
+
type: "array",
|
|
50
|
+
items: { type: "string" },
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
}, true);
|
|
43
54
|
registerType("array", "List", { type: "array" }, {
|
|
44
55
|
type: "object",
|
|
45
56
|
title: "List Options",
|