Fix header columns being misaligned with table columns in item tree

And reindent _virtualized-table.scss
This commit is contained in:
Adomas Venčkauskas 2021-04-23 12:05:00 +03:00 committed by Dan Stillman
parent 431d7e1eaa
commit 55c758c9d0
2 changed files with 228 additions and 211 deletions

View file

@ -1083,7 +1083,10 @@ class VirtualizedTable extends React.Component {
const header = document.querySelector(`#${this.props.id} .virtualized-table-header`); const header = document.querySelector(`#${this.props.id} .virtualized-table-header`);
const scrollbarWidth = Math.max(0, const scrollbarWidth = Math.max(0,
tree.getBoundingClientRect().width - jsWindow.getBoundingClientRect().width); tree.getBoundingClientRect().width - jsWindow.getBoundingClientRect().width);
header.style.width = `calc(100% - ${scrollbarWidth}px)`; // Should be kept up to date with the _virtualized-table.scss value
// for .virtualized-table-header
const paddingInlineStart = 6;
header.style.width = `calc(100% - ${scrollbarWidth+paddingInlineStart}px)`;
} }
/** /**

View file

@ -3,249 +3,263 @@
// -------------------------------------------------- // --------------------------------------------------
/** /**
<hbox class="virtualized-table-container" flex="1"> <hbox class="virtualized-table-container" flex="1">
<html:div id="virtualized-table-div"/> <html:div id="virtualized-table-div"/>
</hbox> </hbox>
*/ */
.virtualized-table-container { .virtualized-table-container {
display: flex;
height: 0;
flex-direction: column;
> div {
display: flex; display: flex;
flex: 1; height: 0;
background-color: -moz-field; flex-direction: column;
overflow: hidden;
position: relative; > div {
} display: flex;
flex: 1;
background-color: -moz-field;
overflow: hidden;
position: relative;
}
} }
.virtualized-table, .drag-image-container { .virtualized-table, .drag-image-container {
width: 100%;
display: flex;
flex-direction: column;
position: relative;
&:focus {
outline: none;
}
&.resizing {
cursor: col-resize;
.cell {
cursor: col-resize;
}
}
.cell {
min-width: 30px;
cursor: default;
white-space: nowrap;
flex-grow: 1;
flex-shrink: 1;
box-sizing: border-box;
&.primary {
display: flex;
align-items: center;
:not(.cell-text) {
flex-shrink: 0
}
.cell-text {
flex-shrink: 1;
text-overflow: ellipsis;
overflow: hidden;
margin-inline-start: 6px;
}
.twisty + .cell-text, .spacer-twisty + .cell-text {
margin-inline-start: 0;
}
}
.cell-icon {
min-width: 16px;
}
}
.row {
display: flex;
flex-direction: row;
align-items: center;
width: 100%; width: 100%;
box-sizing: border-box; display: flex;
flex-direction: column;
position: relative;
&.drop { &:focus {
color: $shade-0 !important; outline: none;
background: $shade-5 !important;
* {
pointer-events: none !important;
}
} }
span.drop-before, span.drop-after { &.resizing {
position: absolute; cursor: col-resize;
width: 20%;
height: 1px; .cell {
background-color: $shade-5; cursor: col-resize;
pointer-events: none; }
}
span.drop-before {
top: 0;
}
span.drop-after {
bottom: -1px;
} }
&.selected:not(.highlighted) { .cell {
background-color: highlight; min-width: 30px;
color: highlighttext; cursor: default;
white-space: nowrap;
flex-grow: 1;
flex-shrink: 1;
box-sizing: border-box;
&.primary {
display: flex;
align-items: center;
:not(.cell-text) {
flex-shrink: 0
}
.cell-text {
flex-shrink: 1;
text-overflow: ellipsis;
overflow: hidden;
margin-inline-start: 6px;
}
.twisty + .cell-text, .spacer-twisty + .cell-text {
margin-inline-start: 0;
}
}
.cell-icon {
min-width: 16px;
}
} }
&.highlighted { .row {
background: #FFFF99; display: flex;
flex-direction: row;
align-items: center;
width: 100%;
box-sizing: border-box;
&.drop {
color: $shade-0 !important;
background: $shade-5 !important;
* {
pointer-events: none !important;
}
}
span.drop-before, span.drop-after {
position: absolute;
width: 20%;
height: 1px;
background-color: $shade-5;
pointer-events: none;
}
span.drop-before {
top: 0;
}
span.drop-after {
bottom: -1px;
}
&.selected:not(.highlighted) {
background-color: highlight;
color: highlighttext;
}
&.highlighted {
background: #FFFF99;
}
&.unread {
font-weight: bold;
}
&.context-row {
color: gray;
}
} }
&.unread { .column-drag-marker {
font-weight: bold; z-index: 99999;
position: absolute;
top: 0;
height: 100%;
width: 2px;
background-color: #ccc;
} }
&.context-row {
color: gray;
}
}
.column-drag-marker {
z-index: 99999;
position: absolute;
top: 0;
height: 100%;
width: 2px;
background-color: #ccc;
}
} }
.virtualized-table-header { .virtualized-table-header {
display: flex;
flex-direction: row;
align-items: center;
width: calc(100% - 11px);
border-bottom: 1px solid #ccc;
background: #f6f6f6;
height: 2em;
overflow: hidden;
border-inline-end: 1px solid #ddd;
&.static-columns {
pointer-events: none;
}
.column-picker {
text-align: center;
}
.cell {
display: flex; display: flex;
position: relative; flex-direction: row;
height: 100%;
align-items: center; align-items: center;
width: calc(100% - 11px);
&:hover { border-bottom: 1px solid #ccc;
background: #fff; background: #f6f6f6;
} height: 2em;
&.dragging {
background: #e9e9e9;
}
.resizer {
background: linear-gradient(#ddd, #ddd) no-repeat center/1px 80%;
cursor: col-resize;
height: 100%;
content: "\00a0";
display: block;
position: absolute;
left: -5px;
min-width: 10px;
}
.label {
margin-inline-start: 10px;
overflow: hidden;
text-overflow: ellipsis;
}
&.cell-icon {
> .label {
margin-inline-start: 0;
}
justify-content: center;
}
.sort-indicator {
-moz-appearance: toolbarbutton-dropdown;
display: block;
position: absolute;
right: 10px;
&.ascending {
transform: rotate(180deg);
}
}
}
}
.virtualized-table-body, .drag-image-container{
flex: 1 0;
max-width: 100%;
overflow: auto;
.row {
padding-inline-start: 6px;
}
.cell {
padding: 2px 5px;
text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
pointer-events: none; border-inline-end: 1px solid #ddd;
min-height: 90%; padding-inline-start: 6px;
}
&.static-columns {
pointer-events: none;
}
.column-picker {
text-align: center;
}
.cell {
display: flex;
position: relative;
height: 100%;
align-items: center;
&:hover {
background: #fff;
}
&.dragging {
background: #e9e9e9;
}
.resizer {
background: linear-gradient(#ddd, #ddd) no-repeat center/1px 80%;
cursor: col-resize;
height: 100%;
content: "\00a0";
display: block;
position: absolute;
left: -5px;
min-width: 10px;
}
.label {
margin-inline-start: 10px;
overflow: hidden;
text-overflow: ellipsis;
}
&:first-child .label {
margin-inline-start: 4px;
}
&.cell-icon {
> .label {
margin-inline-start: 0;
}
justify-content: center;
}
.sort-indicator {
-moz-appearance: toolbarbutton-dropdown;
display: block;
position: absolute;
right: 10px;
&.ascending {
transform: rotate(180deg);
}
}
}
} }
.virtualized-table-body, .drag-image-container {
flex: 1 0;
max-width: 100%;
overflow: auto;
.row {
padding-inline-start: 6px;
}
.cell {
padding: 2px 5px;
text-overflow: ellipsis;
overflow: hidden;
pointer-events: none;
min-height: 90%;
}
}
.spacer-twisty { .spacer-twisty {
display: inline-block; display: inline-block;
min-width: 8px; min-width: 8px;
} }
.twisty { .twisty {
margin-inline-end: 0 !important; margin-inline-end: 0 !important;
display: flex; display: flex;
align-items: center; align-items: center;
svg { svg {
fill: #444; fill: #444;
transition: transform 0.125s ease; transition: transform 0.125s ease;
transform: rotate(-90deg); transform: rotate(-90deg);
} }
&.open svg { &.open svg {
transform: rotate(0deg) !important; transform: rotate(0deg) !important;
} }
} }
*[dir=rtl] { *[dir=rtl] {
.virtualized-table-header { .virtualized-table-header {
.cell .sort-indicator { .cell .sort-indicator {
left: 10px; left: 10px;
right: initial; right: initial;
}
.resizer {
right: -5px;
left: initial;
}
} }
.resizer {
right: -5px; .twisty svg {
left: initial; transform: rotate(90deg);
} }
}
.twisty svg {
transform: rotate(90deg);
}
} }