Skip to content

Commit

Permalink
Fixing issues with breadcrumb clickable configurations.
Browse files Browse the repository at this point in the history
  • Loading branch information
travist committed May 22, 2024
1 parent 7da05ac commit 11a9aca
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class Wizard extends Webform {
* - buttonSettings.show*(Previous, Next, Cancel): true (default) - determines if the button is shown.
* - allowPrevious: false (default) - determines if the breadcrumb bar is clickable for visited tabs.
*/
constructor(elementOrOptions, _options = undefined) {
constructor(elementOrOptions = undefined, _options = undefined) {
let element, options;
if (elementOrOptions instanceof HTMLElement || options) {
element = elementOrOptions;
Expand Down Expand Up @@ -112,11 +112,6 @@ export default class Wizard extends Webform {
showCancel: !this.options.readOnly
});

if (!this.isSecondInit && this.options?.breadcrumbSettings) {
this.isClickableDefined = Object.prototype.hasOwnProperty.call(this.options?.breadcrumbSettings, 'clickable');
this.isSecondInit = true;
}

this.options.breadcrumbSettings = _.defaults(this.options.breadcrumbSettings, {
clickable: true
});
Expand Down Expand Up @@ -347,7 +342,15 @@ export default class Wizard extends Webform {
}
});

return this.isClickableDefined ? this.options.breadcrumbSettings.clickable : _.get(currentPage, 'component.breadcrumbClickable', true);
if (_.has(currentPage, 'component.breadcrumbClickable')) {
return _.get(currentPage, 'component.breadcrumbClickable');
}

if (_.has(this.options, 'breadcrumbSettings.clickable')) {
return this.options.breadcrumbSettings.clickable;
}

return true;
}

isAllowPrevious() {
Expand Down

0 comments on commit 11a9aca

Please sign in to comment.