@backstage/plugin-scaffolder-react 1.5.6 → 1.6.0-next.1
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 +45 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.d.ts +64 -72
- package/dist/alpha.esm.js +90 -42
- package/dist/alpha.esm.js.map +1 -1
- package/dist/index.d.ts +292 -27
- package/dist/index.esm.js.map +1 -1
- package/package.json +16 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-react
|
|
2
2
|
|
|
3
|
+
## 1.6.0-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 62b5922916: Internal theme type updates
|
|
8
|
+
- 76d07da66a: Make it possible to define control buttons text (Back, Create, Review) per template
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @backstage/plugin-catalog-react@1.9.0-next.1
|
|
11
|
+
- @backstage/plugin-scaffolder-common@1.4.3-next.1
|
|
12
|
+
- @backstage/core-components@0.13.8-next.1
|
|
13
|
+
- @backstage/catalog-client@1.4.5
|
|
14
|
+
- @backstage/catalog-model@1.4.3
|
|
15
|
+
- @backstage/core-plugin-api@1.8.0-next.0
|
|
16
|
+
- @backstage/errors@1.2.3
|
|
17
|
+
- @backstage/theme@0.4.4-next.0
|
|
18
|
+
- @backstage/types@1.1.1
|
|
19
|
+
- @backstage/version-bridge@1.0.7-next.0
|
|
20
|
+
|
|
21
|
+
## 1.6.0-next.0
|
|
22
|
+
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- 3fdffbb699: Release design improvements for the `Scaffolder` plugin and support v5 of `@rjsf/*` libraries.
|
|
26
|
+
|
|
27
|
+
This change should be non-breaking. If you're seeing typescript issues after migrating please [open an issue](https://github.com/backstage/backstage/issues/new/choose)
|
|
28
|
+
|
|
29
|
+
The `next` versions like `createNextFieldExtension` and `NextScaffolderPage` have been promoted to the public interface under `createScaffolderFieldExtension` and `ScaffolderPage`, so any older imports which are no longer found will need updating from `@backstage/plugin-scaffolder/alpha` or `@backstage/plugin-scaffolder-react/alpha` will need to be imported from `@backstage/plugin-scaffolder` and `@backstage/plugin-scaffolder-react` respectively.
|
|
30
|
+
|
|
31
|
+
The legacy versions are now available in `/alpha` under `createLegacyFieldExtension` and `LegacyScaffolderPage` if you're running into issues, but be aware that these will be removed in a next mainline release.
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- 6c2b872153: Add official support for React 18.
|
|
36
|
+
- Updated dependencies
|
|
37
|
+
- @backstage/core-components@0.13.7-next.0
|
|
38
|
+
- @backstage/plugin-scaffolder-common@1.4.3-next.0
|
|
39
|
+
- @backstage/plugin-catalog-react@1.9.0-next.0
|
|
40
|
+
- @backstage/core-plugin-api@1.8.0-next.0
|
|
41
|
+
- @backstage/version-bridge@1.0.7-next.0
|
|
42
|
+
- @backstage/theme@0.4.4-next.0
|
|
43
|
+
- @backstage/catalog-client@1.4.5
|
|
44
|
+
- @backstage/catalog-model@1.4.3
|
|
45
|
+
- @backstage/errors@1.2.3
|
|
46
|
+
- @backstage/types@1.1.1
|
|
47
|
+
|
|
3
48
|
## 1.5.6
|
|
4
49
|
|
|
5
50
|
### Patch Changes
|
package/alpha/package.json
CHANGED
package/dist/alpha.d.ts
CHANGED
|
@@ -1,59 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { JsonObject, JsonValue } from '@backstage/types';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import React__default, {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { TemplateEntityV1beta3, TaskStep } from '@backstage/plugin-scaffolder-common';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Type for Field Extension Props for RJSF v5
|
|
13
|
-
*
|
|
14
|
-
* @alpha
|
|
15
|
-
*/
|
|
16
|
-
interface NextFieldExtensionComponentProps<TFieldReturnValue, TUiOptions = {}> extends PropsWithChildren<FieldProps<TFieldReturnValue>> {
|
|
17
|
-
uiSchema?: NextFieldExtensionUiSchema<TFieldReturnValue, TUiOptions>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Type for Field Extension UiSchema
|
|
21
|
-
*
|
|
22
|
-
* @alpha
|
|
23
|
-
*/
|
|
24
|
-
interface NextFieldExtensionUiSchema<TFieldReturnValue, TUiOptions> extends UiSchema<TFieldReturnValue> {
|
|
25
|
-
'ui:options'?: TUiOptions & UIOptionsType;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Field validation type for Custom Field Extensions.
|
|
29
|
-
*
|
|
30
|
-
* @alpha
|
|
31
|
-
*/
|
|
32
|
-
type NextCustomFieldValidator<TFieldReturnValue, TUiOptions = unknown> = (data: TFieldReturnValue, field: FieldValidation, context: {
|
|
33
|
-
apiHolder: ApiHolder;
|
|
34
|
-
formData: JsonObject;
|
|
35
|
-
schema: JsonObject;
|
|
36
|
-
uiSchema?: NextFieldExtensionUiSchema<TFieldReturnValue, TUiOptions>;
|
|
37
|
-
}) => void | Promise<void>;
|
|
38
|
-
/**
|
|
39
|
-
* Type for the Custom Field Extension with the
|
|
40
|
-
* name and components and validation function.
|
|
41
|
-
*
|
|
42
|
-
* @alpha
|
|
43
|
-
*/
|
|
44
|
-
type NextFieldExtensionOptions<TFieldReturnValue = unknown, TUiOptions = unknown> = {
|
|
45
|
-
name: string;
|
|
46
|
-
component: (props: NextFieldExtensionComponentProps<TFieldReturnValue, TUiOptions>) => JSX.Element | null;
|
|
47
|
-
validation?: NextCustomFieldValidator<TFieldReturnValue, TUiOptions>;
|
|
48
|
-
schema?: CustomFieldExtensionSchema;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Method for creating field extensions that can be used in the scaffolder
|
|
53
|
-
* frontend form.
|
|
54
|
-
* @alpha
|
|
55
|
-
*/
|
|
56
|
-
declare function createNextScaffolderFieldExtension<TReturnValue = unknown, TInputProps extends UIOptionsType = {}>(options: NextFieldExtensionOptions<TReturnValue, TInputProps>): Extension<FieldExtensionComponent<TReturnValue, TInputProps>>;
|
|
4
|
+
import React__default, { ComponentType, ReactNode, PropsWithChildren, ReactElement } from 'react';
|
|
5
|
+
import { TemplatePresentationV1beta3, TemplateEntityV1beta3, TaskStep } from '@backstage/plugin-scaffolder-common';
|
|
6
|
+
import { UiSchema, FieldValidation } from '@rjsf/utils';
|
|
7
|
+
import { TemplateParameterSchema, FieldExtensionOptions, FormProps, ReviewStepProps, LayoutOptions, CustomFieldValidator, TemplateGroupFilter, ScaffolderTaskOutput, ScaffolderRJSFFormProps, ScaffolderStep, CustomFieldExtensionSchema, ScaffolderRJSFFieldProps, FieldExtensionComponent } from '@backstage/plugin-scaffolder-react';
|
|
8
|
+
import { ApiHolder, IconComponent, Extension } from '@backstage/core-plugin-api';
|
|
57
9
|
|
|
58
10
|
/**
|
|
59
11
|
* This is the parsed template schema that is returned from the {@link useTemplateSchema} hook.
|
|
@@ -74,6 +26,7 @@ interface ParsedTemplateSchema {
|
|
|
74
26
|
*/
|
|
75
27
|
declare const useTemplateSchema: (manifest: TemplateParameterSchema) => {
|
|
76
28
|
steps: ParsedTemplateSchema[];
|
|
29
|
+
presentation?: TemplatePresentationV1beta3 | undefined;
|
|
77
30
|
};
|
|
78
31
|
|
|
79
32
|
/**
|
|
@@ -90,26 +43,21 @@ type ReviewStateProps = {
|
|
|
90
43
|
*/
|
|
91
44
|
declare const ReviewState: (props: ReviewStateProps) => React__default.JSX.Element;
|
|
92
45
|
|
|
93
|
-
/**
|
|
94
|
-
* Any `@rjsf/core` form properties that are publicly exposed to the `NextScaffolderpage`
|
|
95
|
-
*
|
|
96
|
-
* @alpha
|
|
97
|
-
*/
|
|
98
|
-
type FormProps = Pick<FormProps$1, 'transformErrors' | 'noHtml5Validate'>;
|
|
99
|
-
|
|
100
46
|
/**
|
|
101
47
|
* The Props for {@link Stepper} component
|
|
102
48
|
* @alpha
|
|
103
49
|
*/
|
|
104
50
|
type StepperProps = {
|
|
105
51
|
manifest: TemplateParameterSchema;
|
|
106
|
-
extensions:
|
|
52
|
+
extensions: FieldExtensionOptions<any, any>[];
|
|
107
53
|
templateName?: string;
|
|
108
|
-
|
|
54
|
+
formProps?: FormProps;
|
|
109
55
|
initialState?: Record<string, JsonValue>;
|
|
110
56
|
onCreate: (values: Record<string, JsonValue>) => Promise<void>;
|
|
111
57
|
components?: {
|
|
58
|
+
ReviewStepComponent?: ComponentType<ReviewStepProps>;
|
|
112
59
|
ReviewStateComponent?: (props: ReviewStateProps) => JSX.Element;
|
|
60
|
+
backButtonText?: ReactNode;
|
|
113
61
|
createButtonText?: ReactNode;
|
|
114
62
|
reviewButtonText?: ReactNode;
|
|
115
63
|
};
|
|
@@ -121,6 +69,15 @@ type StepperProps = {
|
|
|
121
69
|
*/
|
|
122
70
|
declare const Stepper: (stepperProps: StepperProps) => React__default.JSX.Element;
|
|
123
71
|
|
|
72
|
+
/** @alpha */
|
|
73
|
+
type FormValidation = {
|
|
74
|
+
[name: string]: FieldValidation | FormValidation;
|
|
75
|
+
};
|
|
76
|
+
/** @alpha */
|
|
77
|
+
declare const createAsyncValidators: (rootSchema: JsonObject, validators: Record<string, undefined | CustomFieldValidator<unknown, unknown>>, context: {
|
|
78
|
+
apiHolder: ApiHolder;
|
|
79
|
+
}) => (formData: JsonObject) => Promise<FormValidation>;
|
|
80
|
+
|
|
124
81
|
/**
|
|
125
82
|
* The Props for the {@link TemplateCard} component
|
|
126
83
|
* @alpha
|
|
@@ -165,13 +122,6 @@ interface TemplateGroupProps {
|
|
|
165
122
|
*/
|
|
166
123
|
declare const TemplateGroup: (props: TemplateGroupProps) => React__default.JSX.Element | null;
|
|
167
124
|
|
|
168
|
-
/**
|
|
169
|
-
* @alpha
|
|
170
|
-
*/
|
|
171
|
-
type TemplateGroupFilter = {
|
|
172
|
-
title?: React__default.ReactNode;
|
|
173
|
-
filter: (entity: TemplateEntityV1beta3) => boolean;
|
|
174
|
-
};
|
|
175
125
|
/**
|
|
176
126
|
* @alpha
|
|
177
127
|
*/
|
|
@@ -201,8 +151,11 @@ type WorkflowProps = {
|
|
|
201
151
|
description?: string;
|
|
202
152
|
namespace: string;
|
|
203
153
|
templateName: string;
|
|
154
|
+
components?: {
|
|
155
|
+
ReviewStepComponent?: React__default.ComponentType<ReviewStepProps>;
|
|
156
|
+
};
|
|
204
157
|
onError(error: Error | undefined): JSX.Element | null;
|
|
205
|
-
} & Pick<StepperProps, 'extensions' | '
|
|
158
|
+
} & Pick<StepperProps, 'extensions' | 'formProps' | 'components' | 'onCreate' | 'initialState' | 'layouts'>;
|
|
206
159
|
/**
|
|
207
160
|
* @alpha
|
|
208
161
|
*/
|
|
@@ -225,7 +178,7 @@ declare const DefaultTemplateOutputs: (props: {
|
|
|
225
178
|
* The Form component
|
|
226
179
|
* @alpha
|
|
227
180
|
*/
|
|
228
|
-
declare const Form: (props: PropsWithChildren<
|
|
181
|
+
declare const Form: (props: PropsWithChildren<ScaffolderRJSFFormProps>) => React__default.JSX.Element;
|
|
229
182
|
|
|
230
183
|
/**
|
|
231
184
|
* Props for the TaskSteps component
|
|
@@ -326,4 +279,43 @@ declare const useTemplateParameterSchema: (templateRef: string) => {
|
|
|
326
279
|
error: Error | undefined;
|
|
327
280
|
};
|
|
328
281
|
|
|
329
|
-
|
|
282
|
+
/**
|
|
283
|
+
* Field validation type for Custom Field Extensions.
|
|
284
|
+
*
|
|
285
|
+
* @alpha
|
|
286
|
+
*/
|
|
287
|
+
type LegacyCustomFieldValidator<TFieldReturnValue> = (data: TFieldReturnValue, field: FieldValidation, context: {
|
|
288
|
+
apiHolder: ApiHolder;
|
|
289
|
+
}) => void | Promise<void>;
|
|
290
|
+
/**
|
|
291
|
+
* Type for the Custom Field Extension with the
|
|
292
|
+
* name and components and validation function.
|
|
293
|
+
*
|
|
294
|
+
* @alpha
|
|
295
|
+
*/
|
|
296
|
+
type LegacyFieldExtensionOptions<TFieldReturnValue = unknown, TInputProps = unknown> = {
|
|
297
|
+
name: string;
|
|
298
|
+
component: (props: LegacyFieldExtensionComponentProps<TFieldReturnValue, TInputProps>) => JSX.Element | null;
|
|
299
|
+
validation?: LegacyCustomFieldValidator<TFieldReturnValue>;
|
|
300
|
+
schema?: CustomFieldExtensionSchema;
|
|
301
|
+
};
|
|
302
|
+
/**
|
|
303
|
+
* Type for field extensions and being able to type
|
|
304
|
+
* incoming props easier.
|
|
305
|
+
*
|
|
306
|
+
* @alpha
|
|
307
|
+
*/
|
|
308
|
+
interface LegacyFieldExtensionComponentProps<TFieldReturnValue, TUiOptions = unknown> extends ScaffolderRJSFFieldProps<TFieldReturnValue> {
|
|
309
|
+
uiSchema: ScaffolderRJSFFieldProps['uiSchema'] & {
|
|
310
|
+
'ui:options'?: TUiOptions;
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Method for creating field extensions that can be used in the scaffolder
|
|
316
|
+
* frontend form.
|
|
317
|
+
* @alpha
|
|
318
|
+
*/
|
|
319
|
+
declare function createLegacyScaffolderFieldExtension<TReturnValue = unknown, TInputProps = unknown>(options: LegacyFieldExtensionOptions<TReturnValue, TInputProps>): Extension<FieldExtensionComponent<TReturnValue, TInputProps>>;
|
|
320
|
+
|
|
321
|
+
export { DefaultTemplateOutputs, EmbeddableWorkflow, Form, FormValidation, LegacyCustomFieldValidator, LegacyFieldExtensionComponentProps, LegacyFieldExtensionOptions, ParsedTemplateSchema, ReviewState, ReviewStateProps, ScaffolderField, ScaffolderFieldProps, ScaffolderPageContextMenu, ScaffolderPageContextMenuProps, Stepper, StepperProps, TaskLogStream, TaskSteps, TaskStepsProps, TemplateCard, TemplateCardProps, TemplateCategoryPicker, TemplateGroup, TemplateGroupProps, TemplateGroups, TemplateGroupsProps, Workflow, WorkflowProps, createAsyncValidators, createFieldValidation, createLegacyScaffolderFieldExtension, extractSchemaFromStep, useFormDataFromQuery, useTemplateParameterSchema, useTemplateSchema };
|
package/dist/alpha.esm.js
CHANGED
|
@@ -7,13 +7,13 @@ import validator from '@rjsf/validator-ajv8';
|
|
|
7
7
|
import qs from 'qs';
|
|
8
8
|
import useAsync from 'react-use/lib/useAsync';
|
|
9
9
|
import { s as scaffolderApiRef, S as SecretsContextProvider, a as FIELD_EXTENSION_KEY } from './esm/ref-6fdfc121.esm.js';
|
|
10
|
-
import { withTheme } from '@rjsf/core
|
|
10
|
+
import { withTheme } from '@rjsf/core';
|
|
11
11
|
import { getUiOptions, getTemplate } from '@rjsf/utils';
|
|
12
|
+
import { Theme } from '@rjsf/material-ui';
|
|
12
13
|
import { RELATION_OWNED_BY, stringifyEntityRef, parseEntityRef } from '@backstage/catalog-model';
|
|
13
14
|
import { FavoriteEntity, getEntityRelations, EntityRefLinks, useEntityList, entityRouteRef, useEntityTypeFilter } from '@backstage/plugin-catalog-react';
|
|
14
15
|
import LanguageIcon from '@material-ui/icons/Language';
|
|
15
16
|
import { isTemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';
|
|
16
|
-
import { TemplateGroup as TemplateGroup$1 } from '@backstage/plugin-scaffolder-react/alpha';
|
|
17
17
|
import WebIcon from '@material-ui/icons/Web';
|
|
18
18
|
import RemoveCircleOutline from '@material-ui/icons/RemoveCircleOutline';
|
|
19
19
|
import PanoramaFishEyeIcon from '@material-ui/icons/PanoramaFishEye';
|
|
@@ -295,6 +295,7 @@ const useTemplateSchema = (manifest) => {
|
|
|
295
295
|
};
|
|
296
296
|
});
|
|
297
297
|
return {
|
|
298
|
+
presentation: manifest.presentation,
|
|
298
299
|
steps: returningSteps
|
|
299
300
|
};
|
|
300
301
|
};
|
|
@@ -491,14 +492,40 @@ const DescriptionFieldTemplate = (props) => {
|
|
|
491
492
|
return null;
|
|
492
493
|
};
|
|
493
494
|
|
|
494
|
-
const WrappedForm = withTheme(
|
|
495
|
+
const WrappedForm = withTheme(Theme);
|
|
495
496
|
const Form = (props) => {
|
|
496
|
-
const
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
497
|
+
const wrappedFields = React.useMemo(
|
|
498
|
+
() => {
|
|
499
|
+
var _a;
|
|
500
|
+
return Object.fromEntries(
|
|
501
|
+
Object.entries((_a = props.fields) != null ? _a : {}).map(([key, Component]) => [
|
|
502
|
+
key,
|
|
503
|
+
(wrapperProps) => {
|
|
504
|
+
var _a2, _b;
|
|
505
|
+
return /* @__PURE__ */ React.createElement(
|
|
506
|
+
Component,
|
|
507
|
+
{
|
|
508
|
+
...wrapperProps,
|
|
509
|
+
uiSchema: (_a2 = wrapperProps.uiSchema) != null ? _a2 : {},
|
|
510
|
+
formData: wrapperProps.formData,
|
|
511
|
+
rawErrors: (_b = wrapperProps.rawErrors) != null ? _b : []
|
|
512
|
+
}
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
])
|
|
516
|
+
);
|
|
517
|
+
},
|
|
518
|
+
[props.fields]
|
|
519
|
+
);
|
|
520
|
+
const templates = React.useMemo(
|
|
521
|
+
() => ({
|
|
522
|
+
FieldTemplate,
|
|
523
|
+
DescriptionFieldTemplate,
|
|
524
|
+
...props.templates
|
|
525
|
+
}),
|
|
526
|
+
[props.templates]
|
|
527
|
+
);
|
|
528
|
+
return /* @__PURE__ */ React.createElement(WrappedForm, { ...props, templates, fields: wrappedFields });
|
|
502
529
|
};
|
|
503
530
|
|
|
504
531
|
const useStyles$8 = makeStyles((theme) => ({
|
|
@@ -516,15 +543,17 @@ const useStyles$8 = makeStyles((theme) => ({
|
|
|
516
543
|
}
|
|
517
544
|
}));
|
|
518
545
|
const Stepper = (stepperProps) => {
|
|
519
|
-
var _a;
|
|
546
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
520
547
|
const { layouts = [], components = {}, ...props } = stepperProps;
|
|
521
548
|
const {
|
|
522
549
|
ReviewStateComponent = ReviewState,
|
|
550
|
+
ReviewStepComponent,
|
|
551
|
+
backButtonText = "Back",
|
|
523
552
|
createButtonText = "Create",
|
|
524
553
|
reviewButtonText = "Review"
|
|
525
554
|
} = components;
|
|
526
555
|
const analytics = useAnalytics();
|
|
527
|
-
const { steps } = useTemplateSchema(props.manifest);
|
|
556
|
+
const { presentation, steps } = useTemplateSchema(props.manifest);
|
|
528
557
|
const apiHolder = useApiHolder();
|
|
529
558
|
const [activeStep, setActiveStep] = useState(0);
|
|
530
559
|
const [isValidating, setIsValidating] = useState(false);
|
|
@@ -536,6 +565,10 @@ const Stepper = (stepperProps) => {
|
|
|
536
565
|
props.extensions.map(({ name, component }) => [name, component])
|
|
537
566
|
);
|
|
538
567
|
}, [props.extensions]);
|
|
568
|
+
const fields = useMemo(
|
|
569
|
+
() => ({ ...FieldOverrides, ...extensions }),
|
|
570
|
+
[extensions]
|
|
571
|
+
);
|
|
539
572
|
const validators = useMemo(() => {
|
|
540
573
|
return Object.fromEntries(
|
|
541
574
|
props.extensions.map(({ name, validation: validation2 }) => [name, validation2])
|
|
@@ -554,6 +587,12 @@ const Stepper = (stepperProps) => {
|
|
|
554
587
|
(e) => setFormState((current) => ({ ...current, ...e.formData })),
|
|
555
588
|
[setFormState]
|
|
556
589
|
);
|
|
590
|
+
const handleCreate = useCallback(() => {
|
|
591
|
+
var _a2;
|
|
592
|
+
props.onCreate(formState);
|
|
593
|
+
const name = typeof formState.name === "string" ? formState.name : void 0;
|
|
594
|
+
analytics.captureEvent("create", (_a2 = name != null ? name : props.templateName) != null ? _a2 : "unknown");
|
|
595
|
+
}, [props, formState, analytics]);
|
|
557
596
|
const currentStep = useTransformSchemaToProps(steps[activeStep], { layouts });
|
|
558
597
|
const handleNext = async ({
|
|
559
598
|
formData = {}
|
|
@@ -574,6 +613,9 @@ const Stepper = (stepperProps) => {
|
|
|
574
613
|
}
|
|
575
614
|
setFormState((current) => ({ ...current, ...formData }));
|
|
576
615
|
};
|
|
616
|
+
const backLabel = (_b = (_a = presentation == null ? void 0 : presentation.buttonLabels) == null ? void 0 : _a.backButtonText) != null ? _b : backButtonText;
|
|
617
|
+
const createLabel = (_d = (_c = presentation == null ? void 0 : presentation.buttonLabels) == null ? void 0 : _c.createButtonText) != null ? _d : createButtonText;
|
|
618
|
+
const reviewLabel = (_f = (_e = presentation == null ? void 0 : presentation.buttonLabels) == null ? void 0 : _e.reviewButtonText) != null ? _f : reviewButtonText;
|
|
577
619
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, isValidating && /* @__PURE__ */ React.createElement(LinearProgress, { variant: "indeterminate" }), /* @__PURE__ */ React.createElement(Stepper$1, { activeStep, alternativeLabel: true, variant: "elevation" }, steps.map((step, index) => /* @__PURE__ */ React.createElement(Step, { key: index }, /* @__PURE__ */ React.createElement(StepLabel, null, step.title))), /* @__PURE__ */ React.createElement(Step, null, /* @__PURE__ */ React.createElement(StepLabel, null, "Review"))), /* @__PURE__ */ React.createElement("div", { className: styles.formWrapper }, activeStep < steps.length ? /* @__PURE__ */ React.createElement(
|
|
578
620
|
Form,
|
|
579
621
|
{
|
|
@@ -584,10 +626,10 @@ const Stepper = (stepperProps) => {
|
|
|
584
626
|
schema: currentStep.schema,
|
|
585
627
|
uiSchema: currentStep.uiSchema,
|
|
586
628
|
onSubmit: handleNext,
|
|
587
|
-
fields
|
|
629
|
+
fields,
|
|
588
630
|
showErrorList: false,
|
|
589
631
|
onChange: handleChange,
|
|
590
|
-
...(
|
|
632
|
+
...(_g = props.formProps) != null ? _g : {}
|
|
591
633
|
},
|
|
592
634
|
/* @__PURE__ */ React.createElement("div", { className: styles.footer }, /* @__PURE__ */ React.createElement(
|
|
593
635
|
Button,
|
|
@@ -596,7 +638,7 @@ const Stepper = (stepperProps) => {
|
|
|
596
638
|
className: styles.backButton,
|
|
597
639
|
disabled: activeStep < 1 || isValidating
|
|
598
640
|
},
|
|
599
|
-
|
|
641
|
+
backLabel
|
|
600
642
|
), /* @__PURE__ */ React.createElement(
|
|
601
643
|
Button,
|
|
602
644
|
{
|
|
@@ -605,33 +647,39 @@ const Stepper = (stepperProps) => {
|
|
|
605
647
|
type: "submit",
|
|
606
648
|
disabled: isValidating
|
|
607
649
|
},
|
|
608
|
-
activeStep === steps.length - 1 ?
|
|
650
|
+
activeStep === steps.length - 1 ? reviewLabel : "Next"
|
|
609
651
|
))
|
|
610
|
-
) :
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
color: "primary",
|
|
623
|
-
onClick: () => {
|
|
624
|
-
var _a2;
|
|
625
|
-
props.onCreate(formState);
|
|
626
|
-
const name = typeof formState.name === "string" ? formState.name : void 0;
|
|
627
|
-
analytics.captureEvent(
|
|
628
|
-
"create",
|
|
629
|
-
(_a2 = name != null ? name : props.templateName) != null ? _a2 : "unknown"
|
|
630
|
-
);
|
|
652
|
+
) : (
|
|
653
|
+
// TODO: potentially move away from this pattern, deprecate?
|
|
654
|
+
ReviewStepComponent ? /* @__PURE__ */ React.createElement(
|
|
655
|
+
ReviewStepComponent,
|
|
656
|
+
{
|
|
657
|
+
disableButtons: isValidating,
|
|
658
|
+
formData: formState,
|
|
659
|
+
handleBack,
|
|
660
|
+
handleReset: () => {
|
|
661
|
+
},
|
|
662
|
+
steps,
|
|
663
|
+
handleCreate
|
|
631
664
|
}
|
|
632
|
-
},
|
|
633
|
-
|
|
634
|
-
|
|
665
|
+
) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ReviewStateComponent, { formState, schemas: steps }), /* @__PURE__ */ React.createElement("div", { className: styles.footer }, /* @__PURE__ */ React.createElement(
|
|
666
|
+
Button,
|
|
667
|
+
{
|
|
668
|
+
onClick: handleBack,
|
|
669
|
+
className: styles.backButton,
|
|
670
|
+
disabled: activeStep < 1
|
|
671
|
+
},
|
|
672
|
+
"Back"
|
|
673
|
+
), /* @__PURE__ */ React.createElement(
|
|
674
|
+
Button,
|
|
675
|
+
{
|
|
676
|
+
variant: "contained",
|
|
677
|
+
color: "primary",
|
|
678
|
+
onClick: handleCreate
|
|
679
|
+
},
|
|
680
|
+
createLabel
|
|
681
|
+
)))
|
|
682
|
+
)));
|
|
635
683
|
};
|
|
636
684
|
|
|
637
685
|
const useStyles$7 = makeStyles(() => ({
|
|
@@ -822,7 +870,7 @@ const TemplateGroups = (props) => {
|
|
|
822
870
|
};
|
|
823
871
|
});
|
|
824
872
|
return /* @__PURE__ */ React.createElement(
|
|
825
|
-
TemplateGroup
|
|
873
|
+
TemplateGroup,
|
|
826
874
|
{
|
|
827
875
|
key: index,
|
|
828
876
|
templates,
|
|
@@ -1210,7 +1258,7 @@ function ScaffolderPageContextMenu(props) {
|
|
|
1210
1258
|
));
|
|
1211
1259
|
}
|
|
1212
1260
|
|
|
1213
|
-
function
|
|
1261
|
+
function createLegacyScaffolderFieldExtension(options) {
|
|
1214
1262
|
return {
|
|
1215
1263
|
expose() {
|
|
1216
1264
|
const FieldExtensionDataHolder = () => null;
|
|
@@ -1224,5 +1272,5 @@ function createNextScaffolderFieldExtension(options) {
|
|
|
1224
1272
|
};
|
|
1225
1273
|
}
|
|
1226
1274
|
|
|
1227
|
-
export { DefaultTemplateOutputs, EmbeddableWorkflow, Form, ReviewState, ScaffolderField, ScaffolderPageContextMenu, Stepper, TaskLogStream, TaskSteps, TemplateCard, TemplateCategoryPicker, TemplateGroup, TemplateGroups, Workflow, createFieldValidation,
|
|
1275
|
+
export { DefaultTemplateOutputs, EmbeddableWorkflow, Form, ReviewState, ScaffolderField, ScaffolderPageContextMenu, Stepper, TaskLogStream, TaskSteps, TemplateCard, TemplateCategoryPicker, TemplateGroup, TemplateGroups, Workflow, createAsyncValidators, createFieldValidation, createLegacyScaffolderFieldExtension, extractSchemaFromStep, useFormDataFromQuery, useTemplateParameterSchema, useTemplateSchema };
|
|
1228
1276
|
//# sourceMappingURL=alpha.esm.js.map
|