Skip to content

Commit 4236153

Browse files
committed
fix(pf): added basic types sctructure to wizard
1 parent b3cb4d5 commit 4236153

File tree

1 file changed

+49
-2
lines changed

1 file changed

+49
-2
lines changed

packages/pf4-component-mapper/src/files/wizard.d.ts

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ReactNode } from "react";
2-
import { Field } from "@data-driven-forms/react-form-renderer";
2+
import { Field, AnyObject, FormOptions } from "@data-driven-forms/react-form-renderer";
33

44
export interface WizardButtonLabels {
55
submit?: ReactNode;
@@ -8,6 +8,53 @@ export interface WizardButtonLabels {
88
next?: ReactNode;
99
}
1010

11+
export interface WizardNextStepFunctionArgument {
12+
values?: AnyObject;
13+
value?: any;
14+
}
15+
16+
export interface WizardNextStepFunction {
17+
(formState: WizardNextStepFunctionArgument): string;
18+
}
19+
20+
export interface WizardStepMapper {
21+
[key: string]: string | number;
22+
}
23+
24+
export interface WizardNextStepMapper {
25+
when: string;
26+
stepMapper: WizardStepMapper;
27+
}
28+
29+
export type WizardNextStep = string | WizardNextStepMapper | WizardNextStepFunction;
30+
31+
export interface WizardButtonsProps {
32+
ConditionalNext: React.ComponentType;
33+
SubmitButton: React.ComponentType;
34+
SimpleNext: React.ComponentType;
35+
formOptions: FormOptions;
36+
disableBack?: boolean;
37+
handlePrev: any;
38+
nextStep?: string | number;
39+
FieldProvider?: React.ComponentType;
40+
handleNext: any;
41+
buttonsClassname?: string;
42+
buttonLabels: AnyObject;
43+
renderNextButton: any;
44+
}
45+
46+
export interface WizardField {
47+
name: string | number;
48+
fields: Field[];
49+
nextStep?: WizardNextStep;
50+
substepOf?: string | number;
51+
title?: ReactNode;
52+
showTitle?: boolean;
53+
customTitle?: ReactNode;
54+
disableForwardJumping?: boolean;
55+
buttons?: ReactNode | React.ComponentType<WizardButtonsProps>;
56+
}
57+
1158
export interface WizardProps {
1259
buttonLabels?: WizardButtonLabels;
1360
buttonsClassName?: string;
@@ -20,7 +67,7 @@ export interface WizardProps {
2067
isDynamic?: boolean;
2168
showTitles?: boolean;
2269
crossroads?: string[];
23-
fields: Field[];
70+
fields: WizardField[];
2471
}
2572

2673
declare const Wizard: React.ComponentType<WizardProps>;

0 commit comments

Comments
 (0)