Skip to content

Commit

Permalink
Merge pull request #915 from epam/#866-absolute-radio-button-checked-…
Browse files Browse the repository at this point in the history
…in-all-case

#866 'Absolute' radio button checked in all case
  • Loading branch information
r1z3rISGOD authored Nov 3, 2021
2 parents 7932611 + ffd992e commit ef96bac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ function FieldSet({
selected,
onSelect,
type = 'radio',
checked,
...rest
}) {
return (
Expand All @@ -121,7 +122,9 @@ function FieldSet({
<label className={classes.fieldSetLabel}>
<input
type={type}
defaultChecked={selected(val, value)}
defaultChecked={
type === 'radio' ? selected(val, checked) : selected(val, value)
}
value={typeof val !== 'object' && val}
{...rest}
/>
Expand Down
5 changes: 3 additions & 2 deletions packages/ketcher-react/src/script/ui/dialog/toolbox/sdata.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ function SData({
name="fieldName"
schema={sdataSchema[result.context]}
/>
{content(formSchema, result.context, result.fieldName)}
{content(formSchema, result.context, result.fieldName, radiobuttons)}
</fieldset>
</Form>
</Dialog>
)
}

const content = (schema, context, fieldName) =>
const content = (schema, context, fieldName, checked) =>
Object.keys(schema.properties)
.filter(
prop => prop !== 'type' && prop !== 'context' && prop !== 'fieldName'
Expand All @@ -115,6 +115,7 @@ const content = (schema, context, fieldName) =>
prop === 'radiobuttons' ? (
<Field
name={prop}
checked={checked}
type="radio"
key={`${context}-${fieldName}-${prop}-radio`}
/>
Expand Down

0 comments on commit ef96bac

Please sign in to comment.