@backstage/plugin-scaffolder-react 1.1.0 → 1.1.1-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @backstage/plugin-scaffolder-react
2
2
 
3
+ ## 1.1.1-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - c8d78b9ae9: fix bug with `hasErrors` returning false when dealing with empty objects
8
+ - 928a12a9b3: Internal refactor of `/alpha` exports.
9
+ - cc418d652a: scaffolder/next: Added the ability to get the fields definition in the schema in the validation function
10
+ - d4100d0ec4: Fix alignment bug for owners on `TemplateCard`
11
+ - Updated dependencies
12
+ - @backstage/catalog-client@1.4.0-next.0
13
+ - @backstage/plugin-catalog-react@1.4.0-next.0
14
+ - @backstage/core-plugin-api@1.4.1-next.0
15
+ - @backstage/catalog-model@1.2.1-next.0
16
+ - @backstage/core-components@0.12.5-next.0
17
+ - @backstage/errors@1.1.4
18
+ - @backstage/theme@0.2.17
19
+ - @backstage/types@1.0.2
20
+ - @backstage/version-bridge@1.0.3
21
+ - @backstage/plugin-scaffolder-common@1.2.6-next.0
22
+
3
23
  ## 1.1.0
4
24
 
5
25
  ### Minor Changes
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-react",
3
- "version": "1.1.0",
4
- "main": "../dist/index.esm.js",
5
- "types": "../dist/index.alpha.d.ts"
3
+ "version": "1.1.1-next.0",
4
+ "main": "../dist/alpha.esm.js",
5
+ "module": "../dist/alpha.esm.js",
6
+ "types": "../dist/alpha.d.ts"
6
7
  }
