-
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
Controllable selection #253
Conversation
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.
Take a look at the preview example "Row Transformed Controlled Selection" |
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.
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; |
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.
nit: newselectedRegions => newSelectedRegions
// clicking adds transformed selection | ||
table.find(CELL_SELECTOR).mouse("mousedown").mouse("mouseup"); | ||
|
||
expect(onSelection.called).to.equal(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.
nit: I tend to prefer expect(onSelection.called).to.be.true
syntax for boolean checks, because it reads a little more like plain English.
Yep, I agree with your nits @cmslewis, so i'll merge once this builds |
When will this feature become available? We can't wait... :) |
we should be able to make a release including this feature today. |
* 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
PR checklist
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.