清除前先检测是否是disabled的状态

This commit is contained in:
catchonme 2019-07-31 20:34:09 +08:00
parent 3eae50d4a5
commit fd217dbacd
5 changed files with 6 additions and 6 deletions

View File

@ -755,7 +755,7 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
<span className={`${ns}DatePicker-placeholder`}>{placeholder}</span>
)}
{clearable && value ? (
{clearable && !disabled && value ? (
<a className={`${ns}DatePicker-clear`} onClick={this.clearValue}>
{closeIcon}
</a>

View File

@ -438,7 +438,7 @@ export class DateRangePicker extends React.Component<DateRangePickerProps, DateR
<span className={`${ns}DateRangePicker-placeholder`}>{placeholder}</span>
)}
{clearable && value ? (
{clearable && !disabled && value ? (
<a className={`${ns}DateRangePicker-clear`} onClick={this.clearValue}>
{closeIcon}
</a>

View File

@ -368,7 +368,7 @@ export default class RangeControl extends React.PureComponent<RangeProps, RangeS
)
: null}
{clearable && showInput ? (
{clearable && !disabled && showInput ? (
<a onClick={() => this.clearValue()} className={cx("InputRange-clear", {
'is-active': (multiple ? isEqual(this.state.value, {min: min, max: max}) : this.state.value !== min)
})}>{closeIcon}</a>

View File

@ -266,7 +266,7 @@ export default class TagControl extends React.PureComponent<TagProps, TagState>
/>
</div>
{clearable && value ? (<a onClick={this.clearValue} className={cx('TagControl-clear')}>{closeIcon}</a>) : null}
{clearable && !disabled && value ? (<a onClick={this.clearValue} className={cx('TagControl-clear')}>{closeIcon}</a>) : null}
{loading ? <i className={cx(`TagControl-spinner`, spinnerClassName)} /> : null}
</div>

View File

@ -434,7 +434,7 @@ export default class TextControl extends React.PureComponent<TextProps, TextStat
/>
</div>
{clearable && value ? (<a onClick={this.clearValue} className={cx('TextControl-clear')}>{closeIcon}</a>) : null}
{clearable && !disabled && value ? (<a onClick={this.clearValue} className={cx('TextControl-clear')}>{closeIcon}</a>) : null}
{loading ? <i className={cx(`TextControl-spinner`, spinnerClassName)} /> : null}
{isOpen && filtedOptions.length ? (
<div className={cx('TextControl-sugs')}>
@ -498,7 +498,7 @@ export default class TextControl extends React.PureComponent<TextProps, TextStat
onChange={this.handleNormalInputChange}
value={typeof value === 'undefined' || value === null ? '' : typeof value === 'string' ? value : JSON.stringify(value)}
/>
{clearable && value ? (<a onClick={this.clearValue} className={`${ns}TextControl-clear`}>{closeIcon}</a>) : null}
{clearable && !disabled && value ? (<a onClick={this.clearValue} className={`${ns}TextControl-clear`}>{closeIcon}</a>) : null}
</div>
);
}