Skip to content
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

Merged
merged 19 commits into from
Aug 23, 2017
Merged

[Table] Better column reordering #1462

merged 19 commits into from
Aug 23, 2017

Conversation

cmslewis
Copy link
Contributor

@cmslewis cmslewis commented Aug 17, 2017

Fixes #1242, Fixes #1284, Fixes #1273, Fixes #1189

Checklist

  • Include tests
  • Update documentation

Changes proposed in this pull request:

Improvements to column reordering:

  • Reorderable columns now always have a reorder handle, even if the interaction bar is disabled.
  • Columns can now be reordered even when selection is disabled.
  • Reordering disjoint selections is now much more intuitive.

Reviewers should focus on:

Do you like the visual design of the reorder handle? And the interactions?

Screenshot

Reordering a column with selection disabled:
2017-08-17 09 26 24

Reordering a selected column:
2017-08-17 09 28 24

Reordering a multi-column selection:
2017-08-17 09 29 16

And of course, all of this works when the interaction bar is visible too:
2017-08-17 09 30 22

@blueprint-bot
Copy link

Try again

Preview: documentation | landing | table
Coverage: core | datetime

@adidahiya
Copy link
Contributor

Interactions feel great!

Reordering disjoint selections is now much more intuitive.

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:

image

If that's too much trouble then don't worry about it for now.

@@ -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";
Copy link
Contributor

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

@blueprint-bot
Copy link

Shorter CSS classes

Preview: documentation | landing | table
Coverage: core | datetime

…at will be reordered"

This reverts commit bdcc845.

Actually, this leads to some buggy behavior with overlapping regions.
Will consider this again later.
@blueprint-bot
Copy link

Revert "[Experimental] On handle mousedown, select only the region that will be reordered"

Preview: documentation | landing | table
Coverage: core | datetime

@blueprint-bot
Copy link

Square off icon margin

Preview: documentation | landing | table
Coverage: core | datetime

}

// keep the editable cell input flush with the cell's left border
.bp-table-column-name .bp-table-editable-name.pt-editable-text::before {
Copy link
Contributor

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";
Copy link
Contributor

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.

Copy link
Contributor Author

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.

let onSelection: Sinon.SinonSpy;
const onColumnsReordered: Sinon.SinonSpy = sinon.spy();
const onRowsReordered: Sinon.SinonSpy = sinon.spy();
const onSelection: Sinon.SinonSpy = sinon.spy();
Copy link
Contributor

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

});

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
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

@blueprint-bot
Copy link

Merge branch 'cl/table-reorder-handle-2' of github.com:palantir/blueprint into cl/table-reorder-handle-2

Preview: documentation | landing | table
Coverage: core | datetime

@blueprint-bot
Copy link

Cleaner test setup now that handle is wider

Preview: documentation | landing | table
Coverage: core | datetime

Copy link
Contributor

@giladgray giladgray left a 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!

@cmslewis
Copy link
Contributor Author

Read through the docs changes with @tgreenwatts. Ready to merge this as soon as the build finishes. 👍

@blueprint-bot
Copy link

Fix reordering docs

Preview: documentation | landing | table
Coverage: core | datetime

@cmslewis cmslewis merged commit f853b4d into master Aug 23, 2017
@cmslewis cmslewis deleted the cl/table-reorder-handle-2 branch August 23, 2017 20:26
@cmslewis cmslewis mentioned this pull request Aug 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants