Fix button configuration not applied
Browse files- src/driver.ts +6 -1
src/driver.ts
CHANGED
|
@@ -156,10 +156,15 @@ export function driver(options: Config = {}) {
|
|
| 156 |
.replace("{{current}}", `${stepIndex + 1}`)
|
| 157 |
.replace("{{total}}", `${steps.length}`);
|
| 158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
highlight({
|
| 160 |
...currentStep,
|
| 161 |
popover: {
|
| 162 |
-
showButtons:
|
| 163 |
nextBtnText: !hasNextStep ? doneBtnText : undefined,
|
| 164 |
disableButtons: [...(!hasPreviousStep ? ["previous" as AllowedButtons] : [])],
|
| 165 |
showProgress: showProgress,
|
|
|
|
| 156 |
.replace("{{current}}", `${stepIndex + 1}`)
|
| 157 |
.replace("{{total}}", `${steps.length}`);
|
| 158 |
|
| 159 |
+
const configuredButtons = currentStep.popover?.showButtons || getConfig("showButtons");
|
| 160 |
+
const calculatedButtons: AllowedButtons[] = ["next", "previous", ...(allowsClosing ? ["close" as AllowedButtons] : [])].filter((b) => {
|
| 161 |
+
return !configuredButtons?.length || configuredButtons.includes(b as AllowedButtons);
|
| 162 |
+
}) as AllowedButtons[];
|
| 163 |
+
|
| 164 |
highlight({
|
| 165 |
...currentStep,
|
| 166 |
popover: {
|
| 167 |
+
showButtons: calculatedButtons,
|
| 168 |
nextBtnText: !hasNextStep ? doneBtnText : undefined,
|
| 169 |
disableButtons: [...(!hasPreviousStep ? ["previous" as AllowedButtons] : [])],
|
| 170 |
showProgress: showProgress,
|