Skip to content

Commit af48422

Browse files
authored
Merge pull request #3825 from James-Baloyi/james/en/44/3781
toggle done and back buttons
2 parents 8857f18 + 29387ef commit af48422

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

shesha-reactjs/src/designer-components/wizard/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ const TabsComponent: IToolboxComponent<Omit<IWizardComponentProps, 'size'>> = {
2929
},
3030
initModel: (model) => ({
3131
...model,
32+
showBackButton: model.showBackButton ?? true,
33+
showDoneButton: model.showDoneButton ?? true,
3234
}),
3335
migrator: (m) =>
3436
m

shesha-reactjs/src/designer-components/wizard/models.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,6 @@ export interface IWizardComponentProps extends Omit<IConfigurableFormComponent,
8080
secondaryBgColor?: React.CSSProperties['color'];
8181
secondaryTextColor?: React.CSSProperties['color'];
8282
stepWidth?: string;
83+
showBackButton?: boolean;
84+
showDoneButton?: boolean;
8385
}

shesha-reactjs/src/designer-components/wizard/settingsForm.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,31 @@ export const getSettings = () => {
156156
]
157157
}
158158
)
159+
.addSettingsInputRow(
160+
{
161+
id: nanoid(),
162+
inputs: [
163+
{
164+
id: nanoid(),
165+
propertyName: 'showBackButton',
166+
label: 'Show Back Button',
167+
parentId: 'root',
168+
type: 'switch',
169+
jsSetting: true,
170+
defaultValue: true,
171+
},
172+
{
173+
id: nanoid(),
174+
propertyName: 'showDoneButton',
175+
label: 'Show Done Button',
176+
parentId: 'root',
177+
type: 'switch',
178+
jsSetting: true,
179+
defaultValue: true,
180+
}
181+
]
182+
}
183+
)
159184
.toJson()
160185
]
161186
},

shesha-reactjs/src/designer-components/wizard/tabs.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ export const Tabs: FC<Omit<IWizardComponentProps, 'size'>> = ({ form, ...model }
3838
isDynamic,
3939
labelPlacement,
4040
wizardType = 'default',
41-
stepWidth
41+
stepWidth,
42+
showBackButton = true,
43+
showDoneButton = true
4244
} = model;
4345

4446
const { primaryTextColor, secondaryTextColor, primaryBgColor, secondaryBgColor } = model;
@@ -121,7 +123,7 @@ export const Tabs: FC<Omit<IWizardComponentProps, 'size'>> = ({ form, ...model }
121123
condition={splitButtons}
122124
wrap={(children) => <Space><div className={styles.shaStepsButtons}>{children}</div></Space>}
123125
>
124-
{current > 0 && (
126+
{current > 0 && showBackButton && (
125127
<Button
126128
style={btnStyle('back')}
127129
onClick={back}
@@ -155,7 +157,7 @@ export const Tabs: FC<Omit<IWizardComponentProps, 'size'>> = ({ form, ...model }
155157
{currentStep.nextButtonText ? currentStep.nextButtonText : 'Next'}
156158
</Button>
157159
)}
158-
{current === visibleSteps.length - 1 && (
160+
{current === visibleSteps.length - 1 && showDoneButton && (
159161
<Button
160162
type="primary"
161163
style={btnStyle('next')}

0 commit comments

Comments
 (0)