fix api-report warnings
Signed-off-by: Paul Cowan <paul.cowan@cutting.scot>
This commit is contained in:
@@ -16,12 +16,12 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
createScaffolderLayout,
|
||||
ObjectFieldTemplate,
|
||||
LayoutTemplate,
|
||||
scaffolderPlugin,
|
||||
} from '@backstage/plugin-scaffolder';
|
||||
import { Grid } from '@material-ui/core';
|
||||
|
||||
const TwoColum: ObjectFieldTemplate = ({ properties, description, title }) => {
|
||||
const TwoColumn: LayoutTemplate = ({ properties, description, title }) => {
|
||||
const mid = Math.ceil(properties.length / 2);
|
||||
const left = properties.slice(0, mid);
|
||||
const right = properties.slice(mid);
|
||||
@@ -49,6 +49,6 @@ const TwoColum: ObjectFieldTemplate = ({ properties, description, title }) => {
|
||||
export const TwoColumnLayout = scaffolderPlugin.provide(
|
||||
createScaffolderLayout({
|
||||
name: 'TwoColumn',
|
||||
component: TwoColum,
|
||||
component: TwoColumn,
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -16,6 +16,7 @@ import { ExternalRouteRef } from '@backstage/core-plugin-api';
|
||||
import { FetchApi } from '@backstage/core-plugin-api';
|
||||
import { FieldProps } from '@rjsf/core';
|
||||
import { FieldValidation } from '@rjsf/core';
|
||||
import type { FormProps } from '@rjsf/core';
|
||||
import { IdentityApi } from '@backstage/core-plugin-api';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { JSONSchema7 } from 'json-schema';
|
||||
@@ -38,10 +39,7 @@ export function createScaffolderFieldExtension<
|
||||
options: FieldExtensionOptions<TReturnValue, TInputProps>,
|
||||
): Extension<FieldExtensionComponent<TReturnValue, TInputProps>>;
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "GetProps" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-missing-release-tag) "createScaffolderLayout" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
// @public
|
||||
export function createScaffolderLayout(
|
||||
options: LayoutOptions,
|
||||
): Extension<GetProps<typeof options>>;
|
||||
@@ -119,16 +117,27 @@ export type FieldExtensionOptions<
|
||||
validation?: CustomFieldValidator<TFieldReturnValue>;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "LayoutOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
// @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;
|
||||
|
||||
// @public
|
||||
export interface LayoutOptions<P = any> {
|
||||
// (undocumented)
|
||||
component: ObjectFieldTemplate<P>;
|
||||
component: LayoutTemplate<P>;
|
||||
// (undocumented)
|
||||
name: string;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type LayoutTemplate<T = any> = FormProps<T>['ObjectFieldTemplate'];
|
||||
|
||||
// @public
|
||||
export type ListActionsResponse = Array<{
|
||||
id: string;
|
||||
@@ -168,13 +177,6 @@ export const NextScaffolderPage: (
|
||||
props: PropsWithChildren<NextRouterProps>,
|
||||
) => JSX.Element;
|
||||
|
||||
// Warning: (ae-missing-release-tag) "ObjectFieldTemplate" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type ObjectFieldTemplate<P = any> = (
|
||||
c: ObjectFieldTemplateProps<P>,
|
||||
) => JSX.Element;
|
||||
|
||||
// @public
|
||||
export const OwnedEntityPickerFieldExtension: FieldExtensionComponent<
|
||||
string,
|
||||
@@ -375,9 +377,7 @@ export interface ScaffolderGetIntegrationsListResponse {
|
||||
}[];
|
||||
}
|
||||
|
||||
// Warning: (ae-missing-release-tag) "ScaffolderLayouts" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
// @public
|
||||
export const ScaffolderLayouts: React.ComponentType;
|
||||
|
||||
// @public (undocumented)
|
||||
|
||||
@@ -49,7 +49,12 @@ export type {
|
||||
FieldExtensionComponent,
|
||||
} from './extensions';
|
||||
export { createScaffolderLayout, ScaffolderLayouts } from './layouts';
|
||||
export type { LayoutOptions, ObjectFieldTemplate } from './layouts';
|
||||
export type {
|
||||
LayoutOptions,
|
||||
LayoutTemplate,
|
||||
GetProps,
|
||||
LayoutComponent,
|
||||
} from './layouts';
|
||||
export {
|
||||
EntityPickerFieldExtension,
|
||||
EntityNamePickerFieldExtension,
|
||||
|
||||
@@ -16,19 +16,34 @@
|
||||
|
||||
import { attachComponentData, Extension } from '@backstage/core-plugin-api';
|
||||
import { ObjectFieldTemplateProps } from '@rjsf/core';
|
||||
import type { LayoutOptions, ObjectFieldTemplate } from './types';
|
||||
import type { LayoutOptions, LayoutTemplate } from './types';
|
||||
|
||||
export const LAYOUTS_KEY = 'scaffolder.layout.v1';
|
||||
export const LAYOUTS_WRAPPER_KEY = 'scaffolder.layouts.wrapper.v1';
|
||||
|
||||
type LayoutComponent<_TInputProps> = () => null;
|
||||
/**
|
||||
* The type used to wrap up the Layout and embed the input props
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type LayoutComponent<_TInputProps> = () => null;
|
||||
|
||||
type GetProps<T> = T extends LayoutOptions
|
||||
? T['component'] extends ObjectFieldTemplate<infer P>
|
||||
/**
|
||||
* 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(
|
||||
options: LayoutOptions,
|
||||
): Extension<GetProps<typeof options>> {
|
||||
@@ -43,12 +58,17 @@ export function createScaffolderLayout(
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The wrapping component for defining scaffolder layouts as children
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const ScaffolderLayouts: React.ComponentType = (): JSX.Element | null =>
|
||||
null;
|
||||
|
||||
attachComponentData(ScaffolderLayouts, LAYOUTS_WRAPPER_KEY, true);
|
||||
|
||||
export type { LayoutOptions, ObjectFieldTemplate } from './types';
|
||||
export type { LayoutOptions, LayoutTemplate } from './types';
|
||||
|
||||
export { DEFAULT_SCAFFOLDER_LAYOUT } from './default';
|
||||
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
import { UiSchema } from '@rjsf/core';
|
||||
import { DEFAULT_SCAFFOLDER_LAYOUT } from './default';
|
||||
import { LayoutOptions, ObjectFieldTemplate } from './types';
|
||||
import { LayoutOptions, LayoutTemplate } from './types';
|
||||
|
||||
export function resolveStepLayout(
|
||||
uiSchema: UiSchema = {},
|
||||
layouts: LayoutOptions[],
|
||||
): ObjectFieldTemplate {
|
||||
): LayoutTemplate {
|
||||
const layoutName = uiSchema?.['ui:layout'] ?? DEFAULT_SCAFFOLDER_LAYOUT.name;
|
||||
|
||||
delete uiSchema?.['ui:layout'];
|
||||
|
||||
@@ -13,13 +13,21 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import type { ObjectFieldTemplateProps } from '@rjsf/core';
|
||||
import type { FormProps } from '@rjsf/core';
|
||||
|
||||
export type ObjectFieldTemplate<P = any> = (
|
||||
c: ObjectFieldTemplateProps<P>,
|
||||
) => JSX.Element;
|
||||
/**
|
||||
* The field template from \@rjsf/core which is a react component that gets passed \@rjsf/core field related props.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type LayoutTemplate<T = any> = FormProps<T>['ObjectFieldTemplate'];
|
||||
|
||||
/**
|
||||
* The type of layouts that is passed to the TemplateForms
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface LayoutOptions<P = any> {
|
||||
name: string;
|
||||
component: ObjectFieldTemplate<P>;
|
||||
component: LayoutTemplate<P>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user