From a44295377668da8c8fb129e7739880f0725c2c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Sat, 6 Apr 2024 18:30:01 +0200 Subject: [PATCH] Use a pure CSS solution to compute the container view height and width Closes #12983 --- sao/index.html | 2 +- sao/src/sao.less | 89 +++++++++++++++++++++++++++++++++++++++++--- sao/src/screen.js | 2 + sao/src/tab.js | 30 +++++++++------ sao/src/view/tree.js | 42 ++------------------- 5 files changed, 108 insertions(+), 57 deletions(-) diff --git a/sao/index.html b/sao/index.html index 3984b4d831..b0c06f33a7 100644 --- a/sao/index.html +++ b/sao/index.html @@ -81,7 +81,7 @@ this repository contains the full copyright notices and license terms. --> style="height: calc(100vh - 50px - 1px - 20px); margin: 0px;"> -
+
diff --git a/sao/src/sao.less b/sao/src/sao.less index 16bccc26b0..bfbf17637a 100644 --- a/sao/src/sao.less +++ b/sao/src/sao.less @@ -152,7 +152,6 @@ html[theme="default"] { #menu, #tabs { margin-top: 5px; - padding-bottom: 5px; .navbar-brand { .title { @@ -231,8 +230,54 @@ html[theme="default"] { } } -#tabcontent > .tab-pane > .panel { - margin-bottom: 0; +#tabcontent { + display: block; + width: 100%; + + > .tab-pane > .panel { + display: flex; + flex-direction: column; + flex: 1; + margin-bottom: 5px; + + > .panel-body { + display: flex; + flex: 1; + flex-direction: row; + padding-top: 0; + min-height: 0; + + > div { + display: inline-flex; + padding-left: 15px; + padding-right: 15px; + + &:first-child { + flex: 2; + } + } + } + } + + > .tab-pane.active { + /* override bootstrap which sets display to block */ + display: flex; + flex: 1; + } +} + +@media screen and (max-width: @screen-xs-max) { + #tabcontent { + > .tab-pane > .panel > .panel-body { + flex-direction: column-reverse; + min-height: unset; + } + } +} + +#tabcontent[data-view-type="tree"] { + display: flex; + flex: 1; } @media screen and (min-width: @screen-sm-min) { @@ -352,6 +397,7 @@ html.accesskey { .tab-domain { overflow-x: auto; + flex: 0 0 content; > .nav-tabs { display: inline-flex; @@ -463,6 +509,12 @@ img.icon { } } +.screen-container { + display: flex; + flex-direction: column; + flex: 1; +} + .filter-box { margin: 5px 0; } @@ -476,13 +528,38 @@ img.icon { } .content-box { + display: flex; + flex-direction: column; + flex: 1; overflow-y: auto; } +.tree-container { + display: flex; + flex-direction: column; + min-height: 0; +} + +.attachment-preview { + border-color: @panel-default-border; + border-style: solid; + border-width: 0 0 0 1px; + flex: 1; + margin-left: 5px; + min-width: 20%; + overflow: auto; + + > div { + flex: 1; + } +} + +.wizard-form { + width: 100%; +} + @media screen and (max-width: @screen-sm-max) { .attachment-preview:not(:empty) { - border-color: @panel-default-border; - border-style: solid; border-width: 0 0 1px 0; margin-bottom: 5px; } @@ -689,6 +766,7 @@ img.icon { .form { width: 100%; + height: 100%; .form-container, .form-hcontainer, .form-vcontainer { display: grid; width: 100%; @@ -1172,6 +1250,7 @@ input.column-boolean { } .scrollbar { + flex: 0 0 content; overflow: auto; > div { diff --git a/sao/src/screen.js b/sao/src/screen.js index 0e0dbfa9de..072573e326 100644 --- a/sao/src/screen.js +++ b/sao/src/screen.js @@ -981,6 +981,8 @@ if (this.switch_callback) { this.switch_callback(); } + Sao.Tab.set_view_type( + Sao.Tab.tabs.get_current().view_type); }); }; const set_current_view = () => { diff --git a/sao/src/tab.js b/sao/src/tab.js index 639dfaeec9..3cfc5df85d 100644 --- a/sao/src/tab.js +++ b/sao/src/tab.js @@ -129,9 +129,7 @@ this.main = jQuery('
', { 'class': 'panel-body row', }).appendTo(this.el); - this.content = jQuery('
', { - 'class': 'col-xs-12', - }).appendTo(this.main); + this.content = jQuery('
').appendTo(this.main); if (this.info_bar) { this.el.append(this.info_bar.el); @@ -361,6 +359,9 @@ }, get_url: function() { }, + get current_view_type() { + return 'form'; + }, compare: function(attributes) { return false; }, @@ -436,6 +437,7 @@ 'href': '#' + tab.id }).on('show.bs.tab', function() { Sao.set_url(tab.get_url(), tab.name_long.split(' / ').pop()); + Sao.Tab.set_view_type(tab.current_view_type); }) .append(jQuery('