@@ -9,9 +9,11 @@ import { useDeepCompareMemo } from '@/hooks';
99import { useFormExpression } from '@/hooks' ;
1010import { useFormDesignerComponents } from '@/providers/form/hooks' ;
1111import { useValidator } from '@/providers/validateProvider' ;
12+ import { useClosestModal } from '@/providers/dynamicModal' ;
1213
1314interface IWizardComponent {
1415 back : ( ) => void ;
16+ close : ( ) => void ;
1517 components : IConfigurableFormComponent [ ] ;
1618 current : number ;
1719 currentStep : IWizardStepProps ;
@@ -28,6 +30,7 @@ export const useWizard = (model: Omit<IWizardComponentProps, 'size'>): IWizardCo
2830 const allData = useAvailableConstantsData ( ) ;
2931 const toolbox = useFormDesignerComponents ( ) ;
3032 const validator = useValidator ( false ) ;
33+ const closestModal = useClosestModal ( ) ;
3134
3235 const formMode = useForm ( false ) . formMode ;
3336
@@ -197,10 +200,15 @@ export const useWizard = (model: Omit<IWizardComponentProps, 'size'>): IWizardCo
197200 ) ;
198201 } ;
199202
203+ const close = ( ) : void => {
204+ closestModal ?. close ( ) ;
205+ } ;
206+
200207 const cancel = ( ) : void =>
201208 executeActionIfConfigured (
202209 ( tab ) => tab . beforeCancelActionConfiguration ,
203210 ( tab ) => tab . afterCancelActionConfiguration ,
211+ ( ) => close ( ) ,
204212 ) ;
205213
206214 const done = ( ) : void => {
@@ -265,6 +273,20 @@ export const useWizard = (model: Omit<IWizardComponentProps, 'size'>): IWizardCo
265273 actionDependencies ,
266274 ) ;
267275
276+ useConfigurableAction (
277+ {
278+ name : 'Close' ,
279+ owner : actionOwnerName ,
280+ ownerUid : actionsOwnerId ,
281+ hasArguments : false ,
282+ executer : ( ) => {
283+ close ( ) ;
284+ return Promise . resolve ( ) ;
285+ } ,
286+ } ,
287+ actionDependencies ,
288+ ) ;
289+
268290 useConfigurableAction (
269291 {
270292 name : 'Done' ,
@@ -313,5 +335,5 @@ export const useWizard = (model: Omit<IWizardComponentProps, 'size'>): IWizardCo
313335
314336 const content = getStepDescritpion ( showStepStatus , sequence , current ) ;
315337
316- return { components, current, currentStep, visibleSteps, back, cancel, done, content, next, setStep } ;
338+ return { components, current, currentStep, visibleSteps, back, cancel, close , done, content, next, setStep } ;
317339} ;
0 commit comments