-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[Table] Better column reordering #1462
Conversation
Try againPreview: documentation | landing | table |
Interactions feel great!
I didn't notice how unintutive it was earlier. It is certainly better now. Nice work 👍 Since the table now only moves one of the columns in a disjoint selection and disregards the others, is it possible to make it so that only that one columns (the one where you started the drag) is highlighted after you start a drag? At this point: If that's too much trouble then don't worry about it for now. |
packages/table/src/common/classes.ts
Outdated
@@ -17,10 +17,12 @@ export const TABLE_CELL_LEDGER_EVEN = "bp-table-cell-ledger-even"; | |||
export const TABLE_CELL_LEDGER_ODD = "bp-table-cell-ledger-odd"; | |||
export const TABLE_COLUMN_HEADER_TR = "bp-table-column-header-tr"; | |||
export const TABLE_COLUMN_HEADERS = "bp-table-column-headers"; | |||
export const TABLE_COLUMN_HEADER_CELL = "bp-table-column-header-cell"; | |||
export const TABLE_COLUMN_HEADER_CELL_HAS_REORDER_HANDLE = "bp-table-column-header-cell-has-reorder-handle"; |
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.
yikes this is pretty long. I would be cool with simply bp-table-has-reorder-handle
and bp-table-has-interaction-bar
Shorter CSS classesPreview: documentation | landing | table |
…at will be reordered" This reverts commit bdcc845. Actually, this leads to some buggy behavior with overlapping regions. Will consider this again later.
Revert "[Experimental] On handle mousedown, select only the region that will be reordered"Preview: documentation | landing | table |
8540bdc
to
f7509ac
Compare
Square off icon marginPreview: documentation | landing | table |
} | ||
|
||
// keep the editable cell input flush with the cell's left border | ||
.bp-table-column-name .bp-table-editable-name.pt-editable-text::before { |
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.
this is both long and deeply nested 😨
must it be this way?
@@ -143,22 +143,18 @@ describe("<ColumnHeaderCell>", () => { | |||
}); | |||
|
|||
describe("Reorder handle", () => { | |||
const REORDER_HANDLE_CLASS = "reorder-handle"; | |||
const REORDER_HANDLE_CLASS = "bp-table-reorder-handle-target"; |
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.
prefer not using bp-table-
prefix for test-only class. be obvious that this is not a real Table
class, just a hook used for these tests. i was wondering if it belongs in Classes
, then I found its usage in mount()
below.
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.
It's not a test-only class.
...I should use Classes.TABLE_REORDER_HANDLE_TARGET
.
packages/table/test/tableTests.tsx
Outdated
let onSelection: Sinon.SinonSpy; | ||
const onColumnsReordered: Sinon.SinonSpy = sinon.spy(); | ||
const onRowsReordered: Sinon.SinonSpy = sinon.spy(); | ||
const onSelection: Sinon.SinonSpy = sinon.spy(); |
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.
prob don't need : Sinon.SinonSpy
anymore
packages/table/test/tableTests.tsx
Outdated
}); | ||
|
||
it("Doesn't work on rows if there is no selected region defined yet", () => { | ||
const table = mountTable({ | ||
isColumnReorderable: true, | ||
onColumnsReordered, | ||
}); | ||
getTableHeader(getColumnHeadersWrapper(table), 0) | ||
const headerCell = getHeaderCell(getColumnHeadersWrapper(table), 0); | ||
headerCell |
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? this variable doesn't help
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.
Sure
…rint into cl/table-reorder-handle-2
Merge branch 'cl/table-reorder-handle-2' of github.com:palantir/blueprint into cl/table-reorder-handle-2Preview: documentation | landing | table |
Cleaner test setup now that handle is widerPreview: documentation | landing | table |
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.
wow this feels good in the preview!
love removing the cell
param from all those methods!
Read through the docs changes with @tgreenwatts. Ready to merge this as soon as the build finishes. 👍 |
Fix reordering docsPreview: documentation | landing | table |
Fixes #1242, Fixes #1284, Fixes #1273, Fixes #1189
Checklist
Changes proposed in this pull request:
Improvements to column reordering:
Reviewers should focus on:
Do you like the visual design of the reorder handle? And the interactions?
Screenshot
Reordering a column with selection disabled:
Reordering a selected column:
Reordering a multi-column selection:
And of course, all of this works when the interaction bar is visible too: