Integrating new form binder

This commit is contained in:
John Lyon-Smith
2018-03-06 07:43:21 -08:00
parent 535fffaf41
commit c1bf470aa0
15 changed files with 93 additions and 54 deletions

View File

@@ -23,14 +23,15 @@ export class UserForm extends React.Component {
isDisabled: (r) => (r._id)
},
emailValidated: {
initValue: false,
isDisabled: (r) => (!r._id)
},
changeEmail: {
nonValue: true,
noValue: true,
isDisabled: (r) => (!r._id)
},
resendEmail: {
nonValue: true,
noValue: true,
isDisabled: (r) => (!r._id || !!r.getFieldValue('emailValidated'))
},
firstName: {
@@ -41,20 +42,23 @@ export class UserForm extends React.Component {
},
administrator: {
isValid: (r, v) => true,
initValue: false,
isDisabled: (r) => (api.loggedInUser._id === r._id), // Adding a new user
alwaysGet: true,
},
remove: {
nonValue: true,
noValue: true,
isVisible: (r) => (r._id),
isDisabled: (r) => (api.loggedInUser._id === r._id)
},
reset: {
nonValue: true,
isDisabled: (r) => (!r.anyModified)
noValue: true,
isDisabled: (r) => {
return !r.anyModified
}
},
submit: {
nonValue: true,
noValue: true,
isDisabled: (r) => (!r.anyModified || !r.allValid),
},
}

View File

@@ -258,7 +258,7 @@ export class Users extends Component {
</Row.Item>
<Row.Item width={20} />
<Row.Item grow>
<Box border={`${sizeInfo.headerBorderWidth}px solid ${colorInfo.headerBorder}`} radius={sizeInfo.formBoxRadius}>
<Box border={{ width: sizeInfo.headerBorderWidth, color: colorInfo.headerBorder }} radius={sizeInfo.formBoxRadius}>
{
this.state.selectedUser
? <UserForm user={this.state.selectedUser} onSave={this.handleSave}