remove GetProps type from layouts
Signed-off-by: Paul Cowan <paul.cowan@cutting.scot>
This commit is contained in:
@@ -21,7 +21,6 @@ import { IdentityApi } from '@backstage/core-plugin-api';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { JSONSchema7 } from 'json-schema';
|
||||
import { JsonValue } from '@backstage/types';
|
||||
import { ObjectFieldTemplateProps } from '@rjsf/core';
|
||||
import { Observable } from '@backstage/types';
|
||||
import { PropsWithChildren } from 'react';
|
||||
import { default as React_2 } from 'react';
|
||||
@@ -40,9 +39,9 @@ export function createScaffolderFieldExtension<
|
||||
): Extension<FieldExtensionComponent<TReturnValue, TInputProps>>;
|
||||
|
||||
// @public
|
||||
export function createScaffolderLayout(
|
||||
export function createScaffolderLayout<TInputProps = unknown>(
|
||||
options: LayoutOptions,
|
||||
): Extension<GetProps<typeof options>>;
|
||||
): Extension<LayoutComponent<TInputProps>>;
|
||||
|
||||
// @public
|
||||
export type CustomFieldValidator<TFieldReturnValue> = (
|
||||
@@ -117,13 +116,6 @@ export type FieldExtensionOptions<
|
||||
validation?: CustomFieldValidator<TFieldReturnValue>;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type GetProps<T> = T extends LayoutOptions
|
||||
? T['component'] extends LayoutTemplate<infer P>
|
||||
? LayoutComponent<ObjectFieldTemplateProps<P>>
|
||||
: never
|
||||
: never;
|
||||
|
||||
// @public
|
||||
export type LayoutComponent<_TInputProps> = () => null;
|
||||
|
||||
|
||||
@@ -49,12 +49,7 @@ export type {
|
||||
FieldExtensionComponent,
|
||||
} from './extensions';
|
||||
export { createScaffolderLayout, ScaffolderLayouts } from './layouts';
|
||||
export type {
|
||||
LayoutOptions,
|
||||
LayoutTemplate,
|
||||
GetProps,
|
||||
LayoutComponent,
|
||||
} from './layouts';
|
||||
export type { LayoutOptions, LayoutTemplate, LayoutComponent } from './layouts';
|
||||
export {
|
||||
EntityPickerFieldExtension,
|
||||
EntityNamePickerFieldExtension,
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
*/
|
||||
|
||||
import { attachComponentData, Extension } from '@backstage/core-plugin-api';
|
||||
import { ObjectFieldTemplateProps } from '@rjsf/core';
|
||||
import type { LayoutOptions, LayoutTemplate } from './types';
|
||||
import type { LayoutOptions } from './types';
|
||||
|
||||
export const LAYOUTS_KEY = 'scaffolder.layout.v1';
|
||||
export const LAYOUTS_WRAPPER_KEY = 'scaffolder.layouts.wrapper.v1';
|
||||
@@ -28,25 +27,14 @@ export const LAYOUTS_WRAPPER_KEY = 'scaffolder.layouts.wrapper.v1';
|
||||
*/
|
||||
export type LayoutComponent<_TInputProps> = () => null;
|
||||
|
||||
/**
|
||||
* utility type to extract the component props from the LayoutOptions
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type GetProps<T> = T extends LayoutOptions
|
||||
? T['component'] extends LayoutTemplate<infer P>
|
||||
? LayoutComponent<ObjectFieldTemplateProps<P>>
|
||||
: never
|
||||
: never;
|
||||
|
||||
/**
|
||||
* Method for creating custom Layouts that can be used in the scaffolder frontend form
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function createScaffolderLayout(
|
||||
export function createScaffolderLayout<TInputProps = unknown>(
|
||||
options: LayoutOptions,
|
||||
): Extension<GetProps<typeof options>> {
|
||||
): Extension<LayoutComponent<TInputProps>> {
|
||||
return {
|
||||
expose() {
|
||||
const LayoutDataHolder: any = () => null;
|
||||
|
||||
Reference in New Issue
Block a user