mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
import { SelectableValue } from '@grafana/data';
|
|
import { SelectCommonProps, MultiSelectCommonProps, SelectAsyncProps } from './types';
|
|
import { SelectBase } from './SelectBase';
|
|
import { SelectContainer, SelectContainerProps } from './SelectContainer';
|
|
|
|
export function Select<T>(props: SelectCommonProps<T>) {
|
|
return <SelectBase {...props} />;
|
|
}
|
|
|
|
export function MultiSelect<T>(props: MultiSelectCommonProps<T>) {
|
|
// @ts-ignore
|
|
return <SelectBase {...props} isMulti />;
|
|
}
|
|
|
|
interface AsyncSelectProps<T> extends Omit<SelectCommonProps<T>, 'options'>, SelectAsyncProps<T> {
|
|
// AsyncSelect has options stored internally. We cannot enable plain values as we don't have access to the fetched options
|
|
value?: SelectableValue<T> | null;
|
|
invalid?: boolean;
|
|
}
|
|
|
|
export function AsyncSelect<T>(props: AsyncSelectProps<T>) {
|
|
return <SelectBase {...props} />;
|
|
}
|
|
|
|
interface AsyncMultiSelectProps<T> extends Omit<MultiSelectCommonProps<T>, 'options'>, SelectAsyncProps<T> {
|
|
// AsyncSelect has options stored internally. We cannot enable plain values as we don't have access to the fetched options
|
|
value?: Array<SelectableValue<T>>;
|
|
}
|
|
|
|
export function AsyncMultiSelect<T>(props: AsyncMultiSelectProps<T>) {
|
|
// @ts-ignore
|
|
return <SelectBase {...props} isMulti />;
|
|
}
|
|
|
|
export { SelectContainer, SelectContainerProps };
|