-
Notifications
You must be signed in to change notification settings - Fork 494
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
BOM Column hiding and reordering #239
Conversation
I will not merge this as is because the scope is too narrow. There is a related wishlist item to make all hardcoded columns configurable and reorderable. See also discussion in #167. If you'd like to work with me on this here is the direction I can suggest: |
I dont think that reordering inside a pop-up menu makes for a good user experience. Why not have a drag and drop reordering on the column header and use the pop up purely for visibility checkboxes? Should reordering of the checkbox columns then also change the order of the "Bom checkboxes" option in the preferences pop-up? |
Agreed, that's even better.
Either treat them as a single block and rely on ordering in preferences pop-up or if they will be movable individually then list in preferences should be updated accordingly. |
Some notes on implementation:
|
Agreed. I'll refactor the code and mark this as WIP. |
Columns can now be reordered with drag'n'drop on the column headers. Checkboxes and extra fields are treated as a single column.
When the visible columns are reordered, the hidden ones are automatically pushed to the right in the settings. |
I played around with it a bit and it works but there are some issues with dark theme and column placement detection logic. I have to drag waaay to the left for it to work. https://i.imgur.com/6eQxwNM.gif Also I'd like to see following changed:
For the icon use this
And best place for it is in top left corner of the bom table in the unused cell of the header. |
Dragging should work now. If all hardcoded columns are at some point treated as optional there has to be a standard way of naming them. How should that look? Lowercasing the header name? I don't like the idea of elements in a menu changing their order when columns in a table get reordered, even though they are functionally linked. It seems counterintuitive to me. Pushing all hidden columns to the right was the easiest way of implementing it. I didn't put too much thought into it since I don't suspect users to reorder columns very often. |
Use header name as is.
Why? It's more counterintuitive to me that if I move last column to be first it's still last in visibility menu. If you have a bunch of columns with extra fields navigating the list will be much easier if it corresponds to order in the table. One more thing I noticed: search field still matches hidden columns. Ref lookup field should probably be disabled when references column is hidden. |
To clarify the standard column naming; they will be still hardcoded but in python part, not in html. This is just my description of future plans, I don't expect this work to be done in this MR. |
The visibility menu button has now moved to the free space in the table header and is dynamically built from the fields in the order they appear in the table. Reflookup is disabled and cleared on hiding the references column. The filter now ignores hidden columns. |
Works pretty well. Aside from cosmetic stuff I mentioned inline only 2 things left to address:
|
Extra fields are now treated as normal columns. Also, the order of hidden columns is now preserved. The code should also work once all columns are generalized. The |
Please address inline comments I made earlier and remove WIP when this is ready for final review. |
Which comments are you referring to? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, looks like I didn't submit them, sorry.
InteractiveHtmlBom/web/ibom.css
Outdated
@@ -241,7 +241,7 @@ canvas:active { | |||
} | |||
|
|||
.bom .numCol { | |||
width: 25px; | |||
width: 46px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too wide. No need to enlarge icon, this should be 30px tops.
InteractiveHtmlBom/web/ibom.css
Outdated
@@ -392,7 +392,7 @@ canvas:active { | |||
} | |||
|
|||
.filter { | |||
width: calc(60% - 64px); | |||
width: calc(60% - 110px); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert since the menu is not in filter row anymore
InteractiveHtmlBom/web/ibom.css
Outdated
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath fill='none' stroke='%23333' d='M2.5 4.5h5v15h-5zM9.5 4.5h5v15h-5zM16.5 4.5h5v15h-5z'/%3E%3C/svg%3E"); | ||
background-position: center; | ||
background-repeat: no-repeat; | ||
background-size: 30px 30px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why enlarge the icon? Keep it original size, I pixel aligned the svg for crispyness.
Also override size from button class, it's too large.
InteractiveHtmlBom/web/ibom.css
Outdated
@@ -445,6 +445,24 @@ mark.highlight { | |||
background-repeat: no-repeat; | |||
} | |||
|
|||
.visbtn { | |||
background-color: transparent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesnt work with dark theme, I dont think it's needed.
|
||
vismenu.appendChild(visbutton); | ||
if (settings.bommode != "netlist") | ||
vismenu.appendChild(viscontent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is netlist mode, hide the icon itself too
InteractiveHtmlBom/web/util.js
Outdated
showFootprints(settings.show_footprints); | ||
document.getElementById("showFootprintsCheckbox").checked = settings.show_footprints; | ||
setShowQuantities(settings.show_quantities); | ||
document.getElementById("showQuantittiesCheckbox").checked = settings.show_quantities; | ||
setShowCheckboxfields(settings.show_checkboxfields); | ||
document.getElementById("showCheckboxfieldsCheckbox").checked = settings.show_checkboxfields; | ||
setShowCheckboxfields(settings.show_references); | ||
document.getElementById("showReferencesCheckbox").checked = settings.show_references; | ||
setShowValues(settings.show_values); | ||
document.getElementById("showValuesCheckbox").checked = settings.show_values; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of date
InteractiveHtmlBom/web/util.js
Outdated
@@ -441,6 +451,7 @@ var settings = { | |||
darkMode: false, | |||
highlightpin1: false, | |||
redrawOnDrag: true, | |||
show_footprints: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out of date
This should address all comments. I could not find a nicer way around overwriting the font-family in |
There are some minor css and formatting issues but I'll take care of it a bit later. Thanks for your contribution, this is a pretty neat feature! |
For some projects, having the Footprint column is not needed and just wastes space. Thus, this patch proposes an option that allows to show/hide the footprints column.
Especially on smaller screens the table gets hard to read if you want to get a bigger view of the PCB.
However, with the Footprint column removed, it looks much nicer. The table cells also take up less space which makes it possible to view more components without scrolling.