fix: proper validation on boolen table schema
This commit is contained in:
parent
7d11bfacb0
commit
c4c38e4f52
1 changed files with 8 additions and 3 deletions
|
|
@ -27,11 +27,16 @@ const BooleanCell = ({ name }) => {
|
|||
const BooleanPropertiesTable = memo(
|
||||
({ title, disabled, data, elements, save, forcedEditing = false }) => {
|
||||
const initialValues = R.fromPairs(
|
||||
elements.map(it => [it.name, data[it.name]?.toString() ?? null])
|
||||
elements.map(it => [it.name, data[it.name]?.toString() ?? 'false'])
|
||||
)
|
||||
|
||||
const validationSchema = R.fromPairs(
|
||||
elements.map(it => [it.name, Yup.boolean().required()])
|
||||
const validationSchema = Yup.object().shape(
|
||||
R.fromPairs(
|
||||
elements.map(it => [
|
||||
it.name,
|
||||
Yup.mixed().oneOf(['true', 'false', true, false]).required()
|
||||
])
|
||||
)
|
||||
)
|
||||
|
||||
const [editing, setEditing] = useState(forcedEditing)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue