mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Select: Increase size of virtualized list options (#86444)
This commit is contained in:
parent
7112f1effc
commit
1997faf617
@ -34,7 +34,8 @@ export const SelectMenu = ({ children, maxHeight, innerRef, innerProps }: React.
|
||||
SelectMenu.displayName = 'SelectMenu';
|
||||
|
||||
const VIRTUAL_LIST_ITEM_HEIGHT = 37;
|
||||
const VIRTUAL_LIST_WIDTH_ESTIMATE_MULTIPLIER = 7;
|
||||
const VIRTUAL_LIST_WIDTH_ESTIMATE_MULTIPLIER = 8;
|
||||
const VIRTUAL_LIST_PADDING = 8;
|
||||
|
||||
// A virtualized version of the SelectMenu, descriptions for SelectableValue options not supported since those are of a variable height.
|
||||
//
|
||||
@ -57,7 +58,7 @@ export const VirtualizedSelectMenu = ({ children, maxHeight, options, getValue }
|
||||
}
|
||||
|
||||
const longestOption = max(options.map((option) => option.label?.length)) ?? 0;
|
||||
const widthEstimate = longestOption * VIRTUAL_LIST_WIDTH_ESTIMATE_MULTIPLIER;
|
||||
const widthEstimate = longestOption * VIRTUAL_LIST_WIDTH_ESTIMATE_MULTIPLIER + VIRTUAL_LIST_PADDING * 2;
|
||||
const heightEstimate = Math.min(options.length * VIRTUAL_LIST_ITEM_HEIGHT, maxHeight);
|
||||
|
||||
// Try to scroll to keep current value in the middle
|
||||
|
Loading…
Reference in New Issue
Block a user