informatics-isi-edu / deriva-webapps

Deriva-based web applications
Apache License 2.0
2 stars 1 forks source link

Matrix treeview #170

Closed JunmengXu closed 8 months ago

JunmengXu commented 11 months ago

Complete the development of treeview component, support users to switch the x and y axis of the tree component and flat component independently in the configuration file, the style of the tree component will change dynamically with the configuration file.

The changes are mainly done by creating different React components, and modifying a small amount of code in the original tsx file.

JunmengXu commented 11 months ago

Absolutely, I will address the lint errors and also ensure that I adhere to the missing elements mentioned in the developer documentation. Thank you!

JunmengXu commented 11 months ago

This PR accomplishes adding support for displaying hierarchical data to the vertical and horizontal headers of the matrix app, in other words, displaying the treeview.

This pull request introduces the following changes:

Known Issues:

React Hook useEffect in column-tree-headers and row-tree-headers with expanded and searchedColIDs has missing dependency, but adding all of the dependencies results in unnecessary extra refreshes. This may need more suggestions.

Thank you for your review and valuable feedback. I hope this summary helps in understanding the changes made in the PR and assists with its review. If there are any specific areas you'd like me to provide more details on, please let me know, and I'll be happy to do so.

RFSH commented 10 months ago

We had a conversation about the changes and the following are the changes that we should focus on:

Performance

We still need to work more on performance. I suggest installing react-dev-tools chrome extension. It will allow you to see when components are getting rerendered. You can see that, as we assumed, we're rerendering both trees on each hover change. Before trying to change the implementation to avoid that, we can do other smaller performance improvements:

Highlight alignment issue

For the highlight alignment issue, we're adding empty cells and headers in the current implementation. But Mui is ignoring the empty tree elements.

So you have to add an element after trees manually. For row headers, you can just add <div style={{height: cellHeight + 15}}></div>, and that should solve the alignment. Solving the column headers should be similar but would require more thinking because of the transform that you've done.

Scroll behavior

In the current implementation, it doesn't matter if users scroll the headers or cells; the behavior is the same. That's why we're hiding the header scrollbars. But in this PR, we want users to be able to scroll the headers so the labels are visible. That's why we cannot just hide scrollbars. For column headers, we should show the vertical scrollbar. And for rows, we should show the horizontal scrollbar.

Using CSS we cannot specifically hide the horizontal scrollbar and show the vertical. So instead, we should just hide the scrolls with CSS all the time. And then, add a dummy element that has the scrollbar. We've done something similar in chaise apps. You can see how here we've added an element on top of the table. And then this function will make sure scrolling works.

Also, scrolling the header on Firefox and Safari is laggy. So you should take a look and see what's causing it.

JunmengXu commented 10 months ago

The latest commit has effectively addressed the following issues:

UI Enhancements

Performance Optimization

Bug Fix

JunmengXu commented 10 months ago

The latest commit made the following changes about Scroll behavior:

Known Issues: The current scrollbar applies to treeview components, while for flat components, the dummy scrollbar will still be displayed but has no real functionality as the scroll function has not yet been set. This problem will be solved during the refactoring process.

JunmengXu commented 9 months ago

The latest commit made the following changes about refactor:

JunmengXu commented 9 months ago

The latest commit focus on the following issues:

Code style changes

Scrollbar functionality

Known issues

JunmengXu commented 8 months ago

The latest two commits focus on the following issues:

Scrollbar functionality

Known issues

JunmengXu commented 8 months ago

The latest commit focuses on the following issues:

Scrollbar functionality

Refactor tree headers

Future

JunmengXu commented 8 months ago

The latest commit focuses on the following issues:

Grid button

Modified grid-button.tsx, pass and use columnHeaderHeight for the height of GridLeftButton and GridRightButton, which is similar to how the GridUpButton and GridDownButton's width is rowHeaderWidth. This will make sure the icon is vertically aligned in the middle.

Column tree headers

During the test, found an edge case UI issue. This only happened when we set the column header's scrollable max height as auto, the column is a tree header, and the column header height is longer than the height of the inner div grid-column-headers. This results in the inner div dom appearing in the middle of the whole column header area, which means it is not close to the grid but leaves a big blank area between the two. To address it: Modified column-tree-headers.tsx, pass the height of the div element grid-column-headers to the shared component. Modified shared-column-headers.tsx, got the parameter, and used it to calculate the 'bottom' position style for div element grid-column-headers-horizontal-scroll