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

This commit is contained in:
catchonme 2019-07-31 20:34:09 +08:00
parent d059240a19
commit a4de4932c2
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> <span className={`${ns}DatePicker-placeholder`}>{placeholder}</span>
)} )}
{clearable && value ? ( {clearable && !disabled && value ? (
<a className={`${ns}DatePicker-clear`} onClick={this.clearValue}> <a className={`${ns}DatePicker-clear`} onClick={this.clearValue}>
{closeIcon} {closeIcon}
</a> </a>

View File

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

View File

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

View File

@ -266,7 +266,7 @@ export default class TagControl extends React.PureComponent<TagProps, TagState>
/> />
</div> </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} {loading ? <i className={cx(`TagControl-spinner`, spinnerClassName)} /> : null}
</div> </div>

View File

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