chore: reworking these types a little bit now so that we can expose the uiSchema props in the api-report
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -25,9 +25,12 @@ import { Extension, attachComponentData } from '@backstage/core-plugin-api';
|
||||
export const FIELD_EXTENSION_WRAPPER_KEY = 'scaffolder.extensions.wrapper.v1';
|
||||
export const FIELD_EXTENSION_KEY = 'scaffolder.extensions.field.v1';
|
||||
|
||||
export function createScaffolderFieldExtension<TReturnValue = unknown>(
|
||||
options: FieldExtensionOptions<TReturnValue>,
|
||||
): Extension<() => null> {
|
||||
export function createScaffolderFieldExtension<
|
||||
TReturnValue = unknown,
|
||||
TInputProps = unknown,
|
||||
>(
|
||||
options: FieldExtensionOptions<TReturnValue, TInputProps>,
|
||||
): Extension<TInputProps> {
|
||||
return {
|
||||
expose() {
|
||||
const FieldExtensionDataHolder: any = () => null;
|
||||
|
||||
@@ -33,9 +33,12 @@ export type CustomFieldValidator<TReturnValue> = (
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type FieldExtensionOptions<TReturnValue = unknown> = {
|
||||
export type FieldExtensionOptions<
|
||||
TReturnValue = unknown,
|
||||
TProps = FieldProps<TReturnValue>,
|
||||
> = {
|
||||
name: string;
|
||||
component: (props: FieldProps<TReturnValue>) => JSX.Element | null;
|
||||
component: (props: TProps) => JSX.Element | null;
|
||||
validation?: CustomFieldValidator<TReturnValue>;
|
||||
};
|
||||
|
||||
@@ -46,10 +49,10 @@ export type FieldExtensionOptions<TReturnValue = unknown> = {
|
||||
* @public
|
||||
*/
|
||||
export interface FieldExtensionComponentProps<
|
||||
ReturnValue,
|
||||
UiOptions extends {} = {},
|
||||
> extends FieldProps<ReturnValue> {
|
||||
uiSchema: {
|
||||
'ui:options'?: UiOptions;
|
||||
TReturnValue,
|
||||
TUiOptions extends {} = {},
|
||||
> extends FieldProps<TReturnValue> {
|
||||
uiSchema: FieldProps['uiSchema'] & {
|
||||
'ui:options'?: TUiOptions;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user