', {
class: classes.indicatorSeparator
});
}
createStepsButtons() {
const {
selectors
} = this.getSettings(),
stepsElements = {};
this.injectButtonsToSteps(stepsElements);
stepsElements.$buttonsContainer = this.elements.$stepWrapper.find(selectors.buttons);
stepsElements.$buttonsWrappers = stepsElements.$buttonsContainer.children(selectors.buttonWrapper);
return stepsElements;
}
injectButtonsToSteps() {
const totalSteps = this.elements.$stepWrapper.length;
this.elements.$stepWrapper.each((index, el) => {
const $el = jQuery(el),
$container = this.getButtonsContainer();
let $nextButton;
if (index) {
$container.append(this.getStepButton('previous', index));
$nextButton = index === totalSteps - 1 ? this.getSubmitButton() : this.getStepButton('next', index);
} else {
$nextButton = this.getStepButton('next', index);
}
$container.append($nextButton);
$el.append($container);
});
}
getButtonsContainer() {
const {
classes
} = this.getSettings(),
stepsSettings = this.getElementSettings(),
buttonColumnWidthClasses = [classes.buttons, classes.column, 'elementor-col-' + stepsSettings.button_width];
return jQuery('
', {
class: buttonColumnWidthClasses.join(' ')
});
}
extractResponsiveSizeFromSubmitWrapper() {
let sizeClasses = [];
this.elements.$submitWrapper.removeClass((index, className) => {
sizeClasses = className.match(/elementor-(sm|md)-[0-9]+/g)?.join(' ');
return sizeClasses;
});
this.elements.$buttonsContainer.addClass(sizeClasses);
}
getStepButton(buttonType, index) {
const {
classes
} = this.getSettings(),
$button = this.getButton(buttonType, index).on('click', () => this.applyStep(buttonType)),
buttonWrapperClasses = [classes.fieldGroup, classes.buttonWrapper, 'elementor-field-type-' + buttonType];
return jQuery('
', {
class: buttonWrapperClasses.join(' ')
}).append($button);
}
getSubmitButton() {
const {
classes
} = this.getSettings();
this.elements.$submitButton.addClass(classes.button);
// TODO: When a solution for the conditions will be found, check if can remove the elementor-col-x manipulation.
return this.elements.$submitWrapper.attr('class', (index, className) => {
return this.replaceClassNameColSize(className, '');
}).removeClass(classes.column).removeClass(classes.buttons).addClass(classes.buttonWrapper);
}
replaceClassNameColSize(className, value) {
return className.replace(/elementor-col-([0-9]+)/g, value);
}
getButton(buttonType, index) {
const {
classes
} = this.getSettings(),
submitSizeClass = this.elements.$submitButton.attr('class').match(/elementor-size-([^\W\d]+)/g),
buttonClasses = [classes.elementorButton, submitSizeClass, classes.button, classes.button + '-' + buttonType];
return jQuery('