From 313471185e08a20ab78c2f04c1bca38bdb4e5688 Mon Sep 17 00:00:00 2001 From: Nicolas Evrard Date: Wed, 19 Apr 2023 12:16:13 +0200 Subject: [PATCH] Fill the empty spaces when computing alignment while expanded [PREVIEW] https://foss.heptapod.net/tryton/tryton/-/issues/12141 --- src/view/form.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/view/form.js b/src/view/form.js index 08ea433d..1433cff2 100644 --- a/src/view/form.js +++ b/src/view/form.js @@ -582,6 +582,13 @@ function eval_pyson(value){ cell.css('vertical-align', yalign); } + if (attributes.yfill) { + cell.addClass('yfill'); + if (attributes.yexpand) { + widget.el.css('height', '100%'); + } + } + if (attributes.help) { widget.el.attr('title', attributes.help); } @@ -600,6 +607,12 @@ function eval_pyson(value){ } }); + var get_y_size = function(row) { + row = jQuery(row); + return row.children(':not(.yfill)').toArray().reduce( + (acc, element) => Math.max(acc, element.clientHeight), + 0); + }; var get_xexpands = function(row) { row = jQuery(row); var xexpands = []; @@ -667,6 +680,8 @@ function eval_pyson(value){ } for (let row of rows) { row = jQuery(row); + row.children('.yfill').css('height', ''); + var y_size = get_y_size(row); let i = 0; for (let cell of row.children()) { cell = jQuery(cell); @@ -688,6 +703,18 @@ function eval_pyson(value){ } else { cell.css('width', ''); } + if ((y_size > 0) && + cell.hasClass('yfill') && + (cell.children(':not(.tooltip)').css('display') != + 'none')) { + cell.css('height', y_size + 'px'); + // Override max-height set in sao.css required to have a + // scrollbar + cell.find('.treeview, .list-form').first().css( + 'max-height', y_size + 'px'); + } else { + cell.css('height', ''); + } // show/hide when container is horizontal or vertical // to not show padding if (cell.children().css('display') == 'none') {