4601const label = input.closest('.t-checkbox__control, .t-img-select__control');4602if (label && isSafari) input.checked = false;4603if (label) label.dispatchEvent(new Event('click'));4604}4605}46064607function processSelectbox() {4608const optionList = Array.from(input.options);4609const currentOption = optionList.find(option => option.value.trim() === value);4610if (currentOption) currentOption.selected = true;4611}4612
/** * Родителю поля необходимо задать активный класс, чтобы выделились все звезды * до выделенного поля, а не только это поле. */ function processRate() { input.closest('.t-rate__wrapper')?.classList.add('t-rate__wrapper_active'); } function triggerChangeEvent(timeout) { const callback = () => input.dispatchEvent(new Event('change')); if (timeout) { setTimeout(callback, timeout); } else { callback(); } } /** * Необходимо получить id поля, которое в дальнейшем будет удалено после обработки * скриптом маски телефона. Поэтому по таймеру необходимо найти обновленное поле * и к нему применить событие 'input', чтобы к вставленному значению из гет-параметру * применились настройки маски. */ function processPhoneMask() { let inputId = input.getAttribute('data-phonemask-lid'); if (inputId) inputId = `input_${inputId}`; if (!inputId) inputId = input.id; if (!inputId) return; setTimeout(() => { const updatedInput = document.getElementById(inputId); updatedInput?.dispatchEvent(new Event('input')); }, timeout); } function processFieldOnCalcReady(callback, processWithoutCalc = true) { const calcFieldWrapper = getConnectedCalcWrapper(); if (!processWithoutCalc && !calcFieldWrapper) return; if (!calcFieldWrapper || calcFieldWrapper.getAttribute('data-init-calc') === 'y') { callback(); } else { calcFieldWrapper.addEventListener('inputReady', callback); } } function getConnectedCalcWrapper() { const form = input.closest('.t-form'); if (!form) return null; const calcExpressions = Array.from(form.querySelectorAll('[data-calc-expr]')); if (!calcExpressions.length) return null; const connectedCalc = calcExpressions.find(expr => expr.getAttribute('data-calc-expr').includes(input.name)); return connectedCalc?.closest('.t-input-group') || null; }}/** * * @returns {'published' | 'edit' | 'preview' | 'notdefined'} */function t_forms__getTildaMode() { if (typeof window.tildamode !== 'undefined') return window.tildamode; const allRec = document.getElementById('allrecords'); if (!allRec) return 'notdefined'; window.tildamode = allRec.getAttribute('data-tilda-mode') || 'published'; return window.tildamode;}