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

Controllable selection #253

Merged
merged 2 commits into from
Nov 29, 2016
Merged

Controllable selection #253

merged 2 commits into from
Nov 29, 2016

Conversation

themadcreator
Copy link
Contributor

@themadcreator themadcreator commented Nov 28, 2016

PR checklist

  • New Feature
  • Includes tests

Related: #191

What changes did you make?

Adds "selectedRegions" prop to Table to allow to user to take over
control of selection. If defined, the user will be responsible for
updating the selection and should probable add a "onSelection"
callback.

Adds "selectedRegionTransform" prop to table to allow users to
transform the selection region. This allows users to, for example,
select a whole row when the user clicks on a single cell. Using
a transform is advantageous because we can still handle interaction
semantics like multiselect, meta-click, and click-to-deselect.

Adds "selectedRegions" prop to Table to allow to user to take over
control of selection. If defined, the user will be responsible for
updating the selection and should probable add a "onSelection"
callback.

Adds "selectedRegionTransform" prop to table to allow users to
transform the selection region. This allows users to, for example,
select a whole row when the user clicks on a single cell. Using
a transform is advantageous because we can still handle interaction
semantics like multiselect, meta-click, and click-to-deselect.
@themadcreator
Copy link
Contributor Author

Take a look at the preview example "Row Transformed Controlled Selection"

Copy link
Contributor

@cmslewis cmslewis left a comment

Choose a reason for hiding this comment

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

approving with nits

@@ -286,12 +320,15 @@ export class Table extends AbstractComponent<ITableProps, ITableState> {
newRowHeights = Utils.arrayOfLength(newRowHeights, numRows, defaultRowHeight);
newRowHeights = Utils.assignSparseValues(newRowHeights, rowHeights);

const newselectedRegions = (selectedRegions == null) ? this.state.selectedRegions : selectedRegions;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: newselectedRegions => newSelectedRegions

// clicking adds transformed selection
table.find(CELL_SELECTOR).mouse("mousedown").mouse("mouseup");

expect(onSelection.called).to.equal(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I tend to prefer expect(onSelection.called).to.be.true syntax for boolean checks, because it reads a little more like plain English.

@themadcreator
Copy link
Contributor Author

Yep, I agree with your nits @cmslewis, so i'll merge once this builds

@blueprint-bot
Copy link

PR Comments

Preview: docs | table Coverage: core | datetime

@themadcreator themadcreator merged commit 5139542 into master Nov 29, 2016
@themadcreator themadcreator deleted the bd/table-row-only-selection branch November 29, 2016 00:39
@forman
Copy link

forman commented Dec 2, 2016

When will this feature become available? We can't wait... :)

@adidahiya
Copy link
Contributor

we should be able to make a release including this feature today.

@adidahiya adidahiya added this to the 1.2.0 milestone Dec 7, 2016
greglo pushed a commit to greglo/blueprint that referenced this pull request Dec 12, 2016
* Controllable selection

Adds "selectedRegions" prop to Table to allow to user to take over
control of selection. If defined, the user will be responsible for
updating the selection and should probable add a "onSelection"
callback.

Adds "selectedRegionTransform" prop to table to allow users to
transform the selection region. This allows users to, for example,
select a whole row when the user clicks on a single cell. Using
a transform is advantageous because we can still handle interaction
semantics like multiselect, meta-click, and click-to-deselect.

* PR Comments
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants