From d39a1c2750a0ff94ccbb3d0dcede3f688c5cc1a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 24 Jan 2020 00:18:19 +0100 Subject: [PATCH] Add xalign and yalign to group issue8956 review258581002 --- src/sao.less | 3 +++ src/view/form.js | 20 +++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/sao.less b/src/sao.less index 7bc2e4a3ef..82a99e44e9 100644 --- a/src/sao.less +++ b/src/sao.less @@ -380,6 +380,9 @@ img.icon { .form { width: 100%; + .form-container, .form-hcontainer, .form-vcontainer { + display: inline-table; + } table.form-container > tbody > tr > td { padding: 1px; } diff --git a/src/view/form.js b/src/view/form.js index 7303912571..dd13b9102c 100644 --- a/src/view/form.js +++ b/src/view/form.js @@ -164,6 +164,12 @@ function eval_pyson(value){ 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 @@ function eval_pyson(value){ 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 @@ function eval_pyson(value){ i += colspan; }); }); - if (has_expand) { + if (has_expand && this.el.closest('td').hasClass('xexpand')) { this.el.css('width', '100%'); } else { this.el.css('width', '');