@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user