@tomino/dynamic-form-semantic-ui
Version:
Semantic UI form renderer based on dynamic form generation
81 lines • 2.14 kB
JavaScript
import { create } from './form_query_data';
import { prepareComponent } from './common';
const schema = {
type: 'object',
properties: {
religion: {
type: 'string'
},
linedReligion: {
type: 'string'
},
religions: {
type: 'array',
items: {
type: 'object',
properties: {
text: { type: 'string' },
value: { type: 'string' }
}
},
$enum: [
{ text: 'Christian', value: 'CH' },
{ text: 'Buddhist', value: 'BU' },
{ text: 'Jedi', value: 'JE' }
]
}
}
};
const formData = {
religion: 'JE',
linedReligion: 'BU',
religions: [
{ text: 'Christian', value: 'CH' },
{ text: 'Buddhist', value: 'BU' },
{ text: 'Jesus', value: 'JE' }
]
};
const formDefinition = create.stack({
elements: [
{
props: {
schemaSource: 'religions',
label: 'Religions',
value: { source: 'religion' },
inline: true
},
control: 'Radio'
},
{
props: {
vertical: true,
options: [
{ text: 'Christian', value: 'CH' },
{ text: 'Buddhist', value: 'BU' },
{ text: 'Jehova', value: 'JE' }
],
label: 'Religions',
value: { source: 'linedReligion' }
},
control: 'Radio'
},
{
props: {
options: { source: 'religions' },
label: 'Religions',
value: { source: 'religion' },
inline: true
},
control: 'Radio'
}
]
});
describe('Radio', () => {
return {
component: prepareComponent(formDefinition, schema, formData, {
addEditor: true,
showStandard: true
})
};
});
//# sourceMappingURL=radio_view.test.js.map