@@ -116,12 +116,25 @@ export type FieldExtensionOptions<
|
||||
schema?: CustomFieldExtensionSchema;
|
||||
};
|
||||
|
||||
// @alpha
|
||||
// @public
|
||||
export type FormProps = Pick<
|
||||
FormProps_2,
|
||||
'transformErrors' | 'noHtml5Validate'
|
||||
>;
|
||||
|
||||
// @public
|
||||
export interface LayoutOptions<P = any> {
|
||||
// (undocumented)
|
||||
component: LayoutTemplate<P>;
|
||||
// (undocumented)
|
||||
name: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type LayoutTemplate<T = any> = NonNullable<
|
||||
FormProps_2<T>['uiSchema']
|
||||
>['ui:ObjectFieldTemplate'];
|
||||
|
||||
// @public
|
||||
export type ListActionsResponse = Array<Action>;
|
||||
|
||||
@@ -346,21 +359,30 @@ export const SecretsContextProvider: ({
|
||||
}: PropsWithChildren<{}>) => JSX.Element;
|
||||
|
||||
// @alpha
|
||||
<<<<<<< HEAD
|
||||
export const Stepper: (stepperProps: StepperProps) => JSX.Element;
|
||||
=======
|
||||
export const Stepper: ({ layouts, ...props }: StepperProps) => JSX.Element;
|
||||
>>>>>>> be504a73cc (run api-report)
|
||||
|
||||
// @alpha
|
||||
export type StepperProps = {
|
||||
manifest: TemplateParameterSchema;
|
||||
extensions: NextFieldExtensionOptions<any, any>[];
|
||||
templateName?: string;
|
||||
FormProps?: FormProps;
|
||||
initialState?: Record<string, JsonValue>;
|
||||
<<<<<<< HEAD
|
||||
onCreate: (values: Record<string, JsonValue>) => Promise<void>;
|
||||
components?: {
|
||||
ReviewStateComponent?: (props: ReviewStateProps) => JSX.Element;
|
||||
createButtonText?: ReactNode;
|
||||
reviewButtonText?: ReactNode;
|
||||
};
|
||||
=======
|
||||
onComplete: (values: Record<string, JsonValue>) => Promise<void>;
|
||||
FormProps?: FormProps;
|
||||
layouts?: LayoutOptions[];
|
||||
>>>>>>> be504a73cc (run api-report)
|
||||
};
|
||||
|
||||
// @alpha
|
||||
@@ -422,6 +444,11 @@ export const useCustomFieldExtensions: <
|
||||
outlet: React.ReactNode,
|
||||
) => TComponentDataType[];
|
||||
|
||||
// @public
|
||||
export const useCustomLayouts: <TComponentDataType = LayoutOptions<any>>(
|
||||
outlet: React.ReactNode,
|
||||
) => TComponentDataType[];
|
||||
|
||||
// @alpha
|
||||
export const useFormDataFromQuery: (
|
||||
initialState?: Record<string, JsonValue>,
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
import { useElementFilter } from '@backstage/core-plugin-api';
|
||||
import { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from '../next/layouts/keys';
|
||||
import { type NextLayoutOptions } from '../next/types';
|
||||
import { type LayoutOptions } from '../next/types';
|
||||
|
||||
/**
|
||||
* Hook that returns all custom field extensions from the current outlet.
|
||||
* @public
|
||||
*/
|
||||
export const useCustomLayouts = <TComponentDataType = NextLayoutOptions>(
|
||||
export const useCustomLayouts = <TComponentDataType = LayoutOptions>(
|
||||
outlet: React.ReactNode,
|
||||
) => {
|
||||
return useElementFilter(outlet, elements =>
|
||||
|
||||
@@ -28,11 +28,11 @@ import React, { useCallback, useMemo, useState, type ReactNode } from 'react';
|
||||
import { NextFieldExtensionOptions } from '../../extensions';
|
||||
import { TemplateParameterSchema } from '../../../types';
|
||||
import { createAsyncValidators } from './createAsyncValidators';
|
||||
import type { FormProps, LayoutOptions } from '../../types';
|
||||
import { ReviewState, type ReviewStateProps } from '../ReviewState';
|
||||
import { useTemplateSchema } from '../../hooks/useTemplateSchema';
|
||||
import validator from '@rjsf/validator-ajv6';
|
||||
import { useFormDataFromQuery } from '../../hooks';
|
||||
import type { FormProps, LayoutOptions } from '../../types';
|
||||
import { useTransformSchemaToProps } from '../../hooks/useTransformSchemaToProps';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { type ParsedTemplateSchema } from './useTemplateSchema';
|
||||
import { type NextLayoutOptions } from '../types';
|
||||
import { type LayoutOptions } from '../types';
|
||||
|
||||
export const useTransformSchemaToProps = (
|
||||
step: ParsedTemplateSchema,
|
||||
layouts: NextLayoutOptions[] = [],
|
||||
layouts: LayoutOptions[] = [],
|
||||
): ParsedTemplateSchema => {
|
||||
const objectFieldTemplate = step?.uiSchema['ui:ObjectFieldTemplate'] as
|
||||
| string
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
export * from './components';
|
||||
export * from './extensions';
|
||||
export type { FormProps } from './types';
|
||||
export * from './types';
|
||||
export * from './lib';
|
||||
export * from './hooks';
|
||||
export * from './layouts';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { NextLayoutOptions } from '../types';
|
||||
import { LayoutOptions } from '../types';
|
||||
import { LAYOUTS_KEY, LAYOUTS_WRAPPER_KEY } from './keys';
|
||||
|
||||
/*
|
||||
@@ -26,7 +26,7 @@ export type LayoutComponent<_TInputProps> = () => null;
|
||||
* @public
|
||||
*/
|
||||
export function createScaffolderLayout<TInputProps = unknown>(
|
||||
options: NextLayoutOptions,
|
||||
options: LayoutOptions,
|
||||
): Extension<LayoutComponent<TInputProps>> {
|
||||
return {
|
||||
expose() {
|
||||
|
||||
@@ -22,7 +22,8 @@ import { FieldExtensionComponentProps as FieldExtensionComponentProps_2 } from '
|
||||
import { FieldExtensionOptions as FieldExtensionOptions_2 } from '@backstage/plugin-scaffolder-react';
|
||||
import { FieldValidation } from '@rjsf/core';
|
||||
import type { FormProps as FormProps_2 } from '@rjsf/core';
|
||||
import type { FormProps as FormProps_3 } from '@rjsf/core-v5';
|
||||
import { FormProps as FormProps_3 } from '@backstage/plugin-scaffolder-react';
|
||||
import type { FormProps as FormProps_4 } from '@rjsf/core-v5';
|
||||
import { IdentityApi } from '@backstage/core-plugin-api';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { ListActionsResponse as ListActionsResponse_2 } from '@backstage/plugin-scaffolder-react';
|
||||
@@ -157,7 +158,7 @@ export interface FieldSchema<TReturn, TUiOptions> {
|
||||
|
||||
// @alpha @deprecated
|
||||
export type FormProps = Pick<
|
||||
FormProps_3,
|
||||
FormProps_4,
|
||||
'transformErrors' | 'noHtml5Validate'
|
||||
>;
|
||||
|
||||
@@ -195,56 +196,6 @@ export function makeFieldSchemaFromZod<
|
||||
: never
|
||||
>;
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// @alpha
|
||||
export type NextCustomFieldValidator<TFieldReturnValue> = (
|
||||
data: TFieldReturnValue,
|
||||
field: FieldValidation_2,
|
||||
context: {
|
||||
apiHolder: ApiHolder;
|
||||
formData: JsonObject;
|
||||
},
|
||||
) => void | Promise<void>;
|
||||
|
||||
// @alpha
|
||||
export interface NextFieldExtensionComponentProps<
|
||||
TFieldReturnValue,
|
||||
TUiOptions = {},
|
||||
> extends PropsWithChildren<FieldProps_2<TFieldReturnValue>> {
|
||||
// (undocumented)
|
||||
uiSchema?: UiSchema<TFieldReturnValue> & {
|
||||
'ui:options'?: TUiOptions & UIOptionsType;
|
||||
};
|
||||
}
|
||||
|
||||
// @alpha
|
||||
export type NextFieldExtensionOptions<
|
||||
TFieldReturnValue = unknown,
|
||||
TInputProps = unknown,
|
||||
> = {
|
||||
name: string;
|
||||
component: (
|
||||
props: NextFieldExtensionComponentProps<TFieldReturnValue, TInputProps>,
|
||||
) => JSX.Element | null;
|
||||
validation?: NextCustomFieldValidator<TFieldReturnValue>;
|
||||
schema?: CustomFieldExtensionSchema;
|
||||
};
|
||||
|
||||
// @alpha
|
||||
export interface NextLayoutOptions<P = any> {
|
||||
// (undocumented)
|
||||
component: NextLayoutTemplate<P>;
|
||||
// (undocumented)
|
||||
name: string;
|
||||
}
|
||||
|
||||
// @alpha
|
||||
export type NextLayoutTemplate<T = any> = NonNullable<
|
||||
FormProps_3<T>['uiSchema']
|
||||
>['ui:ObjectFieldTemplate'];
|
||||
|
||||
>>>>>>> a3e361fbb8 (run api-report)
|
||||
// @alpha (undocumented)
|
||||
export const nextRouteRef: RouteRef<undefined>;
|
||||
|
||||
@@ -257,7 +208,7 @@ export type NextRouterProps = {
|
||||
TaskPageComponent?: React_2.ComponentType<{}>;
|
||||
};
|
||||
groups?: TemplateGroupFilter[];
|
||||
FormProps?: FormProps;
|
||||
FormProps?: FormProps_3;
|
||||
};
|
||||
|
||||
// @alpha
|
||||
@@ -576,18 +527,6 @@ export type TemplateParameterSchema = TemplateParameterSchema_2;
|
||||
// @public
|
||||
export const TemplateTypePicker: () => JSX.Element | null;
|
||||
|
||||
<<<<<<< HEAD
|
||||
// @public @deprecated (undocumented)
|
||||
export const useTemplateSecrets: () => ScaffolderUseTemplateSecrets_2;
|
||||
=======
|
||||
// @public
|
||||
export const useTemplateSecrets: () => ScaffolderUseTemplateSecrets;
|
||||
<<<<<<< HEAD
|
||||
|
||||
// Warnings were encountered during analysis:
|
||||
//
|
||||
// src/next/types.d.ts:23:5 - (ae-forgotten-export) The symbol "NextLayoutOptions" needs to be exported by the entry point index.d.ts
|
||||
>>>>>>> 55041019c8 (export NextLayoutOptions)
|
||||
=======
|
||||
>>>>>>> a3e361fbb8 (run api-report)
|
||||
```
|
||||
|
||||
@@ -25,15 +25,10 @@ import {
|
||||
import {
|
||||
scaffolderApiRef,
|
||||
useTemplateSecrets,
|
||||
type NextFieldExtensionOptions,
|
||||
Workflow
|
||||
type NextLayoutOptions,
|
||||
Workflow,
|
||||
type LayoutOptions
|
||||
} from '@backstage/plugin-scaffolder-react';
|
||||
import useAsync from 'react-use/lib/useAsync';
|
||||
import { makeStyles } from '@material-ui/core';
|
||||
import { BackstageTheme } from '@backstage/theme';
|
||||
import {
|
||||
Stepper,
|
||||
NextFieldExtensionOptions,
|
||||
} from '@backstage/plugin-scaffolder-react';
|
||||
import { JsonValue } from '@backstage/types';
|
||||
@@ -41,7 +36,6 @@ import { type FormProps } from '../types';
|
||||
import { nextRouteRef } from '../routes';
|
||||
import { scaffolderTaskRouteRef, selectedTemplateRouteRef } from '../../routes';
|
||||
import { Header, Page } from '@backstage/core-components';
|
||||
import type { LayoutOptions } from '../../layouts/types';
|
||||
|
||||
export type TemplateWizardPageProps = {
|
||||
customFieldExtensions: NextFieldExtensionOptions<any, any>[];
|
||||
@@ -92,6 +86,7 @@ export const TemplateWizardPage = (props: TemplateWizardPageProps) => {
|
||||
onError={onError}
|
||||
extensions={props.customFieldExtensions}
|
||||
FormProps={props.FormProps}
|
||||
layouts={props.layouts}
|
||||
/>
|
||||
</Page>
|
||||
</AnalyticsContext>
|
||||
|
||||
Reference in New Issue
Block a user