jsdialog: don't add margin to flat list entries

in case of list view without levels we don't need
margin in first cell

detect that based on presence of aria-level property

use width: max-content to be sure we don't wrap entries
if not needed

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Ica98e90dffd1e2b7330eb962cfc8141fa6fe01a1
This commit is contained in:
Szymon Kłos 2023-10-23 09:56:41 +02:00 committed by Szymon Kłos
parent f0e1eea2db
commit 2e10823246
2 changed files with 8 additions and 9 deletions

View file

@ -391,6 +391,7 @@ td.jsdialog > [id^='table-box']:not(.sidebar) {
overflow-x: hidden;
max-width: 1000px;
min-width: 150px;
width: max-content;
padding: 1px;
padding-inline-end: 3px;
}
@ -539,7 +540,7 @@ input[type='checkbox']:checked.autofilter, .jsdialog input[type='checkbox']:chec
vertical-align: top;
}
.ui-treeview tr:not([aria-expanded]) > td:first-child::before {
.ui-treeview tr[aria-level]:not([aria-expanded]) > td:first-child::before {
font-family: monospace;
content: 'V';
color: transparent;
@ -1841,7 +1842,3 @@ kbd,
min-width: 75%;
}
/* Review -> Manage changes */
#AcceptRejectChangesDialog .ui-treeview {
width: max-content;
}

View file

@ -408,7 +408,7 @@ function _makeTreeFlat(entries, depth) {
return flatList;
}
function _createHeaders(tbody, data, builder) {
function _createHeaders(tbody, data, builder, depth) {
var headers = L.DomUtil.create('tr', builder.options.cssClass + ' ui-treeview-header', tbody);
headers.setAttribute('role', 'row');
var hasCheckboxes = data.entries && data.entries.length && data.entries[0].state !== undefined;
@ -417,7 +417,7 @@ function _createHeaders(tbody, data, builder) {
var hasIcons = data.entries && data.entries.length && _hasIcon(data.entries[0].columns);
if (hasIcons)
data.headers = [{ text: '' }].concat(data.headers);
var isTreeGrid = _calulateTreeDepth(data.entries) > 0;
var isTreeGrid = depth > 0;
for (var h in data.headers) {
var header = L.DomUtil.create('th', builder.options.cssClass, headers);
@ -587,9 +587,10 @@ function _treelistboxControl(parentContainer, data, builder) {
var tbody = L.DomUtil.create('tbody', builder.options.cssClass + ' ui-treeview-body', table);
var depth = _calulateTreeDepth(data.entries);
var isHeaderListBox = data.headers && data.headers.length !== 0;
if (isHeaderListBox)
_createHeaders(tbody, data, builder);
_createHeaders(tbody, data, builder, depth);
if (!disabled) {
tbody.ondrop = function (ev) {
@ -625,7 +626,8 @@ function _treelistboxControl(parentContainer, data, builder) {
var tr = L.DomUtil.create('tr', builder.options.cssClass + ' ui-listview-entry', tbody);
tr.setAttribute('role', 'row');
var entry = flatEntries[i];
tr.setAttribute('aria-level', entry.depth + 1);
if (depth > 0)
tr.setAttribute('aria-level', entry.depth + 1);
if (entry.children && entry.children.length)
tr.setAttribute('aria-expanded', true);
_headerlistboxEntry(tr, data, entry, builder);