mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:58:05 +08:00
fix: inputRange更换事件名称 (#5470)
This commit is contained in:
parent
19bfac7493
commit
c4e043c735
@ -133,7 +133,8 @@ class HandleItem extends React.Component<HandleItemProps, HandleItemState> {
|
||||
this.setState({
|
||||
isDrag: false
|
||||
});
|
||||
this.props.onAfterChange();
|
||||
const {onAfterChange} = this.props;
|
||||
onAfterChange && onAfterChange();
|
||||
window.removeEventListener('mousemove', this.onMouseMove);
|
||||
window.removeEventListener('mouseup', this.onMouseUp);
|
||||
}
|
||||
@ -291,7 +292,8 @@ export class Range extends React.Component<RangeItemProps, any> {
|
||||
*/
|
||||
@autobind
|
||||
updateValue(value: FormatValue) {
|
||||
this.props.updateValue(value);
|
||||
const {onChange} = this.props;
|
||||
onChange && onChange(value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -239,7 +239,7 @@ export interface DefaultProps {
|
||||
|
||||
export interface RangeItemProps extends RangeProps {
|
||||
value: FormatValue;
|
||||
updateValue: (value: Value) => void;
|
||||
onChange: (value: Value) => void;
|
||||
onAfterChange: () => void;
|
||||
}
|
||||
|
||||
@ -298,7 +298,7 @@ export class Input extends React.Component<RangeItemProps, any> {
|
||||
const {multiple, value: originValue, type, min} = this.props;
|
||||
const _value = this.getValue(value, type);
|
||||
|
||||
this.props.updateValue(
|
||||
this.props.onChange(
|
||||
multiple
|
||||
? {...(originValue as MultipleValue), [type]: _value}
|
||||
: value ?? min
|
||||
@ -314,7 +314,7 @@ export class Input extends React.Component<RangeItemProps, any> {
|
||||
const {multiple, value: originValue, type} = this.props;
|
||||
const _value = this.getValue(value, type);
|
||||
|
||||
this.props.updateValue(
|
||||
this.props.onChange(
|
||||
multiple ? {...(originValue as MultipleValue), [type]: _value} : value
|
||||
);
|
||||
}
|
||||
@ -547,11 +547,11 @@ export default class RangeControl extends React.PureComponent<
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有触发value变换 -> updateValue
|
||||
* 所有触发value变换 -> onChange
|
||||
* @param value
|
||||
*/
|
||||
@autobind
|
||||
async updateValue(value: FormatValue) {
|
||||
async onChange(value: FormatValue) {
|
||||
this.setState({value: this.getValue(value)});
|
||||
const {onChange, data, dispatchEvent} = this.props;
|
||||
const result = this.getFormatValue(value);
|
||||
@ -604,7 +604,7 @@ export default class RangeControl extends React.PureComponent<
|
||||
const props: RangeItemProps = {
|
||||
...this.props,
|
||||
value,
|
||||
updateValue: this.updateValue,
|
||||
onChange: this.onChange,
|
||||
onAfterChange: this.onAfterChange
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user