Каталог файловtilda-step-manager-1.0.js
101 const activeStepClass = initOptions.activeStepClass || 't-step-form__step_active';102 const hiddenStepClass = initOptions.hiddenStepClass || 't-quiz-hidden';103 const animation = initOptions.animation;104 const isConditional = initOptions.enableConditionals;105 106 const autoStepChangeEnabled = initOptions.enableAutoStepChange;107 let autoStepChangeInProgress = false;108 let autoStepChangeTimer;109 let autoStepChangeDuration = 300;110 111 /** @type {ActiveStep} */112
История файла и сравнение версий
let activeStep = INITIAL_ACTIVE_STEP;
117 function activateStep(step) { 118 step.element.classList.add(activeStepClass); 119 step.element.classList.remove(hiddenStepClass); 125 function deactivateStep(step) { 126 step.element.classList.remove(activeStepClass); 127 step.element.classList.add(hiddenStepClass); 133 function isStepHidden(step) { 134 const innerFields = step.element.querySelectorAll('.t-quiz__step__input'); 135 const allInnerFieldsHidden = 136 innerFields.length && 137 Array.from(innerFields).every(function (field) { 138 return t_quiz__isElementHidden(field); 140 return t_quiz__isElementHidden(step.element) || allInnerFieldsHidden; 143 /** @type {() => ActiveStep} */ 144 function getNextActiveStep() { 145 var nextStepIndex = steps.findIndex(function (step, index) { 146 return index > activeStep.index && !isStepHidden(step); 149 var index = Math.min(steps.length, nextStepIndex); 157 /** @type {() => ActiveStep} */ 158 function getPrevActiveStep() { 159 const activeIndex = activeStep.index; 160 let prevStepIndex = activeIndex === -1 ? steps.length - 1 : activeIndex - 1; 162 for (var i = prevStepIndex; i >= 0; i--) { 164 if (!isStepHidden(step)) { 170 const index = Math.max(0, prevStepIndex); 178 * @param {Step['type'][]} types 181 function getStepsByTypes(types) { 182 return steps.filter(function (step) { 183 return types.indexOf(step.type) !== -1 && !isStepHidden(step); 187 function getStepsProgress() { 188 var basicSteps = getStepsByTypes(['step', 'contacts']); 189 var current = basicSteps.indexOf(activeStep.step); 192 total: basicSteps.length, 193 current: current === -1 ? null : current + 1, 197 /** @type {ChangeStepHandler} */ 198 function go(direction, callbacks, transitionInfo) { 199 var prevStep = activeStep.step;