Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
88c3b719
Unverified
Commit
88c3b719
authored
Mar 10, 2020
by
Alex Khomenko
Committed by
GitHub
Mar 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Grafana UI: Fix Forms.Select onChangeWithEmpty (#22647)
* Sort props * Add missing deps to useCallback
parent
0e7c746a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
52 deletions
+52
-52
packages/grafana-ui/src/components/Forms/Select/SelectBase.tsx
+52
-52
No files found.
packages/grafana-ui/src/components/Forms/Select/SelectBase.tsx
View file @
88c3b719
...
@@ -65,44 +65,44 @@ const CustomControl = (props: any) => {
...
@@ -65,44 +65,44 @@ const CustomControl = (props: any) => {
};
};
export
function
SelectBase
<
T
>
({
export
function
SelectBase
<
T
>
({
value
,
allowCustomValue
=
false
,
autoFocus
=
false
,
backspaceRemovesValue
=
true
,
components
,
defaultOptions
,
defaultValue
,
defaultValue
,
inputValue
,
onInputChange
,
onCreateOption
,
options
=
[],
onChange
,
onBlur
,
onKeyDown
,
onCloseMenu
,
onOpenMenu
,
placeholder
=
'Choose'
,
getOptionValue
,
getOptionLabel
,
isSearchable
=
true
,
disabled
=
false
,
disabled
=
false
,
formatCreateLabel
,
getOptionLabel
,
getOptionValue
,
inputValue
,
invalid
,
isClearable
=
false
,
isClearable
=
false
,
isMulti
=
false
,
isLoading
=
false
,
isLoading
=
false
,
isMulti
=
false
,
isOpen
,
isOpen
,
autoFocus
=
false
,
isSearchable
=
true
,
openMenuOnFocus
=
false
,
loadOptions
,
loadingMessage
=
'Loading options...'
,
maxMenuHeight
=
300
,
maxMenuHeight
=
300
,
menuPosition
,
noOptionsMessage
=
'No options found'
,
noOptionsMessage
=
'No options found'
,
tabSelectsValue
=
true
,
onBlur
,
backspaceRemovesValue
=
true
,
onChange
,
allowCustomValue
=
false
,
onCloseMenu
,
size
=
'auto'
,
onCreateOption
,
onInputChange
,
onKeyDown
,
onOpenMenu
,
openMenuOnFocus
=
false
,
options
=
[],
placeholder
=
'Choose'
,
prefix
,
prefix
,
formatCreateLabel
,
loadOptions
,
loadingMessage
=
'Loading options...'
,
defaultOptions
,
renderControl
,
renderControl
,
size
=
'auto'
,
tabSelectsValue
=
true
,
value
,
width
,
width
,
invalid
,
components
,
menuPosition
,
}:
SelectBaseProps
<
T
>
)
{
}:
SelectBaseProps
<
T
>
)
{
const
theme
=
useTheme
();
const
theme
=
useTheme
();
const
styles
=
getSelectStyles
(
theme
);
const
styles
=
getSelectStyles
(
theme
);
...
@@ -113,7 +113,7 @@ export function SelectBase<T>({
...
@@ -113,7 +113,7 @@ export function SelectBase<T>({
}
}
onChange
(
value
);
onChange
(
value
);
},
},
[
isMulti
]
[
isMulti
,
value
,
onChange
]
);
);
let
ReactSelectComponent
:
ReactSelect
|
Creatable
=
ReactSelect
;
let
ReactSelectComponent
:
ReactSelect
|
Creatable
=
ReactSelect
;
const
creatableProps
:
any
=
{};
const
creatableProps
:
any
=
{};
...
@@ -141,39 +141,39 @@ export function SelectBase<T>({
...
@@ -141,39 +141,39 @@ export function SelectBase<T>({
const
commonSelectProps
=
{
const
commonSelectProps
=
{
autoFocus
,
autoFocus
,
placeholder
,
backspaceRemovesValue
,
isSearchable
,
captureMenuScroll
:
false
,
// Passing isDisabled as react-select accepts this prop
defaultValue
,
isDisabled
:
disabled
,
// Also passing disabled, as this is the new Select API, and I want to use this prop instead of react-select's one
// Also passing disabled, as this is the new Select API, and I want to use this prop instead of react-select's one
disabled
,
disabled
,
getOptionLabel
,
getOptionValue
,
inputValue
,
invalid
,
invalid
,
prefix
,
isClearable
,
isClearable
,
// Passing isDisabled as react-select accepts this prop
isDisabled
:
disabled
,
isLoading
,
isLoading
,
isMulti
,
isSearchable
,
maxMenuHeight
,
menuIsOpen
:
isOpen
,
menuIsOpen
:
isOpen
,
defaultValue
,
menuPlacement
:
'auto'
,
inputValue
,
menuPosition
,
menuShouldScrollIntoView
:
false
,
onBlur
,
onChange
:
onChangeWithEmpty
,
onInputChange
,
onInputChange
,
value
:
isMulti
?
selectedValue
:
selectedValue
[
0
],
onKeyDown
,
getOptionLabel
,
getOptionValue
,
openMenuOnFocus
,
maxMenuHeight
,
isMulti
,
backspaceRemovesValue
,
onMenuOpen
:
onOpenMenu
,
onMenuClose
:
onCloseMenu
,
onMenuClose
:
onCloseMenu
,
tabSelectsValue
,
onMenuOpen
:
onOpenMenu
,
openMenuOnFocus
,
options
,
options
,
onChange
:
onChangeWithEmpty
,
placeholder
,
onBlur
,
prefix
,
onKeyDown
,
menuShouldScrollIntoView
:
false
,
renderControl
,
renderControl
,
captureMenuScroll
:
false
,
tabSelectsValue
,
menuPlacement
:
'auto'
,
value
:
isMulti
?
selectedValue
:
selectedValue
[
0
],
menuPosition
,
};
};
// width property is deprecated in favor of size or className
// width property is deprecated in favor of size or className
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment