feat: Allow to skip submitting empty values in form data (#5830)

This commit is contained in:
abcang
2020-05-30 07:46:08 +09:00
committed by GitHub
parent eaca2f6fd8
commit b9b32c9c93
10 changed files with 75 additions and 27 deletions

View File

@@ -3,7 +3,7 @@ import { Map, List } from "immutable"
import PropTypes from "prop-types"
import ImPropTypes from "react-immutable-proptypes"
import win from "core/window"
import { getSampleSchema, getExtensions, getCommonExtensions, numberToString, stringify } from "core/utils"
import { getSampleSchema, getExtensions, getCommonExtensions, numberToString, stringify, isEmptyValue } from "core/utils"
import getParameterSchema from "../../helpers/get-parameter-schema.js"
export default class ParameterRow extends Component {
@@ -336,12 +336,11 @@ export default class ParameterRow extends Component {
}
{
!bodyParam && isExecute ?
!bodyParam && isExecute && param.get("allowEmptyValue") ?
<ParameterIncludeEmpty
onChange={this.onChangeIncludeEmpty}
isIncluded={specSelectors.parameterInclusionSettingFor(pathMethod, param.get("name"), param.get("in"))}
isDisabled={value && value.size !== 0}
param={param} />
isDisabled={!isEmptyValue(value)} />
: null
}