forked from p96170835/amis
pipeIn pipeOut 逻辑修复
This commit is contained in:
parent
7b593155f2
commit
4ba27608e6
|
@ -346,8 +346,9 @@ export default class FormControl extends React.PureComponent<
|
|||
changeImmediately: boolean = false
|
||||
) {
|
||||
const {
|
||||
formStore: form,
|
||||
onChange,
|
||||
control: {type},
|
||||
control: {type, pipeOut},
|
||||
formInited
|
||||
} = this.props;
|
||||
|
||||
|
@ -357,6 +358,11 @@ export default class FormControl extends React.PureComponent<
|
|||
return;
|
||||
}
|
||||
|
||||
if (pipeOut) {
|
||||
const oldValue = this.model.value;
|
||||
value = pipeOut(value, oldValue, form.data);
|
||||
}
|
||||
|
||||
this.setState(
|
||||
{
|
||||
value
|
||||
|
@ -374,16 +380,13 @@ export default class FormControl extends React.PureComponent<
|
|||
onChange,
|
||||
control: {validateOnChange, name, pipeOut, onChange: onFormItemChange}
|
||||
} = this.props;
|
||||
|
||||
if (!this.model) {
|
||||
return;
|
||||
}
|
||||
let value = this.state.value;
|
||||
const oldValue = this.model.value;
|
||||
|
||||
if (pipeOut) {
|
||||
value = pipeOut(value, oldValue, form.data);
|
||||
}
|
||||
|
||||
if (oldValue === value) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ import cx from 'classnames';
|
|||
import React from 'react';
|
||||
import hoistNonReactStatic = require('hoist-non-react-statics');
|
||||
import {ExtractProps, Omit} from './types';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
export type ClassValue =
|
||||
| string
|
||||
|
|
Loading…
Reference in New Issue