zotero/scss/components/_virtualized-table.scss

394 lines
6.9 KiB
SCSS
Raw Normal View History

XUL -> JS tree megacommit - Just a single huge commit. This has been developed over too long a time, required many tiny changes across too many files and has seen too many iterations to be separated into separate commits. The original branch with all the messy commits will be kept around for posterity https://github.com/zotero/zotero/compare/bb220ad0f2d6bf0eca6df6d225d3d358cb50a27b...adomasven:feature/react-item-tree - Replaces XUL <tree> element across the whole zotero client codebase with a custom supermegafast virtualized-table inspired by react-virtualized yet mimicking old XUL treeview API. The virtualized-table sits on top on a raw-to-the-metal, interpreted-at-runtime JS based windowing solution inspired by react-window. React-based solutions could not be used because they were slow and Zotero UI needs to be responsive and be able to display thousands of rows in a treeview without any slowdowns. - Attempts were made at making this screen-reader friendly, but yet to be tested with something like JAWS - RTL-friendly - Styling and behaviour across all platforms was copied as closely as possible to the original XUL tree - Instead of row-based scroll snapping this has smooth-scrolling. If you're using arrow keys to browse through the tree then it effectively snap-scrolls. Current CSS snap scroll attributes do not seem to work in the way we would require even on up-to-date browsers, yet alone the ESR version of FX that Zotero is on. JS solutions are either terrible for performance or produce inexcusable jitter. - When dragging-and-dropping items the initial drag freezes the UI for a fairly jarring amount of time. Does not seem to be fixable due to the synchronous code that needs to be run in the dragstart handler. Used to be possible to run that code async with the XUL tree. - Item tree column picker no longer has a dedicated button. Just right-click the columns. The column preferences (width, order, etc) are no longer handled by XUL, which required a custom serialization and storage solution that throws warnings in the developer console due to the amount of data being stored. Might cause temporary freezing on HDDs upon column resize/reorder/visibility toggling. - Context menu handling code basically unchanged, but any UI changes that plugins may have wanted to do (including adding new columns) will have to be redone by them. No serious thought has gone into how plugin developers would achieve that yet. - Opens up the possibility for awesome alternative ways to render the tree items, including things like multiple-row view for the item tree, which has been requested for a long while especially by users switching from other referencing software
2020-06-03 07:29:46 +00:00
//
// Virtualized table
// --------------------------------------------------
/**
<hbox class="virtualized-table-container" flex="1">
<html:div id="virtualized-table-div"/>
</hbox>
XUL -> JS tree megacommit - Just a single huge commit. This has been developed over too long a time, required many tiny changes across too many files and has seen too many iterations to be separated into separate commits. The original branch with all the messy commits will be kept around for posterity https://github.com/zotero/zotero/compare/bb220ad0f2d6bf0eca6df6d225d3d358cb50a27b...adomasven:feature/react-item-tree - Replaces XUL <tree> element across the whole zotero client codebase with a custom supermegafast virtualized-table inspired by react-virtualized yet mimicking old XUL treeview API. The virtualized-table sits on top on a raw-to-the-metal, interpreted-at-runtime JS based windowing solution inspired by react-window. React-based solutions could not be used because they were slow and Zotero UI needs to be responsive and be able to display thousands of rows in a treeview without any slowdowns. - Attempts were made at making this screen-reader friendly, but yet to be tested with something like JAWS - RTL-friendly - Styling and behaviour across all platforms was copied as closely as possible to the original XUL tree - Instead of row-based scroll snapping this has smooth-scrolling. If you're using arrow keys to browse through the tree then it effectively snap-scrolls. Current CSS snap scroll attributes do not seem to work in the way we would require even on up-to-date browsers, yet alone the ESR version of FX that Zotero is on. JS solutions are either terrible for performance or produce inexcusable jitter. - When dragging-and-dropping items the initial drag freezes the UI for a fairly jarring amount of time. Does not seem to be fixable due to the synchronous code that needs to be run in the dragstart handler. Used to be possible to run that code async with the XUL tree. - Item tree column picker no longer has a dedicated button. Just right-click the columns. The column preferences (width, order, etc) are no longer handled by XUL, which required a custom serialization and storage solution that throws warnings in the developer console due to the amount of data being stored. Might cause temporary freezing on HDDs upon column resize/reorder/visibility toggling. - Context menu handling code basically unchanged, but any UI changes that plugins may have wanted to do (including adding new columns) will have to be redone by them. No serious thought has gone into how plugin developers would achieve that yet. - Opens up the possibility for awesome alternative ways to render the tree items, including things like multiple-row view for the item tree, which has been requested for a long while especially by users switching from other referencing software
2020-06-03 07:29:46 +00:00
*/
.virtualized-table-container {
2021-04-09 09:00:34 +00:00
display: flex;
height: 0;
flex-direction: column;
2021-04-09 09:00:34 +00:00
> div {
display: flex;
flex: 1;
2021-04-09 09:00:34 +00:00
overflow: hidden;
position: relative;
background: var(--material-background);
2021-04-09 09:00:34 +00:00
}
}
XUL -> JS tree megacommit - Just a single huge commit. This has been developed over too long a time, required many tiny changes across too many files and has seen too many iterations to be separated into separate commits. The original branch with all the messy commits will be kept around for posterity https://github.com/zotero/zotero/compare/bb220ad0f2d6bf0eca6df6d225d3d358cb50a27b...adomasven:feature/react-item-tree - Replaces XUL <tree> element across the whole zotero client codebase with a custom supermegafast virtualized-table inspired by react-virtualized yet mimicking old XUL treeview API. The virtualized-table sits on top on a raw-to-the-metal, interpreted-at-runtime JS based windowing solution inspired by react-window. React-based solutions could not be used because they were slow and Zotero UI needs to be responsive and be able to display thousands of rows in a treeview without any slowdowns. - Attempts were made at making this screen-reader friendly, but yet to be tested with something like JAWS - RTL-friendly - Styling and behaviour across all platforms was copied as closely as possible to the original XUL tree - Instead of row-based scroll snapping this has smooth-scrolling. If you're using arrow keys to browse through the tree then it effectively snap-scrolls. Current CSS snap scroll attributes do not seem to work in the way we would require even on up-to-date browsers, yet alone the ESR version of FX that Zotero is on. JS solutions are either terrible for performance or produce inexcusable jitter. - When dragging-and-dropping items the initial drag freezes the UI for a fairly jarring amount of time. Does not seem to be fixable due to the synchronous code that needs to be run in the dragstart handler. Used to be possible to run that code async with the XUL tree. - Item tree column picker no longer has a dedicated button. Just right-click the columns. The column preferences (width, order, etc) are no longer handled by XUL, which required a custom serialization and storage solution that throws warnings in the developer console due to the amount of data being stored. Might cause temporary freezing on HDDs upon column resize/reorder/visibility toggling. - Context menu handling code basically unchanged, but any UI changes that plugins may have wanted to do (including adding new columns) will have to be redone by them. No serious thought has gone into how plugin developers would achieve that yet. - Opens up the possibility for awesome alternative ways to render the tree items, including things like multiple-row view for the item tree, which has been requested for a long while especially by users switching from other referencing software
2020-06-03 07:29:46 +00:00
.virtualized-table, .drag-image-container {
2021-04-09 09:00:34 +00:00
width: 100%;
display: flex;
flex-direction: column;
position: relative;
2021-04-09 09:00:34 +00:00
&:focus {
outline: none;
2021-04-09 09:00:34 +00:00
}
&.resizing {
cursor: col-resize;
.cell {
cursor: col-resize;
}
2021-04-09 09:00:34 +00:00
}
.cell {
padding: 0 8px;
min-width: 30px;
cursor: default;
white-space: nowrap;
flex-grow: 1;
box-sizing: border-box;
&.label {
padding-inline-start: 0;
padding-inline-end: 4px;
}
2023-11-28 08:29:55 +00:00
&.first-column,
&.primary {
display: flex;
align-items: center;
:not(.cell-text) {
flex-shrink: 0
}
.cell-text {
flex-grow: 1;
text-overflow: ellipsis;
overflow: hidden;
2023-11-28 08:29:55 +00:00
&:not(:first-child) {
@include state(".cell.first-column:not(.hasAttachment)") {
margin-inline-start: 4px;
}
2023-11-28 08:29:55 +00:00
}
}
.twisty + .cell-text, .spacer-twisty + .cell-text {
margin-inline-start: 0;
margin-inline-end: 0;
}
2024-01-11 06:46:10 +00:00
// Add margin on the end side if the directionality of the
// .cell-text is the opposite of that of the table
&:dir(ltr) .cell-text:dir(rtl),
&:dir(rtl) .cell-text:dir(ltr) {
2024-01-11 06:46:10 +00:00
margin-inline-end: 5px;
}
&:dir(ltr) .cell-text {
text-align: left;
}
&:dir(rtl) .cell-text {
text-align: right;
}
}
.cell-icon {
min-width: 16px;
}
2021-04-09 09:00:34 +00:00
}
.row {
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
box-sizing: border-box;
border-radius: 5px;
&.drop {
color: var(--material-background) !important;
background: var(--fill-secondary) !important;
* {
pointer-events: none !important;
}
}
span.drop-before, span.drop-after {
position: absolute;
width: 20%;
height: 1px;
background-color: var(--fill-secondary);
pointer-events: none;
}
span.drop-before {
top: 0;
}
span.drop-after {
bottom: -1px;
}
&.selected:not(.highlighted) {
2023-12-15 09:51:39 +00:00
background-color: var(--color-accent);
color: #fff;
@include state(".virtualized-table:not(:focus-within)") {
color: var(--fill-primary);
2023-11-28 08:29:55 +00:00
background-color: var(--color-quarternary-on-sidepane);
}
}
&.highlighted {
background: var(--accent-highlight);
}
&.unread {
font-weight: 600;
}
&.context-row {
color: var(--fill-secondary);
}
.spacer-twisty {
display: inline-block;
min-width: 16px;
}
.twisty {
margin-inline-end: 0 !important;
display: flex;
align-items: center;
transition: transform 0.125s ease;
transform: rotate(-90deg);
&.open {
transform: rotate(0deg) !important;
}
&.icon-css {
width: 16px;
height: 16px;
2023-11-28 08:29:55 +00:00
padding: 4px;
box-sizing: border-box;
background: url("chrome://zotero/skin/8/universal/chevron-8.svg") content-box no-repeat;
2023-11-28 08:29:55 +00:00
-moz-context-properties: fill, fill-opacity;
}
}
2021-04-09 09:00:34 +00:00
}
.column-drag-marker {
z-index: 99999;
position: absolute;
top: 0;
height: 100%;
width: 2px;
background-color: #ccc;
2021-04-09 09:00:34 +00:00
}
.twisty {
width: 19px;
svg {
fill: #888;
width: 16px;
}
}
.selected:not(.highlighted) .twisty svg {
fill: #fff;
}
.spacer-twisty {
min-width: 19px;
}
.spacer-header {
min-width: 0px;
}
XUL -> JS tree megacommit - Just a single huge commit. This has been developed over too long a time, required many tiny changes across too many files and has seen too many iterations to be separated into separate commits. The original branch with all the messy commits will be kept around for posterity https://github.com/zotero/zotero/compare/bb220ad0f2d6bf0eca6df6d225d3d358cb50a27b...adomasven:feature/react-item-tree - Replaces XUL <tree> element across the whole zotero client codebase with a custom supermegafast virtualized-table inspired by react-virtualized yet mimicking old XUL treeview API. The virtualized-table sits on top on a raw-to-the-metal, interpreted-at-runtime JS based windowing solution inspired by react-window. React-based solutions could not be used because they were slow and Zotero UI needs to be responsive and be able to display thousands of rows in a treeview without any slowdowns. - Attempts were made at making this screen-reader friendly, but yet to be tested with something like JAWS - RTL-friendly - Styling and behaviour across all platforms was copied as closely as possible to the original XUL tree - Instead of row-based scroll snapping this has smooth-scrolling. If you're using arrow keys to browse through the tree then it effectively snap-scrolls. Current CSS snap scroll attributes do not seem to work in the way we would require even on up-to-date browsers, yet alone the ESR version of FX that Zotero is on. JS solutions are either terrible for performance or produce inexcusable jitter. - When dragging-and-dropping items the initial drag freezes the UI for a fairly jarring amount of time. Does not seem to be fixable due to the synchronous code that needs to be run in the dragstart handler. Used to be possible to run that code async with the XUL tree. - Item tree column picker no longer has a dedicated button. Just right-click the columns. The column preferences (width, order, etc) are no longer handled by XUL, which required a custom serialization and storage solution that throws warnings in the developer console due to the amount of data being stored. Might cause temporary freezing on HDDs upon column resize/reorder/visibility toggling. - Context menu handling code basically unchanged, but any UI changes that plugins may have wanted to do (including adding new columns) will have to be redone by them. No serious thought has gone into how plugin developers would achieve that yet. - Opens up the possibility for awesome alternative ways to render the tree items, including things like multiple-row view for the item tree, which has been requested for a long while especially by users switching from other referencing software
2020-06-03 07:29:46 +00:00
}
.virtualized-table-header {
2021-04-09 09:00:34 +00:00
display: flex;
flex-direction: row;
2021-04-09 09:00:34 +00:00
align-items: center;
width: 100%;
2023-11-28 08:29:55 +00:00
background: var(--material-background);
height: 1.83333333em; // 22px @ 12px font size
overflow: hidden;
2024-01-13 02:31:54 +00:00
border-bottom: 1px solid var(--material-border-quarternary);
padding-inline: 8px;
box-sizing: border-box;
padding-inline-end: calc(8px + var(--scrollbar-width, 0px));
2023-11-28 08:29:55 +00:00
@include comfortable {
height: 2.33333333em; // 28px @ 12px font size
padding: 0 8px;
}
2021-04-09 09:00:34 +00:00
&.static-columns {
pointer-events: none;
2021-04-09 09:00:34 +00:00
}
&::after {
content: "";
display: block;
border-bottom: var(--material-border-quarternary);
height: 1px;
width: 100%;
position: absolute;
top: calc(1.83333333em - 1px);
left: 0;
right: 0;
z-index: 1;
@include comfortable {
top: calc(2.33333333em - 1px);
}
}
.column-picker {
text-align: center;
2021-04-09 09:00:34 +00:00
}
.cell {
display: flex;
position: relative;
height: 100%;
align-items: center;
&:hover {
2023-11-28 08:29:55 +00:00
background: var(--material-mix-quinary);
}
&.dragging {
2023-11-28 08:29:55 +00:00
background: var(--material-mix-quarternary);
}
.resizer {
2023-11-28 08:29:55 +00:00
background: linear-gradient(var(--fill-quarternary), var(--fill-quarternary)) no-repeat center/1px 66.666667%; // 14px @ 12px font size
cursor: col-resize;
height: 100%;
content: "\00a0";
display: block;
position: absolute;
left: -5px;
min-width: 10px;
2023-11-28 08:29:55 +00:00
@include comfortable {
background-size: 1px 74.074074%; // 20px @ 12px font size
}
}
.label {
overflow: hidden;
text-overflow: ellipsis;
flex: 1;
}
&.cell-icon {
> .label {
margin-inline-start: 0;
}
2023-11-28 08:29:55 +00:00
.icon-css {
fill: var(--fill-secondary);
}
justify-content: center;
}
.sort-indicator {
-moz-appearance: toolbarbutton-dropdown;
display: block;
2023-11-28 08:29:55 +00:00
margin-right: 3px; // + 5px padding = 8px total
&.icon-css {
background: url("chrome://zotero/skin/8/universal/chevron-8.svg") content-box no-repeat;
2023-11-28 08:29:55 +00:00
-moz-context-properties: fill, fill-opacity;
fill: var(--fill-primary);
}
&.ascending {
transform: rotate(180deg);
}
}
2021-04-09 09:00:34 +00:00
}
}
2021-04-09 09:00:34 +00:00
.virtualized-table-body, .drag-image-container {
flex: 1 0;
max-width: 100%;
overflow: auto;
padding: 4px 8px 8px;
2021-04-09 09:00:34 +00:00
.cell {
text-overflow: ellipsis;
overflow: hidden;
max-height: 100%;
// TEMP: Disables tooltip display for truncated cells, but without this rule
// you cannot drag items before selecting them first because the ondrag event is
// not called if any children under the drag element are removed for which
// pointer-events are enabled, and we need to rerender the rows for selection
// before dragging.
pointer-events: none;
&.first-column {
padding-inline-start: 0;
}
2021-04-09 09:00:34 +00:00
}
XUL -> JS tree megacommit - Just a single huge commit. This has been developed over too long a time, required many tiny changes across too many files and has seen too many iterations to be separated into separate commits. The original branch with all the messy commits will be kept around for posterity https://github.com/zotero/zotero/compare/bb220ad0f2d6bf0eca6df6d225d3d358cb50a27b...adomasven:feature/react-item-tree - Replaces XUL <tree> element across the whole zotero client codebase with a custom supermegafast virtualized-table inspired by react-virtualized yet mimicking old XUL treeview API. The virtualized-table sits on top on a raw-to-the-metal, interpreted-at-runtime JS based windowing solution inspired by react-window. React-based solutions could not be used because they were slow and Zotero UI needs to be responsive and be able to display thousands of rows in a treeview without any slowdowns. - Attempts were made at making this screen-reader friendly, but yet to be tested with something like JAWS - RTL-friendly - Styling and behaviour across all platforms was copied as closely as possible to the original XUL tree - Instead of row-based scroll snapping this has smooth-scrolling. If you're using arrow keys to browse through the tree then it effectively snap-scrolls. Current CSS snap scroll attributes do not seem to work in the way we would require even on up-to-date browsers, yet alone the ESR version of FX that Zotero is on. JS solutions are either terrible for performance or produce inexcusable jitter. - When dragging-and-dropping items the initial drag freezes the UI for a fairly jarring amount of time. Does not seem to be fixable due to the synchronous code that needs to be run in the dragstart handler. Used to be possible to run that code async with the XUL tree. - Item tree column picker no longer has a dedicated button. Just right-click the columns. The column preferences (width, order, etc) are no longer handled by XUL, which required a custom serialization and storage solution that throws warnings in the developer console due to the amount of data being stored. Might cause temporary freezing on HDDs upon column resize/reorder/visibility toggling. - Context menu handling code basically unchanged, but any UI changes that plugins may have wanted to do (including adding new columns) will have to be redone by them. No serious thought has gone into how plugin developers would achieve that yet. - Opens up the possibility for awesome alternative ways to render the tree items, including things like multiple-row view for the item tree, which has been requested for a long while especially by users switching from other referencing software
2020-06-03 07:29:46 +00:00
}
.virtualized-table.multi-select:focus {
.row.focused:not(.selected) {
outline: 1px dotted var(--color-accent);
z-index: 10000;
}
}
XUL -> JS tree megacommit - Just a single huge commit. This has been developed over too long a time, required many tiny changes across too many files and has seen too many iterations to be separated into separate commits. The original branch with all the messy commits will be kept around for posterity https://github.com/zotero/zotero/compare/bb220ad0f2d6bf0eca6df6d225d3d358cb50a27b...adomasven:feature/react-item-tree - Replaces XUL <tree> element across the whole zotero client codebase with a custom supermegafast virtualized-table inspired by react-virtualized yet mimicking old XUL treeview API. The virtualized-table sits on top on a raw-to-the-metal, interpreted-at-runtime JS based windowing solution inspired by react-window. React-based solutions could not be used because they were slow and Zotero UI needs to be responsive and be able to display thousands of rows in a treeview without any slowdowns. - Attempts were made at making this screen-reader friendly, but yet to be tested with something like JAWS - RTL-friendly - Styling and behaviour across all platforms was copied as closely as possible to the original XUL tree - Instead of row-based scroll snapping this has smooth-scrolling. If you're using arrow keys to browse through the tree then it effectively snap-scrolls. Current CSS snap scroll attributes do not seem to work in the way we would require even on up-to-date browsers, yet alone the ESR version of FX that Zotero is on. JS solutions are either terrible for performance or produce inexcusable jitter. - When dragging-and-dropping items the initial drag freezes the UI for a fairly jarring amount of time. Does not seem to be fixable due to the synchronous code that needs to be run in the dragstart handler. Used to be possible to run that code async with the XUL tree. - Item tree column picker no longer has a dedicated button. Just right-click the columns. The column preferences (width, order, etc) are no longer handled by XUL, which required a custom serialization and storage solution that throws warnings in the developer console due to the amount of data being stored. Might cause temporary freezing on HDDs upon column resize/reorder/visibility toggling. - Context menu handling code basically unchanged, but any UI changes that plugins may have wanted to do (including adding new columns) will have to be redone by them. No serious thought has gone into how plugin developers would achieve that yet. - Opens up the possibility for awesome alternative ways to render the tree items, including things like multiple-row view for the item tree, which has been requested for a long while especially by users switching from other referencing software
2020-06-03 07:29:46 +00:00
*[dir=rtl] {
.virtualized-table-header {
.cell .sort-indicator {
2023-11-28 08:29:55 +00:00
left: 3px; // + 5px padding = 8px total
right: initial;
}
.resizer {
right: -5px;
left: initial;
}
2021-04-09 09:00:34 +00:00
}
.row .twisty {
transform: rotate(90deg);
2021-04-09 09:00:34 +00:00
}
XUL -> JS tree megacommit - Just a single huge commit. This has been developed over too long a time, required many tiny changes across too many files and has seen too many iterations to be separated into separate commits. The original branch with all the messy commits will be kept around for posterity https://github.com/zotero/zotero/compare/bb220ad0f2d6bf0eca6df6d225d3d358cb50a27b...adomasven:feature/react-item-tree - Replaces XUL <tree> element across the whole zotero client codebase with a custom supermegafast virtualized-table inspired by react-virtualized yet mimicking old XUL treeview API. The virtualized-table sits on top on a raw-to-the-metal, interpreted-at-runtime JS based windowing solution inspired by react-window. React-based solutions could not be used because they were slow and Zotero UI needs to be responsive and be able to display thousands of rows in a treeview without any slowdowns. - Attempts were made at making this screen-reader friendly, but yet to be tested with something like JAWS - RTL-friendly - Styling and behaviour across all platforms was copied as closely as possible to the original XUL tree - Instead of row-based scroll snapping this has smooth-scrolling. If you're using arrow keys to browse through the tree then it effectively snap-scrolls. Current CSS snap scroll attributes do not seem to work in the way we would require even on up-to-date browsers, yet alone the ESR version of FX that Zotero is on. JS solutions are either terrible for performance or produce inexcusable jitter. - When dragging-and-dropping items the initial drag freezes the UI for a fairly jarring amount of time. Does not seem to be fixable due to the synchronous code that needs to be run in the dragstart handler. Used to be possible to run that code async with the XUL tree. - Item tree column picker no longer has a dedicated button. Just right-click the columns. The column preferences (width, order, etc) are no longer handled by XUL, which required a custom serialization and storage solution that throws warnings in the developer console due to the amount of data being stored. Might cause temporary freezing on HDDs upon column resize/reorder/visibility toggling. - Context menu handling code basically unchanged, but any UI changes that plugins may have wanted to do (including adding new columns) will have to be redone by them. No serious thought has gone into how plugin developers would achieve that yet. - Opens up the possibility for awesome alternative ways to render the tree items, including things like multiple-row view for the item tree, which has been requested for a long while especially by users switching from other referencing software
2020-06-03 07:29:46 +00:00
}
.virtualized-table {
.row .twisty.icon-css {
@include focus-states using ($color) {
@if $color =="white" {
fill: var(--accent-white);
}
@else {
fill: var(--fill-secondary);
}
}
}
}
.drag-image-container {
box-sizing: border-box;
.row .twisty.icon-css {
@include focus-states('.row.selected', '.drag-image-container:focus-within') using ($color) {
fill: var(--fill-secondary);
}
}
}