mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
committed by
GitHub
parent
9b0e6d0cc0
commit
75f927b9eb
@@ -203,13 +203,6 @@ export default class SelectControl extends React.PureComponent {
|
||||
return remainingOptions;
|
||||
}
|
||||
|
||||
createPlaceholder() {
|
||||
const optionsRemaining = this.optionsRemaining();
|
||||
const placeholder =
|
||||
this.props.placeholder || t('%s option(s)', optionsRemaining);
|
||||
return optionsRemaining ? placeholder : '';
|
||||
}
|
||||
|
||||
createMetaSelectAllOption() {
|
||||
const option = { label: 'Select All', meta: true };
|
||||
option[this.props.valueKey] = 'Select All';
|
||||
@@ -235,9 +228,19 @@ export default class SelectControl extends React.PureComponent {
|
||||
valueKey,
|
||||
valueRenderer,
|
||||
} = this.props;
|
||||
const placeholder = this.createPlaceholder();
|
||||
|
||||
const optionsRemaining = this.optionsRemaining();
|
||||
const optionRemaingText = optionsRemaining
|
||||
? t('%s option(s)', optionsRemaining)
|
||||
: '';
|
||||
const placeholder = this.props.placeholder || optionRemaingText;
|
||||
const isMulti = this.props.isMulti || this.props.multi;
|
||||
|
||||
let assistiveText;
|
||||
if (isMulti && optionsRemaining && Array.isArray(value) && !!value.length) {
|
||||
assistiveText = optionRemaingText;
|
||||
}
|
||||
|
||||
const selectProps = {
|
||||
autoFocus,
|
||||
clearable,
|
||||
@@ -257,6 +260,7 @@ export default class SelectControl extends React.PureComponent {
|
||||
optionRenderer,
|
||||
options: this.state.options,
|
||||
placeholder,
|
||||
assistiveText,
|
||||
promptTextCreator,
|
||||
selectRef: this.getSelectRef,
|
||||
value,
|
||||
|
||||
Reference in New Issue
Block a user