changeset 4050d1aadcc8 in sao:6.2
details: https://hg.tryton.org/sao?cmd=changeset&node=4050d1aadcc8
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 30bba28b7d5e -r 4050d1aadcc8 src/view/form.js
--- a/src/view/form.js  Fri Jul 01 23:12:04 2022 +0200
+++ b/src/view/form.js  Sat Jul 30 11:08:37 2022 +0200
@@ -612,7 +612,7 @@
                 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')) {
@@ -632,7 +632,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);
@@ -647,7 +647,8 @@
                 xexpands.forEach(function(e) {
                     var cell = e[0];
                     i = e[1];
-                    var colspan = Math.min(Number(cell.attr('colspan')), col);
+                    var colspan = Math.min(
+                        Number(cell.attr('colspan')), col || 1);
                     var current_width = 0;
                     for (j = 0; j < colspan; j++) {
                         current_width += widths[i + j] || 0;
@@ -675,7 +676,8 @@
                 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') &&
                         (cell.children(':not(.tooltip)').css('display') !=
                          'none')) {

Reply via email to