select 支持选项级别 disabled 配置

This commit is contained in:
2betop 2020-01-15 15:09:25 +08:00
parent 7670faceea
commit 31c6ec6e87
2 changed files with 12 additions and 1 deletions

View File

@ -100,6 +100,14 @@
&:hover {
background-color: darken($Form-selectValue-bg, 5%);
}
&.is-disabled {
pointer-events: none;
display: none;
cursor: not-allowed;
background-color: lighten($Form-selectValue-bg, 5%);
background: lighten($Form-selectValue-bg, 5%);
}
}
&-arrow {

View File

@ -542,7 +542,9 @@ export class Select extends React.Component<SelectProps, SelectState> {
multiple ? (
<div className={`${ns}Select-value`} key={index}>
<span
className={`${ns}Select-valueIcon ${disabled ? 'is-disabled' : ''}`}
className={`${ns}Select-valueIcon ${
disabled || item.disabled ? 'is-disabled' : ''
}`}
onClick={this.removeItem.bind(this, index)}
>
×
@ -694,6 +696,7 @@ export class Select extends React.Component<SelectProps, SelectState> {
onChange={() => {
this.handleChange(item);
}}
disabled={item.disabled}
>
{item.disabled
? item[labelField]