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

Support for the selection of non-consecutive cells #4708

Closed
budnix opened this issue Jan 9, 2018 · 3 comments
Closed

Support for the selection of non-consecutive cells #4708

budnix opened this issue Jan 9, 2018 · 3 comments

Comments

@budnix
Copy link
Member

budnix commented Jan 9, 2018

Description

This issue is about making support for the selection of non-consecutive cells. The first step to complete this new feature is to build a prototype which works visually without any glitches. The selection shouldn't break any previous functionality.

@AMBudnik
Copy link
Contributor

AMBudnik commented Jan 9, 2018

related #2119

@krzysztofspilka
Copy link
Member

budnix added a commit that referenced this issue Jan 18, 2018
cell selection can work (#4708).

To make this feature work necessary changes were introduced to the selection functionality. The logic responsible for selection was moved into separate files (without breaking change). Now, every file has its own responsibility: for keeping selection coordinates and for keeping properties necessary for visualizing the borders.
budnix added a commit that referenced this issue Jan 25, 2018
 - Fixed all plugins to be compatible with the non-consecutive selection. Plugin which requires more time to be fixed was temporary disabled when that type selection is detected.
 - Added support for iterator protocol to array helpers (arrayReduce, arrayFilter, arrayMap, arrayEach).
 - Added new helpers to checking ctrl meta key codes.
 - Added new utility (keyStateObserver) designed for retrieving keyboard key states (is pressed or not).
 - Added missing documentation to the newly created classes.
budnix added a commit that referenced this issue Feb 9, 2018
 - Add support to the Walkontable Selection for marking intersection
   with CSS class names in continuous manner ('area-1', 'area-2'...)
 - Optimize clearing CSS classes belongs to Selection
 - Add CSS classes to support multiple selections and normalized their
   colors
 - Adjust ContextMenu actions to make them work in multiple selections
 - Add support for enabling/disabling multiple selection via new
   property 'selectionMode' (posible values: 'single', 'contiguous',
'multiple')
 - Remove 'multiSelect' option. Move to "selectionMode:
   'single'/'contiguous'"
 - Fix keyStateObserver which holds key states after window blur
 - Extend '.alter' method for supporting new arguments which allows
   removing rows and columns in batches

Issue: #4708
budnix added a commit that referenced this issue Feb 12, 2018
Renamed `getSelectedRecently` method to `getSelectedLast` and
`getSelectedRecentlyRange` to `getSelectedRangeLast`

Issue: #4708
budnix added a commit that referenced this issue Feb 12, 2018
cell selection can work (#4708).

To make this feature work necessary changes were introduced to the selection functionality. The logic responsible for selection was moved into separate files (without breaking change). Now, every file has its own responsibility: for keeping selection coordinates and for keeping properties necessary for visualizing the borders.
budnix added a commit that referenced this issue Feb 12, 2018
 - Fixed all plugins to be compatible with the non-consecutive selection. Plugin which requires more time to be fixed was temporary disabled when that type selection is detected.
 - Added support for iterator protocol to array helpers (arrayReduce, arrayFilter, arrayMap, arrayEach).
 - Added new helpers to checking ctrl meta key codes.
 - Added new utility (keyStateObserver) designed for retrieving keyboard key states (is pressed or not).
 - Added missing documentation to the newly created classes.
budnix added a commit that referenced this issue Feb 12, 2018
 - Add support to the Walkontable Selection for marking intersection
   with CSS class names in continuous manner ('area-1', 'area-2'...)
 - Optimize clearing CSS classes belongs to Selection
 - Add CSS classes to support multiple selections and normalized their
   colors
 - Adjust ContextMenu actions to make them work in multiple selections
 - Add support for enabling/disabling multiple selection via new
   property 'selectionMode' (posible values: 'single', 'contiguous',
'multiple')
 - Remove 'multiSelect' option. Move to "selectionMode:
   'single'/'contiguous'"
 - Fix keyStateObserver which holds key states after window blur
 - Extend '.alter' method for supporting new arguments which allows
   removing rows and columns in batches

Issue: #4708
budnix added a commit that referenced this issue Feb 12, 2018
Renamed `getSelectedRecently` method to `getSelectedLast` and
`getSelectedRecentlyRange` to `getSelectedRangeLast`

Issue: #4708
budnix added a commit that referenced this issue Feb 13, 2018
budnix added a commit that referenced this issue Feb 13, 2018
 - Move 'beforeSetRangeStart' and 'beforeSetRangeStartOnly' hook before
coordinates are cleared. This restores the previous behavior of this
hook.
 - Add additionally argument ('ranges') check for ContextMenu
   'checkSelectionConsistency' helper.

Issue: #4708
budnix added a commit to handsontable/handsontable-pro that referenced this issue Feb 13, 2018
Change all `hot.getSelected()` calls to `hot.getSelectedLast()` and
`hot.getSelectedRange()` to `hot.getSelectedRangeLast()`.

Related-issue: handsontable/handsontable#4708
@budnix
Copy link
Member Author

budnix commented Feb 13, 2018

New API

  • hot.getSelectedLast() Returns an array with coordinates of the last selected layer ([row, col, rowEnd, colEnd]). This method behaves as hot.getSelected() before the braking change.
  • hot.getSelectedRangeLast() Returns the last coordinates applied to the table as a CellRange object. This method behaves as hot.getSelectedRange() before the braking change.
  • hot.alter('remove_row', [[1, 4], [10, 1]]) Supports removing non-consecutive rows. Instead of passing row index we can pass an array of arrays where the first item is row index where the row will be removed from and at the second index is 'amount', count of rows to be removed;
  • hot.alter('remove_col', [[1, 4], [10, 1]]) Same as above but for columns. Only removing actions support that new feature.

Breaking Changes:

  • hot.getSelected() Returns an array of arrays with coordinates of the all layers ([[row, col, rowEnd, colEnd], [row, col, rowEnd, colEnd] ...]);
  • hot.getSelectedRange() Returns an array of CellRange objects with coordinates of the all layers ([{CellRange}, {CellRange} ...]);
  • Previously hot.selection.empty(), now hot.emptySelectedCells();
  • Changed selection colors:
    • area borders, was #89aff9 -> has #4b89ff
    • area background, was #b5d1ff -> has #005eff
    • current selection border, was #5292f7 -> has #4b89ff
  • Removed multiSelect setting replaced with selectionMode: 'single';
  • Added new option selectionMode which can be set as 'single' (previously as multiSelect: false), 'range' (previously as multiSelect: true) and 'multiple' (new non-consecutive mode);

Compatible Changes:

  • afterSelection
    • previously: afterSelection(row, column, rowEnd, columnEnd, preventScrolling)
    • now: afterSelection(row, column, rowEnd, columnEnd, preventScrolling, selectionLayerLevel)
  • afterSelectionByProp
    • previously: afterSelectionByProp(row, prop, rowEnd, propEnd, preventScrolling)
    • now: afterSelectionByProp(row, prop, rowEnd, propEnd, preventScrolling, selectionLayerLevel)
  • afterSelectionEnd
    • previously: afterSelectionEnd(row, column, rowEnd, columnEnd)
    • now: afterSelectionEnd(row, column, rowEnd, columnEnd, selectionLayerLevel)
  • afterSelectionEndByProp
    • previously: afterSelectionEndByProp(row, prop, rowEnd, propEnd)
    • now: afterSelectionEndByProp(row, prop, rowEnd, propEnd, selectionLayerLevel)

For all listed hooks the new selectionLayerLevel argument was added. The selectionLayerLevel is a number which indicates what selection layer is currently modified. For the first selection, this value is 0, while the new layers are added this number increases.

budnix added a commit that referenced this issue Feb 13, 2018
After thinking about what necessary values are important to have in
selection hooks I came to conclusion to revert arguments structure
passed to the hooks. Now, the arguments types are the same as before the
breaking change. As a compatible change, this commit adds new argument
which is 'selectionLayerLevel' which indicates what selection layer is
currently modified.

Issue: #4708
budnix added a commit that referenced this issue Feb 14, 2018
 - Add unit and e2e tests about changes introduced in previous commits
 - Fix and update TS types
 - Remove editor instance from public API (it was added by accident)

Issue: #4708
budnix added a commit that referenced this issue Feb 15, 2018
To make documentation generate properly @Util tag was added to the newly
created classes.

Issue: #4708
budnix added a commit that referenced this issue Feb 15, 2018
Replace unary increments/decrements to num += 1 and num -= 1 and add
missing new lines for better code readability.

Issue: #4708
budnix added a commit that referenced this issue Feb 15, 2018
Feature non-consecutive selection

To make this feature work necessary changes were introduced to the selection functionality. The logic responsible for selection was moved into separate files (without breaking change). Now, every file has its own responsibility: for keeping selection coordinates and for keeping properties necessary for visualizing the borders.

Additionally, added changes:
 - Fix all plugins to be compatible with the non-consecutive selection. Plugin which requires more time to be fixed was temporary disabled when that type selection is detected.
 - Add support for iterator protocol to array helpers (arrayReduce, arrayFilter, arrayMap, arrayEach).
 - Add new helpers to checking ctrl meta key codes.
 - Add new utility (keyStateObserver) designed for retrieving keyboard key states (is pressed or not).
 - Add missing documentation to the newly created classes.
 - Add support to the Walkontable Selection for marking intersection
   with CSS class names in continuous manner ('area-1', 'area-2'...)
 - Optimize clearing CSS classes belongs to Selection
 - Add CSS classes to support multiple selections and normalized their
   colors
 - Adjust ContextMenu actions to make them work in multiple selections
 - Add support for enabling/disabling multiple selections via new
   property 'selectionMode' (posible values: 'single', 'range',
'multiple')
 - Remove 'multiSelect' option. Move to "selectionMode:
   'single'/'range'"
 - Extend '.alter' method for supporting new arguments which allows
   removing rows and columns in batches
 - Fix ObserveChanges plugin which calls 'afterChange' hook with first
an argument as an array where should be composed as an array of array
 - Add unit and e2e tests
 - Fix and update TS types

Issue: #4708
budnix added a commit to handsontable/handsontable-pro that referenced this issue Feb 15, 2018
Feature non-consecutive selection

Change all `hot.getSelected()` calls to `hot.getSelectedLast()` and
`hot.getSelectedRange()` to `hot.getSelectedRangeLast()`.

Related-issue: handsontable/handsontable#4708
@budnix budnix added this to the Next release milestone Feb 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants