Merge pull request #19319 from namco1992/export-autocomplete
Export the `EntityAutocompletePicker` component
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-react': patch
|
||||
---
|
||||
|
||||
Export the `EntityAutocompletePicker` component.
|
||||
@@ -24,6 +24,16 @@ import { StyleRules } from '@material-ui/core/styles/withStyles';
|
||||
import { SystemEntity } from '@backstage/catalog-model';
|
||||
import { TableColumn } from '@backstage/core-components';
|
||||
import { TableOptions } from '@backstage/core-components';
|
||||
import { TextFieldProps } from '@material-ui/core';
|
||||
|
||||
// @public (undocumented)
|
||||
export type AllowedEntityFilters<T extends DefaultEntityFilters> = {
|
||||
[K in keyof T]-?: NonNullable<T[K]> extends EntityFilter & {
|
||||
values: string[];
|
||||
}
|
||||
? K
|
||||
: never;
|
||||
}[keyof T];
|
||||
|
||||
// @public
|
||||
export const AsyncEntityProvider: (
|
||||
@@ -142,6 +152,28 @@ export type DefaultEntityFilters = {
|
||||
namespace?: EntityNamespaceFilter;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export function EntityAutocompletePicker<
|
||||
T extends DefaultEntityFilters = DefaultEntityFilters,
|
||||
Name extends AllowedEntityFilters<T> = AllowedEntityFilters<T>,
|
||||
>(props: EntityAutocompletePickerProps<T, Name>): React_2.JSX.Element | null;
|
||||
|
||||
// @public (undocumented)
|
||||
export type EntityAutocompletePickerProps<
|
||||
T extends DefaultEntityFilters = DefaultEntityFilters,
|
||||
Name extends AllowedEntityFilters<T> = AllowedEntityFilters<T>,
|
||||
> = {
|
||||
label: string;
|
||||
name: Name;
|
||||
path: string;
|
||||
showCounts?: boolean;
|
||||
Filter: {
|
||||
new (values: string[]): NonNullable<T[Name]>;
|
||||
};
|
||||
InputProps?: TextFieldProps;
|
||||
initialSelectedOptions?: string[];
|
||||
};
|
||||
|
||||
// @public
|
||||
export class EntityErrorFilter implements EntityFilter {
|
||||
constructor(value: boolean);
|
||||
|
||||
+8
-13
@@ -29,20 +29,15 @@ import {
|
||||
} from '../../hooks/useEntityListProvider';
|
||||
import { EntityFilter } from '../../types';
|
||||
|
||||
type KeysMatchingCondition<T, V, K> = T extends V ? K : never;
|
||||
type KeysMatching<T, V> = {
|
||||
[K in keyof T]-?: KeysMatchingCondition<T[K], V, K>;
|
||||
/** @public */
|
||||
export type AllowedEntityFilters<T extends DefaultEntityFilters> = {
|
||||
[K in keyof T]-?: NonNullable<T[K]> extends EntityFilter & {
|
||||
values: string[];
|
||||
}
|
||||
? K
|
||||
: never;
|
||||
}[keyof T];
|
||||
|
||||
type AllowedEntityFilters<T extends DefaultEntityFilters> = KeysMatching<
|
||||
T,
|
||||
EntityFilter & { values: string[] }
|
||||
>;
|
||||
|
||||
interface ConstructableFilter<T> {
|
||||
new (values: string[]): T;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export type EntityAutocompletePickerProps<
|
||||
T extends DefaultEntityFilters = DefaultEntityFilters,
|
||||
@@ -52,7 +47,7 @@ export type EntityAutocompletePickerProps<
|
||||
name: Name;
|
||||
path: string;
|
||||
showCounts?: boolean;
|
||||
Filter: ConstructableFilter<NonNullable<T[Name]>>;
|
||||
Filter: { new (values: string[]): NonNullable<T[Name]> };
|
||||
InputProps?: TextFieldProps;
|
||||
initialSelectedOptions?: string[];
|
||||
};
|
||||
|
||||
@@ -15,4 +15,7 @@
|
||||
*/
|
||||
|
||||
export { EntityAutocompletePicker } from './EntityAutocompletePicker';
|
||||
export type { EntityAutocompletePickerProps } from './EntityAutocompletePicker';
|
||||
export type {
|
||||
EntityAutocompletePickerProps,
|
||||
AllowedEntityFilters,
|
||||
} from './EntityAutocompletePicker';
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export { EntityProcessingStatusPicker as EntityProcessingStatusPicker } from './EntityProcessingStatusPicker';
|
||||
export { EntityProcessingStatusPicker } from './EntityProcessingStatusPicker';
|
||||
export type { CatalogReactEntityProcessingStatusPickerClassKey } from './EntityProcessingStatusPicker';
|
||||
|
||||
@@ -30,3 +30,4 @@ export * from './UnregisterEntityDialog';
|
||||
export * from './UserListPicker';
|
||||
export * from './EntityProcessingStatusPicker';
|
||||
export * from './EntityNamespacePicker';
|
||||
export * from './EntityAutocompletePicker';
|
||||
|
||||
Reference in New Issue
Block a user