Некодим© 2020-2026 Некодим
Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.
* @param {FormObjectEl} elementObj
1414 * @param {HTMLElement} zeroForm1416 function t_zeroForms__waitCalcFields(recId, elementObj, zeroForm) {1417 var inputNameList = t_zeroForms__getListOfFieldsInFormula(elementObj.li_expr);1418 if (!inputNameList) return;1420 var isFieldsInsideCurrentForm = inputNameList.every(function (name) {1421 return zeroForm.querySelector('[name="' + name + '"]');1424 if (isFieldsInsideCurrentForm) {1425 tcalc__init(recId, elementObj.lid);1427 setTimeout(function () {1428 tcalc__init(recId, elementObj.lid);1434 * Возвращает список названий использованных в формуле полей. Возвращает undefined, если в формуле не нашлось подходящих полей.1435 * @param {string} formula1436 * @returns {string[] | undefined}1438 function t_zeroForms__getListOfFieldsInFormula(formula) {1439 if (!formula) return;1440 var inputNameList = t_zeroForms__removeStringQuotes(formula).match(/[A-z0-9_]+/gi);1441 if (!inputNameList) return;1443 // if we have expression a + b * 2, we shouldn't use 2 as a name for input field1444 return inputNameList.filter(function (name) {1445 return isNaN(parseInt(name, 10));1451 * @param {formObj} formObj1452 * @param {HTMLElement} inputGroup1454 function 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;';1464 if (inputPosStyles) inputGroup.style = inputPosStyles;1467 function 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;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);1485 function 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;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);