@centreon/ui 23.10.38 → 23.10.39
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/package.json +1 -1
- package/src/Wizard/index.tsx +13 -3
- package/src/Wizard/models.ts +1 -0
package/package.json
CHANGED
package/src/Wizard/index.tsx
CHANGED
|
@@ -37,7 +37,8 @@ const Wizard = ({
|
|
|
37
37
|
open,
|
|
38
38
|
onClose = undefined,
|
|
39
39
|
confirmDialogLabels = undefined,
|
|
40
|
-
actionsBarLabels = actionsBarLabelsDefaultValues
|
|
40
|
+
actionsBarLabels = actionsBarLabelsDefaultValues,
|
|
41
|
+
displayConfirmDialog
|
|
41
42
|
}: WizardProps): JSX.Element => {
|
|
42
43
|
const { classes } = useStyles();
|
|
43
44
|
const [currentStep, setCurrentStep] = useState(0);
|
|
@@ -78,9 +79,18 @@ const Wizard = ({
|
|
|
78
79
|
bag.setSubmitting(false);
|
|
79
80
|
};
|
|
80
81
|
|
|
82
|
+
const controlDisplayConfirmationDialog = (): void => {
|
|
83
|
+
if (!equals(displayConfirmDialog, false)) {
|
|
84
|
+
setOpenConfirm(displayConfirmDialog ?? true);
|
|
85
|
+
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
onClose?.();
|
|
89
|
+
};
|
|
90
|
+
|
|
81
91
|
const handleClose = (_, reason): void => {
|
|
82
92
|
if (equals(reason, 'backdropClick')) {
|
|
83
|
-
|
|
93
|
+
controlDisplayConfirmationDialog();
|
|
84
94
|
|
|
85
95
|
return;
|
|
86
96
|
}
|
|
@@ -89,7 +99,6 @@ const Wizard = ({
|
|
|
89
99
|
|
|
90
100
|
const handleCloseConfirm = (confirm): void => {
|
|
91
101
|
setOpenConfirm(false);
|
|
92
|
-
|
|
93
102
|
if (!confirm) {
|
|
94
103
|
return;
|
|
95
104
|
}
|
|
@@ -106,6 +115,7 @@ const Wizard = ({
|
|
|
106
115
|
classes={{
|
|
107
116
|
paper: fullHeight ? classes.fullHeight : undefined
|
|
108
117
|
}}
|
|
118
|
+
data-testid="Dialog"
|
|
109
119
|
maxWidth={width}
|
|
110
120
|
open={open}
|
|
111
121
|
onClose={handleClose}
|
package/src/Wizard/models.ts
CHANGED
|
@@ -41,6 +41,7 @@ interface ConfirmDialogLabels {
|
|
|
41
41
|
export interface WizardProps {
|
|
42
42
|
actionsBarLabels?: ActionsBarLabels;
|
|
43
43
|
confirmDialogLabels?: ConfirmDialogLabels;
|
|
44
|
+
displayConfirmDialog?: boolean;
|
|
44
45
|
fullHeight?: boolean;
|
|
45
46
|
initialValues?: FormikValues;
|
|
46
47
|
onClose?: () => void;
|