@@ -0,0 +1,223 @@
1
+ /// <reference types="react" />
2
+ import { JsonObject, JsonValue } from '@backstage/types';
3
+ import * as react from 'react';
4
+ import react__default, { PropsWithChildren, ReactNode } from 'react';
5
+ import { ApiHolder, Extension, IconComponent } from '@backstage/core-plugin-api';
6
+ import * as _rjsf_utils from '@rjsf/utils';
7
+ import { FieldProps, UiSchema, UIOptionsType, FieldValidation } from '@rjsf/utils';
8
+ import { CustomFieldExtensionSchema, FieldExtensionComponent, TemplateParameterSchema, LayoutOptions, ScaffolderTaskOutput } from '@backstage/plugin-scaffolder-react';
9
+ import * as _rjsf_core_v5 from '@rjsf/core-v5';
10
+ import { FormProps as FormProps$1 } from '@rjsf/core-v5';
11
+ import { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';
12
+
13
+ /**
14
+ * Type for Field Extension Props for RJSF v5
15
+ *
16
+ * @alpha
17
+ */
18
+ interface NextFieldExtensionComponentProps<TFieldReturnValue, TUiOptions = {}> extends PropsWithChildren<FieldProps<TFieldReturnValue>> {
19
+ uiSchema?: UiSchema<TFieldReturnValue> & {
20
+ 'ui:options'?: TUiOptions & UIOptionsType;
21
+ };
22
+ }
23
+ /**
24
+ * Field validation type for Custom Field Extensions.
25
+ *
26
+ * @alpha
27
+ */
28
+ declare type NextCustomFieldValidator<TFieldReturnValue> = (data: TFieldReturnValue, field: FieldValidation, context: {
29
+ apiHolder: ApiHolder;
30
+ formData: JsonObject;
31
+ schema: JsonObject;
32
+ }) => void | Promise<void>;
33
+ /**
34
+ * Type for the Custom Field Extension with the
35
+ * name and components and validation function.
36
+ *
37
+ * @alpha
38
+ */
39
+ declare type NextFieldExtensionOptions<TFieldReturnValue = unknown, TInputProps = unknown> = {
40
+ name: string;
41
+ component: (props: NextFieldExtensionComponentProps<TFieldReturnValue, TInputProps>) => JSX.Element | null;
42
+ validation?: NextCustomFieldValidator<TFieldReturnValue>;
43
+ schema?: CustomFieldExtensionSchema;
44
+ };
45
+
46
+ /**
47
+ * Method for creating field extensions that can be used in the scaffolder
48
+ * frontend form.
49
+ * @alpha
50
+ */
51
+ declare function createNextScaffolderFieldExtension<TReturnValue = unknown, TInputProps extends UIOptionsType = {}>(options: NextFieldExtensionOptions<TReturnValue, TInputProps>): Extension<FieldExtensionComponent<TReturnValue, TInputProps>>;
52
+
53
+ /**
54
+ * This is the parsed template schema that is returned from the {@link useTemplateSchema} hook.
55
+ * @alpha
56
+ */
57
+ interface ParsedTemplateSchema {
58
+ uiSchema: UiSchema;
59
+ mergedSchema: JsonObject;
60
+ schema: JsonObject;
61
+ title: string;
62
+ description?: string;
63
+ }
64
+ /**
65
+ * This hook will parse the template schema and return the steps with the
66
+ * parsed schema and uiSchema. Filtering out any steps or properties that
67
+ * are not enabled with feature flags.
68
+ * @alpha
69
+ */
70
+ declare const useTemplateSchema: (manifest: TemplateParameterSchema) => {
71
+ steps: ParsedTemplateSchema[];
72
+ };
73
+
74
+ /**
75
+ * The props for the {@link ReviewState} component.
76
+ * @alpha
77
+ */
78
+ declare type ReviewStateProps = {
79
+ schemas: ParsedTemplateSchema[];
80
+ formState: JsonObject;
81
+ };
82
+ /**
83
+ * The component used by the {@link Stepper} to render the review step.
84
+ * @alpha
85
+ */
86
+ declare const ReviewState: (props: ReviewStateProps) => JSX.Element;
87
+
88
+ /**
89
+ * Any `@rjsf/core` form properties that are publicly exposed to the `NextScaffolderpage`
90
+ *
91
+ * @alpha
92
+ */
93
+ declare type FormProps = Pick<FormProps$1, 'transformErrors' | 'noHtml5Validate'>;
94
+
95
+ /**
96
+ * The Props for {@link Stepper} component
97
+ * @alpha
98
+ */
99
+ declare type StepperProps = {
100
+ manifest: TemplateParameterSchema;
101
+ extensions: NextFieldExtensionOptions<any, any>[];
102
+ templateName?: string;
103
+ FormProps?: FormProps;
104
+ initialState?: Record<string, JsonValue>;
105
+ onCreate: (values: Record<string, JsonValue>) => Promise<void>;
106
+ components?: {
107
+ ReviewStateComponent?: (props: ReviewStateProps) => JSX.Element;
108
+ createButtonText?: ReactNode;
109
+ reviewButtonText?: ReactNode;
110
+ };
111
+ layouts?: LayoutOptions[];
112
+ };
113
+ /**
114
+ * The `Stepper` component is the Wizard that is rendered when a user selects a template
115
+ * @alpha
116
+ */
117
+ declare const Stepper: (stepperProps: StepperProps) => JSX.Element;
118
+
119
+ /**
120
+ * The Props for the {@link TemplateCard} component
121
+ * @alpha
122
+ */
123
+ interface TemplateCardProps {
124
+ template: TemplateEntityV1beta3;
125
+ additionalLinks?: {
126
+ icon: IconComponent;
127
+ text: string;
128
+ url: string;
129
+ }[];
130
+ onSelected?: (template: TemplateEntityV1beta3) => void;
131
+ }
132
+ /**
133
+ * The `TemplateCard` component that is rendered in a list for each template
134
+ * @alpha
135
+ */
136
+ declare const TemplateCard: (props: TemplateCardProps) => JSX.Element;
137
+
138
+ /**
139
+ * The props for the {@link TemplateGroup} component.
140
+ * @alpha
141
+ */
142
+ interface TemplateGroupProps {
143
+ templates: {
144
+ template: TemplateEntityV1beta3;
145
+ additionalLinks?: {
146
+ icon: IconComponent;
147
+ text: string;
148
+ url: string;
149
+ }[];
150
+ }[];
151
+ onSelected: (template: TemplateEntityV1beta3) => void;
152
+ title: react__default.ReactNode;
153
+ components?: {
154
+ CardComponent?: react__default.ComponentType<TemplateCardProps>;
155
+ };
156
+ }
157
+ /**
158
+ * The `TemplateGroup` component is used to display a group of templates with a title.
159
+ * @alpha
160
+ */
161
+ declare const TemplateGroup: (props: TemplateGroupProps) => JSX.Element;
162
+
163
+ /**
164
+ * @alpha
165
+ */
166
+ declare type WorkflowProps = {
167
+ title?: string;
168
+ description?: string;
169
+ namespace: string;
170
+ templateName: string;
171
+ onError(error: Error | undefined): JSX.Element | null;
172
+ } & Pick<StepperProps, 'extensions' | 'FormProps' | 'components' | 'onCreate' | 'initialState' | 'layouts'>;
173
+ /**
174
+ * @alpha
175
+ */
176
+ declare const Workflow: (workflowProps: WorkflowProps) => JSX.Element | null;
177
+ /**
178
+ * @alpha
179
+ */
180
+ declare const EmbeddableWorkflow: (props: WorkflowProps) => JSX.Element;
181
+
182
+ /**
183
+ * The DefaultOutputs renderer for the scaffolder task output
184
+ *
185
+ * @alpha
186
+ */
187
+ declare const DefaultTemplateOutputs: (props: {
188
+ output?: ScaffolderTaskOutput;
189
+ }) => JSX.Element | null;
190
+
191
+ /** @alpha */
192
+ declare const Form: react.ComponentType<_rjsf_core_v5.FormProps<any, _rjsf_utils.RJSFSchema, any>>;
193
+
194
+ /**
195
+ * Takes a step from a Backstage Template Manifest and converts it to a JSON Schema and UI Schema for rjsf
196
+ * @alpha
197
+ */
198
+ declare const extractSchemaFromStep: (inputStep: JsonObject) => {
199
+ uiSchema: UiSchema;
200
+ schema: JsonObject;
201
+ };
202
+ /**
203
+ * Creates a field validation object for use in react jsonschema form
204
+ * @alpha
205
+ */
206
+ declare const createFieldValidation: () => FieldValidation;
207
+
208
+ /**
209
+ * This hook is used to get the formData from the query string.
210
+ * @alpha
211
+ */
212
+ declare const useFormDataFromQuery: (initialState?: Record<string, JsonValue>) => [Record<string, any>, react.Dispatch<react.SetStateAction<Record<string, any>>>];
213
+
214
+ /**
215
+ * @alpha
216
+ */
217
+ declare const useTemplateParameterSchema: (templateRef: string) => {
218
+ manifest: TemplateParameterSchema;
219
+ loading: boolean;
220
+ error: Error | undefined;
221
+ };
222
+
223
+ export { DefaultTemplateOutputs, EmbeddableWorkflow, Form, FormProps, NextCustomFieldValidator, NextFieldExtensionComponentProps, NextFieldExtensionOptions, ParsedTemplateSchema, ReviewState, ReviewStateProps, Stepper, StepperProps, TemplateCard, TemplateCardProps, TemplateGroup, TemplateGroupProps, Workflow, WorkflowProps, createFieldValidation, createNextScaffolderFieldExtension, extractSchemaFromStep, useFormDataFromQuery, useTemplateParameterSchema, useTemplateSchema };