Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set selection size according to its content [CUSTOM] #367

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions sao/src/sao.less
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,18 @@ img.icon {
}
}

.form-selection {
select.form-control {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;

// size is fixed by the theme
border-right: 13px solid transparent;
background-position: right -13px center;
}
}

@media screen and (min-width: @screen-sm-min) {
.form-reference {
> .input-sm, > .input-group {
Expand Down
8 changes: 6 additions & 2 deletions sao/src/theme/coog/sao.less
Original file line number Diff line number Diff line change
Expand Up @@ -686,8 +686,12 @@ div.form-item.form-float:has(+ div.form-item.form-label) {
}
}

div.form-selection select.form-control {
padding: 0px 5px 0px 5px;
div.form-selection {
max-width: 30ch;

select.form-control {
padding: 0px 5px 0px 5px;
}
}

div.form-text {
Expand Down
3 changes: 3 additions & 0 deletions sao/src/view/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -2719,6 +2719,7 @@ function hide_x2m_body(widget) {
});
},
set_selection: function(selection, help) {
let width = 0;
var select = this.select;
select.empty();
for (const e of selection) {
Expand All @@ -2727,7 +2728,9 @@ function hide_x2m_body(widget) {
'text': e[1],
'title': help[e[0]],
}));
width = Math.max(width, e[1].length);
}
this.el.css('width', `${width + 2}ch`);
},
display_update_selection: function() {
var record = this.record;
Expand Down