Account for both shapes of the required constraint and ensure required trumps default values

This commit is contained in:
Andrew Kingston 2024-09-27 08:33:09 +01:00
parent 40372841d8
commit baa088049a
No known key found for this signature in database
1 changed files with 3 additions and 1 deletions

View File

@ -137,7 +137,9 @@
$: initialiseField(field, savingColumn)
$: checkConstraints(editableColumn)
$: required =
primaryDisplay || (!hasDefault && !!editableColumn?.constraints?.presence)
primaryDisplay ||
editableColumn?.constraints?.presence === true ||
editableColumn?.constraints?.presence?.allowEmpty === false
$: uneditable =
$tables.selected?._id === TableNames.USERS &&
UNEDITABLE_USER_FIELDS.includes(editableColumn.name)