Некодим© 2020-2026 Некодим
Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.
Журнал изменений История Git Файлы Tilda MCP Каталог файловtilda-forms-1.0.js Следить за файлом 2301 }2302 var fieldWidth = Number(widthClass.substr(widthClass.length - 2, characterQuantity));2303 return sum + fieldWidth;2304 }, 0);2305 if (commonWidth <= 100) return;2306 2307 // Если ширина > 100, добавляем отступ к последнему полю,2308 // чтобы следующее за ним короткое поле переносилось в следующий ряд2309 row.forEach(function (field) {2310 if (field.classList.contains('t-input-group_inrow-last')) {2311 field.style.marginRight = 'calc(100% - (' + (commonWidth - 100) + '%)';История файла и сравнение версий field.style.flex = '0 0 auto';
2318 /* Combine fields with default width into row */2319 function t_forms__combineFieldsWithDefWidth(allLastFields, recId) {2320 var allRowsWithDefWidth = [];2321 var rows = t_forms__createArrWithAllRows(allLastFields, 't-input-group_widthdef');2323 rows.forEach(function (row) {2324 var maxRowLength = 4;2325 if (row.length > maxRowLength) {2326 for (var i = 0; i < row.length; i += maxRowLength) {2327 var newRow = row.slice(i, i + maxRowLength);2328 allRowsWithDefWidth.push(newRow);2331 allRowsWithDefWidth.push(row);2335 allRowsWithDefWidth.forEach(function (row) {2341 var widthClass = 't-input-group_width' + (rowWidth[row.length] || '100');2343 row.forEach(function (field) {2344 field.classList.add(widthClass);2345 if (field.classList.contains('t-input-group_rg')) {2346 var lid = field.getAttribute('data-input-lid');2347 window.t_input_range_init(recId, lid);2353 /* Creates array with every row in form */2354 function t_forms__createArrWithAllRows(allLastFields, certainClass) {2355 var allSequences = [];2356 var oneSequence = [];2358 // Создаём массив с подмассивами из всех последовательностей2359 // с полями в одном ряду2360 Array.prototype.forEach.call(allLastFields, function (lastField) {2361 var field = lastField;2362 oneSequence.push(field);2364 field.previousElementSibling &&2365 field.previousElementSibling.classList.contains(certainClass) &&2366 !field.previousElementSibling.classList.contains('t-input-group_inrow-last')2368 field = field.previousElementSibling;2369 oneSequence.push(field);2371 allSequences.push(oneSequence.reverse());2375 return allSequences;2378 /* First version of form columns width setting */2379 function t_forms__calculateFieldsWidthInJS(field, formWrapperWidth) {2380 var marginLeft = 15;2382 1: 't-input-block_width100',2383 2: 't-input-block_width50',2384 3: 't-input-block_width33',2385 4: 't-input-block_width25',2388 for (var i in columns) {2389 if (field.classList.contains(columns[i])) {2390 field.style.width = (formWrapperWidth - marginLeft * (i - 1)) / i + 'px';2391 var label = field.previousElementSibling;2392 if (label && label.classList.contains('t-input-title')) {2393 label.style.width = (formWrapperWidth - marginLeft * (i - 1)) / i + 'px';2396 if (window.innerWidth < 480) {2397 if (field) field.style.width = '100%';2398 if (label) label.style.width = '100%';