diff --git a/sao/CHANGELOG b/sao/CHANGELOG index 338d6f8667..d2e0cc6b96 100644 --- a/sao/CHANGELOG +++ b/sao/CHANGELOG @@ -1,3 +1,4 @@ +* Allow column resizing * Add simple chat widget on sidebar * Support color as type of icon and image * Support color widget on form view diff --git a/sao/src/sao.less b/sao/src/sao.less index 71286d226d..ca74753698 100644 --- a/sao/src/sao.less +++ b/sao/src/sao.less @@ -708,6 +708,15 @@ img.icon { display: flex; flex-direction: column; min-height: 0; + + .tree-dragged-image { + display: block; + height: 0; + left: 0; + position: absolute; + top: 0; + width: 0; + } } .wizard-form { @@ -724,6 +733,11 @@ img.icon { > table.tree { width: 100%; table-layout: fixed; + border: 1px solid transparent; + + &.table-bordered { + border-color: @table-border-color; + } col.selection-state, col.favorite, col.tree-menu { width: 30px; @@ -749,15 +763,37 @@ img.icon { } } > thead > tr > th { - > label.sortable { - cursor: pointer; + position: relative; + padding: 5px; + + > label { + display: inline-block; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + margin: 0; + + &.sortable { + cursor: pointer; + } } + + > div.resizer { + z-index: 1; + position: absolute; + top: 0; + inset-inline-end: -5px; + width: 2px; + height: 100%; + cursor: ew-resize; + padding: 0 4px; + background-color: transparent; + } + &.tree-menu { cursor: pointer; overflow: visible; } - overflow: hidden; - text-overflow: ellipsis; text-align: center; &.char, &.text, &.many2one, &.one2one, &.date, &.time, &.selection, &.reference, &.url, &.email, &.callto, &.sip { @@ -775,8 +811,15 @@ img.icon { z-index: 100; th { + border: 1px solid transparent; + border-bottom: 2px solid @table-border-color; background-color: @body-bg; } + + &:hover th { + border: 1px solid @table-border-color; + border-bottom-width: 2px; + } } > tfoot > tr { bottom: 0; @@ -920,6 +963,26 @@ img.icon { padding-top: 0; padding-bottom: 0; } + + > table.table-bordered { + border: 1px solid @table-border-color; + > thead, + > tbody, + > tfoot { + > tr:first-child { + > th, + > td { + border: 1px solid @table-border-color; + } + } + } + > thead > tr:first-child { + > th, + > td { + border-bottom-width: 2px; + } + } + } } .form, .board { diff --git a/sao/src/screen.js b/sao/src/screen.js index 183d6bd735..69d5b7c6e9 100644 --- a/sao/src/screen.js +++ b/sao/src/screen.js @@ -2219,6 +2219,7 @@ } else if (~['tree', 'list-form'].indexOf(view.view_type)) { var paths; if (view.view_type == 'tree') { + view.save_width(); paths = view.get_expanded_paths(); } else { paths = []; @@ -2345,5 +2346,6 @@ }); } }); + Sao.Screen.tree_column_width = {}; Sao.Screen.tree_column_optional = {}; }()); diff --git a/sao/src/view/tree.js b/sao/src/view/tree.js index 7d5a3ac732..17ff68ee70 100644 --- a/sao/src/view/tree.js +++ b/sao/src/view/tree.js @@ -15,6 +15,35 @@ }); } + // circumvent https://bugzilla.mozilla.org/show_bug.cgi?id=505521 + let dragoverFixAdded = false; + let lastWindowDragEvent = null; + const fillEventScreenPosition = (e) => { + e.screenPosition = { + x: e.screenX, + y: e.screenY, + }; + + if (!navigator.userAgent.search("Firefox")) { + return; + } + + if (!dragoverFixAdded) { + window.addEventListener('dragover', (e) => { + lastWindowDragEvent = e; + }); + dragoverFixAdded = true; + } + + if (lastWindowDragEvent && + (e.timeStamp - lastWindowDragEvent.timeStamp) < 100) { + e.screenPosition = { + x: lastWindowDragEvent.screenX, + y: lastWindowDragEvent.screenY, + }; + } + } + Sao.View.TreeXMLViewParser = Sao.class_(Sao.View.XMLViewParser, { _parse_tree: function(node, attributes) { for (const child of node.childNodes) { @@ -118,6 +147,9 @@ this.treeview = jQuery('
', { 'class': 'treeview responsive' }).appendTo(this.el); + this.dragged_image= jQuery('', { + 'class': 'tree-dragged-image', + }).html(' ').appendTo(this.el); // Synchronize both scrollbars this.treeview.scroll(() => { @@ -189,6 +221,7 @@ }); } + let idx = 2; for (const column of this.columns) { col = jQuery('', { 'class': column.attributes.widget, @@ -197,6 +230,7 @@ 'class': column.attributes.widget, }); th.uniqueId(); + th.get(0).dataset.column = idx; var label = jQuery('