changeset f8a74ce6ff31 in sao:6.4
details: https://hg.tryton.org/sao?cmd=changeset&node=f8a74ce6ff31
description:
        Compute colspan with a minimal of 1

        When container have a negative number of column, col is set to 0.
        The computation of colspan must be at least 1 otherwise the width of 
the cell
        is set to 0%.

        issue11604
        review439271004
        (grafted from 9b69fb52fc961cff7a58ab4f6034e9129cdd4199)
diffstat:

 src/view/form.js |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (41 lines):

diff -r 38a93c916785 -r f8a74ce6ff31 src/view/form.js
--- a/src/view/form.js  Tue Jul 19 20:59:02 2022 +0200
+++ b/src/view/form.js  Sat Jul 30 11:08:37 2022 +0200
@@ -606,7 +606,7 @@
                 let i = 0;
                 row.children().map(function() {
                     var cell = jQuery(this);
-                    var colspan = Math.min(Number(cell.attr('colspan')), col);
+                    var colspan = Math.min(Number(cell.attr('colspan')), col 
|| 1);
                     if (cell.hasClass('xexpand') &&
                         (!jQuery.isEmptyObject(cell.children())) &&
                         (cell.children(':not(.tooltip)').css('display') != 
'none')) {
@@ -626,7 +626,7 @@
                     var reduce = function(previous, current) {
                         var cell = current[0];
                         var colspan = Math.min(
-                            Number(cell.attr('colspan')), col);
+                            Number(cell.attr('colspan')), col || 1);
                         return previous + colspan;
                     };
                     return a.reduce(reduce, 0) - b.reduce(reduce, 0);
@@ -641,7 +641,8 @@
                 for (const e of xexpands) {
                     var cell = e[0];
                     let i = e[1];
-                    const colspan = Math.min(Number(cell.attr('colspan')), 
col);
+                    const colspan = Math.min(
+                        Number(cell.attr('colspan')), col || 1);
                     var current_width = 0;
                     for (let j = 0; j < colspan; j++) {
                         current_width += widths[i + j] || 0;
@@ -669,7 +670,8 @@
                 let i = 0;
                 for (let cell of row.children()) {
                     cell = jQuery(cell);
-                    const colspan = Math.min(Number(cell.attr('colspan')), 
col);
+                    const colspan = Math.min(
+                        Number(cell.attr('colspan')), col || 1);
                     if (cell.hasClass('xexpand') &&
                         (cell.children(':not(.tooltip)').css('display') !=
                          'none')) {

Reply via email to