Merge pull request #132 from catchonme/master

清除前先检测是否是disabled的状态
This commit is contained in:
liaoxuezhi 2019-08-01 09:23:47 +08:00 committed by GitHub
commit 718e336c0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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>
);
}