Некодим логотипНекодим
МодификацииПубликацииНекодИИмЦены
Некодим логотипНекодим

© 2020-2026 Некодим

Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.

Компания

  • Контакты
  • Публичная оферта
  • Политика конфиденциальности
  • Согласие на обработку данных
  • Лицензионное соглашение
  • Реферальная программа

Полезное

  • Модификации
  • Публикации
  • Каталог блоков Tilda
  • MCP для агентов
  • Журнал изменений
  • Доска почёта

Личный кабинет

  • Вход
  • Регистрация
  • Цены
Журнал измененийИстория GitФайлыTilda MCP
Каталог файлов

tilda-zero-forms-1.0.js

Код файла
Версия от 04.12.2026, 04:03:53 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
1401			t_zeroForms__setRadioRowClasses(inputPreferences, inputBlock);1402		}1403	}1404 1405	return inputGroup;1406}1407 1408/**1409 * Some users create calculation field outside the forms that work with it.1410 * If these forms were previously hidden, whe should check if the fields are rendered,1411 * before init calculation.1412 *
История файла и сравнение версий
  • 04.12.2026, 04:03:53 · 56c3b845
1413
* @param {FormObjectEl} elementObj
1414 * @param {HTMLElement} zeroForm
1415 */
1416function t_zeroForms__waitCalcFields(recId, elementObj, zeroForm) {
1417 var inputNameList = t_zeroForms__getListOfFieldsInFormula(elementObj.li_expr);
1418 if (!inputNameList) return;
1419
1420 var isFieldsInsideCurrentForm = inputNameList.every(function (name) {
1421 return zeroForm.querySelector('[name="' + name + '"]');
1422 });
1423
1424 if (isFieldsInsideCurrentForm) {
1425 tcalc__init(recId, elementObj.lid);
1426 } else {
1427 setTimeout(function () {
1428 tcalc__init(recId, elementObj.lid);
1429 }, 500);
1430 }
1431}
1432
1433/**
1434 * Возвращает список названий использованных в формуле полей. Возвращает undefined, если в формуле не нашлось подходящих полей.
1435 * @param {string} formula
1436 * @returns {string[] | undefined}
1437 */
1438function t_zeroForms__getListOfFieldsInFormula(formula) {
1439 if (!formula) return;
1440 var inputNameList = t_zeroForms__removeStringQuotes(formula).match(/[A-z0-9_]+/gi);
1441 if (!inputNameList) return;
1442
1443 // if we have expression a + b * 2, we shouldn't use 2 as a name for input field
1444 return inputNameList.filter(function (name) {
1445 return isNaN(parseInt(name, 10));
1446 });
1447}
1448
1449/**
1450 *
1451 * @param {formObj} formObj
1452 * @param {HTMLElement} inputGroup
1453 */
1454function t_zeroForms__setStylesForFormGroup(formObj, inputGroup) {
1455 // разделитель шагов не занимает места в форме
1456 if (!inputGroup || inputGroup.classList.contains('t-input-group_st')) return;
1457 var isHorizontalForm = formObj.inputpos === 'h';
1458 var inputPosStyles = '';
1459 if (isHorizontalForm && formObj.inputmargright) {
1460 inputPosStyles += 'padding-right:' + formObj.inputmargright + 'px;';
1461 } else if (!isHorizontalForm && formObj.inputmargbottom) {
1462 inputPosStyles += 'margin-bottom:' + formObj.inputmargbottom + 'px;';
1463 }
1464 if (inputPosStyles) inputGroup.style = inputPosStyles;
1465}
1466
1467function t_zeroForms__generateSubtitle(elementObj, titleStyles, inputGroup) {
1468 var exceptTypes = ['rd', 'ri', 'uw', 'uc', 'fr', 'cb', 'rs'];
1469 var isExceptType = exceptTypes.some(function (type) {
1470 return type === elementObj.li_type;
1471 });
1472 var text = document.createElement(elementObj.li_title || isExceptType ? 'div' : 'label');
1473 if (text.tagName === 'LABEL') text.style.display = 'block';
1474 if (text.tagName === 'LABEL') text.setAttribute('for', 'input_' + elementObj.lid);
1475 text.classList.add('t-input-subtitle');
1476 text.classList.add('t-descr');
1477 text.classList.add('t-descr_xxs');
1478 text.classList.add('t-opacity_70');
1479 text.setAttribute('field', 'nullli_subtitle__' + elementObj.lid);
1480 t_zeroForms__setTitleStyles(text, titleStyles, '');
1481 text.innerHTML = elementObj.li_subtitle;
1482 inputGroup.insertAdjacentElement('beforeend', text);
1483}
1484
1485function t_zeroForms__generateTitle(elementObj, titleStyles, inputGroup, titleFontWeight) {
1486 var exceptTypes = ['rd', 'ri', 'uw', 'uc', 'fr', 'cb', 'rs'];
1487 var isExceptType = exceptTypes.some(function (type) {
1488 return type === elementObj.li_type;
1489 });
1490 var title = document.createElement(isExceptType ? 'div' : 'label');
1491 if (title.tagName === 'LABEL') title.style.display = 'block';
1492 if (title.tagName === 'LABEL') title.setAttribute('for', 'input_' + elementObj.lid);
1493 title.classList.add('t-input-title');
1494 title.setAttribute('data-redactor-toolbar', 'no');
1495 title.setAttribute('field', 'nullli_title__' + elementObj.lid);
1496 t_zeroForms__setTitleStyles(title, titleStyles, titleFontWeight);
1497 title.innerHTML = elementObj.li_title;
1498 inputGroup.insertAdjacentElement('beforeend', title);
1499}
1500
Предыдущие 100 строкСледующие 100 строк