changeset c0ea6f596c1f in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=c0ea6f596c1f
description:
        Add xalign and yalign to group

        issue8956
        review258581002
diffstat:

 src/sao.less     |   3 +++
 src/view/form.js |  20 +++++++++++++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)

diffs (57 lines):

diff -r 50aa625342d0 -r c0ea6f596c1f src/sao.less
--- a/src/sao.less      Thu Jan 23 20:48:49 2020 +0100
+++ b/src/sao.less      Fri Jan 24 00:18:19 2020 +0100
@@ -380,6 +380,9 @@
 
 .form {
     width: 100%;
+    .form-container, .form-hcontainer, .form-vcontainer {
+        display: inline-table;
+    }
     table.form-container > tbody > tr > td {
         padding: 1px;
     }
diff -r 50aa625342d0 -r c0ea6f596c1f src/view/form.js
--- a/src/view/form.js  Thu Jan 23 20:48:49 2020 +0100
+++ b/src/view/form.js  Fri Jan 24 00:18:19 2020 +0100
@@ -164,6 +164,12 @@
             this.view.containers.push(group);
             this.parse_child(node, group);
 
+            if (attributes.xalign === undefined) {
+                attributes.xalign = 0.5;
+            }
+            if (attributes.yalign === undefined) {
+                attributes.yalign = 0.5;
+            }
             if (attributes.name && (attributes.name == this.exclude_field)) {
                 this.container.add(null, attributes);
                 return;
@@ -485,10 +491,14 @@
             if (attributes.xalign !== undefined) {
                 // TODO replace by start/end when supported
                 var align;
-                if (Sao.i18n.rtl) {
-                    align = attributes.xalign >= 0.5? 'left': 'right';
-                } else {
-                    align = attributes.xalign >= 0.5? 'right': 'left';
+                if (attributes.xalign != 0.5) {
+                    if (Sao.i18n.rtl) {
+                        align = attributes.xalign >= 0.5? 'left': 'right';
+                    } else {
+                        align = attributes.xalign >= 0.5? 'right': 'left';
+                    }
+                } else if (!xexpand) {
+                    align = 'center';
                 }
                 cell.css('text-align', align);
             }
@@ -625,7 +635,7 @@
                     i += colspan;
                 });
             });
-            if (has_expand) {
+            if (has_expand && this.el.closest('td').hasClass('xexpand')) {
                 this.el.css('width', '100%');
             } else {
                 this.el.css('width', '');

Reply via email to