优化 Tag 输入的 disabled 状态

This commit is contained in:
2betop 2020-07-14 11:11:27 +08:00
parent b94a0a4f36
commit 0f08fda189
2 changed files with 13 additions and 6 deletions

View File

@ -5,6 +5,11 @@
border-radius: 0;
}
&-input.is-disabled {
border-style: dashed;
background: transparent;
}
&.is-inline {
display: inline-block;
}

View File

@ -128,7 +128,7 @@ export class ResultBox extends React.Component<ResultBoxProps> {
onResultClick ? 'is-clickable' : ''
)}
onClick={onResultClick}
tabIndex={!allowInput && onFocus ? 0 : -1}
tabIndex={!allowInput && !disabled && onFocus ? 0 : -1}
onKeyPress={allowInput ? undefined : onKeyPress}
onFocus={allowInput ? undefined : onFocus}
onBlur={allowInput ? undefined : onBlur}
@ -139,20 +139,22 @@ export class ResultBox extends React.Component<ResultBoxProps> {
<span className={cx('ResultBox-valueLabel')}>
{itemRender(item)}
</span>
<a data-index={index} onClick={this.removeItem}>
<Icon icon="close" className="icon" />
</a>
{!disabled ? (
<a data-index={index} onClick={this.removeItem}>
<Icon icon="close" className="icon" />
</a>
) : null}
</div>
))
) : result && !Array.isArray(result) ? (
<span className={cx('ResultBox-singleValue')}>{result}</span>
) : allowInput ? null : (
) : allowInput && !disabled ? null : (
<span className={cx('ResultBox-placeholder')}>
{__(placeholder || '无')}
</span>
)}
{allowInput ? (
{allowInput && !disabled ? (
<Input
{...rest}
onKeyPress={onKeyPress}