Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const mapPropsToFields = props => {
let captcha = props.captcha
captcha && captcha.value && captcha.errors && delete captcha.errors // 当存在值的时候, 删除errors
return {
username: Form.createFormField({
...props.username,
}),
password: Form.createFormField({
...props.password
}),
confirm: Form.createFormField({
...props.confirm
}),
phone: Form.createFormField({
...props.phone
}),
captcha: Form.createFormField({
...props.captcha
}),
email: Form.createFormField({
...props.email
})
}
}
// value改变事件
mapPropsToFields(props) {
return {
title: Form.createFormField({
...props.title,
value: props.title.value,
}),
paramType: Form.createFormField({
...props.paramType,
value: props.paramType.value,
}),
paramRule: Form.createFormField({
...props.paramRule,
value: props.paramRule.value,
}),
valueList: Form.createFormField({
...props.valueList,
value: props.valueList.value,
}),
paramIsNeed: Form.createFormField({
const mapPropsToFields = (props) => {
return {
id: Form.createFormField({ ...props.api.id }),
name: Form.createFormField({ ...props.api.name }),
version: Form.createFormField({ ...props.api.version }),
status: Form.createFormField({ ...props.api.status }),
description: Form.createFormField({ ...props.api.description }),
basePath: Form.createFormField({ ...props.api.basePath }),
environments: Form.createFormField({ ...props.api.environments })
}
}
mapPropsToFields(props: any) {
const { field } = props;
const res: any = {
name: Form.createFormField({ value: field.name }),
title: Form.createFormField({ value: field.title }),
description: Form.createFormField({ value: field.description }),
type: Form.createFormField({ value: field.type }),
};
const fromAvailableField = props.availableFields.find((f: any) => f.type === field.type);
const options = defaultsDeep(get(field, 'options', {}), get(fromAvailableField, 'options', {}));
Object.entries(options).forEach(([key, value]) => {
res[`options.${key}`] = Form.createFormField({ value });
});
res.optionsJson = Form.createFormField({ value: JSON.stringify(options) });
return res;
},
})(EditFieldBase);
...props.paramDefaultState,
value: props.paramDefaultState.value,
}),
paramCurrentState: Form.createFormField({
...props.paramCurrentState,
value: props.paramCurrentState.value,
}),
paramStateDes: Form.createFormField({
...props.paramStateDes,
value: props.paramStateDes.value,
}),
eventDec: Form.createFormField({
...props.eventDec,
value: props.eventDec.value,
}),
other: Form.createFormField({
...props.other,
value: props.other.value,
})
};
},
onValuesChange(_, values) {
mapPropsToFields(props) {
return {
title: Form.createFormField({
...props.title,
value: props.title.value,
}),
valueList: Form.createFormField({
...props.valueList,
value: props.valueList.value,
}),
isDoRule: Form.createFormField({
...props.isDoRule,
value: props.isDoRule.value,
}),
paramDoRule: Form.createFormField({
...props.paramDoRule,
value: props.paramDoRule.value,
}),
paramDefaultState: Form.createFormField({
...props.paramDefaultState,
value: props.paramDefaultState.value,
}),
paramCurrentState: Form.createFormField({
...props.paramCurrentState,
value: props.paramCurrentState.value,
}),
paramStateDes: Form.createFormField({
mapPropsToFields (props) {
const org = props.org
if (!org.info) {
org.info = {}
}
return {
name: Form.createFormField({ ...org.name, value: org.name }),
about: Form.createFormField({ ...org.info.about, value: org.info.about }),
instructions: Form.createFormField({
...org.info.instructions,
value: org.info.instructions
}),
followers: Form.createFormField({
...org.info.followers,
value: org.info.followers
}),
joiners: Form.createFormField({
...org.info.joiners,
value: org.info.joiners
}),
members: Form.createFormField({
...org.info.members,
value: org.info.members
}),
...props.person.phone,
value: props.person.phone
}),
pronoun: Form.createFormField({
...props.person.pronoun,
value: props.person.pronoun
}),
imgUrl: Form.createFormField({
...props.person.imgUrl,
value: props.person.imgUrl
}),
role: Form.createFormField({
...props.person.role,
value: props.person.role
}),
status: Form.createFormField({
...props.person.status,
value: props.person.status
}),
tags: Form.createFormField({
...props.person.tags,
value: props.person.tags
})
}
},
onValuesChange (_, values) {
return {
name: Form.createFormField({ ...org.name, value: org.name }),
about: Form.createFormField({ ...org.info.about, value: org.info.about }),
instructions: Form.createFormField({
...org.info.instructions,
value: org.info.instructions
}),
followers: Form.createFormField({
...org.info.followers,
value: org.info.followers
}),
joiners: Form.createFormField({
...org.info.joiners,
value: org.info.joiners
}),
members: Form.createFormField({
...org.info.members,
value: org.info.members
}),
outsiders: Form.createFormField({
...org.info.outsiders,
value: org.info.outsiders
}),
imgUrl: Form.createFormField({ ...org.imgUrl, value: org.imgUrl }),
website: Form.createFormField({ ...org.website, value: org.website }),
contactEmail: Form.createFormField({
...org.contactEmail,
value: org.contactEmail
}),
facebook: Form.createFormField({ ...org.facebook, value: org.facebook }),
twitter: Form.createFormField({ ...org.twitter, value: org.twitter }),
category: Form.createFormField({ ...org.category, value: org.category }),