Merge pull request #12284 from joanayma/OwnedEntityPicker-allowArbitraryValues
Add allowArbitraryValues in OwnedEntityPicker
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder': patch
|
||||
---
|
||||
|
||||
Add `allowArbitraryValues` to `ui:options` in `OwnedEntityPicker`, similar to `allowArbitraryValues` in `EntityPicker`
|
||||
@@ -153,6 +153,8 @@ export const OwnedEntityPickerFieldExtension: FieldExtensionComponent<
|
||||
|
||||
// @public
|
||||
export interface OwnedEntityPickerUiOptions {
|
||||
// (undocumented)
|
||||
allowArbitraryValues?: boolean;
|
||||
// (undocumented)
|
||||
allowedKinds?: string[];
|
||||
// (undocumented)
|
||||
|
||||
@@ -37,6 +37,7 @@ import { FieldExtensionComponentProps } from '../../../extensions';
|
||||
export interface OwnedEntityPickerUiOptions {
|
||||
allowedKinds?: string[];
|
||||
defaultKind?: string;
|
||||
allowArbitraryValues?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,6 +61,8 @@ export const OwnedEntityPicker = (
|
||||
|
||||
const allowedKinds = uiSchema['ui:options']?.allowedKinds;
|
||||
const defaultKind = uiSchema['ui:options']?.defaultKind;
|
||||
const allowArbitraryValues =
|
||||
uiSchema['ui:options']?.allowArbitraryValues ?? true;
|
||||
const { ownedEntities, loading } = useOwnedEntities(allowedKinds);
|
||||
|
||||
const entityRefs = ownedEntities?.items
|
||||
@@ -83,7 +86,7 @@ export const OwnedEntityPicker = (
|
||||
onChange={onSelect}
|
||||
options={entityRefs || []}
|
||||
autoSelect
|
||||
freeSolo
|
||||
freeSolo={allowArbitraryValues}
|
||||
renderInput={params => (
|
||||
<TextField
|
||||
{...params}
|
||||
|
||||
Reference in New Issue
Block a user