Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support multi-selection in file lists (#1136)
* enable multiple selection with control-click without functionality * Implemented multiple file selection with control-click * Remove handling this.state.selectedFiles is null in FileList selectFile method * Enable toggle select/deselect files with control-click * Implement Shift-Click file selection Shift-click behaviour is not ideal. Failed to simulate shift-click behaviour on Google Drive. Issues: 1. Can't deselect when shift click direction changes Other issues: 1. IStatusFile object equality checking leads to a lot of duplicate codes 2. File status changes is not immediately reflected in FileList state, leading to invalid commands in context menu * extract file comparison logic and remove duplicate selected files due to shift click * limit multiple file selection by control-click to within the same category (git status) * rename replaceSelectedFile to selectOnlyOneFile for better comprehension * shift-click on a file with a different category (git status) becomes a simple click, handle partially staged files for shift clicks * Make FileItem action commands (open, diff and stage file) apply to selected files * Make FileItem action commands (open, diff and unstage file) apply to selected files * Make FileItem action commands (discarding changes and staging file) apply to selected files * fix bug - open correct files on clicking action button * fix bug - diff correct files on clicking action button * fix bug - unstage correct files on clicking action button * fix bug - stage correct files on clicking action button * fix bug - discard changes on correct files on clicking action button * fix FileItem test * Rename function filesAreEqual to areFilesEqual Use _isSelectedFile where appropriate * Remove selectedFileStatus from state * change _openDiffViews function to async and await the execute command * Remove unnecessary code in openContextMenu * Ensure selectFiles arrives at correct state * implement single selection callback 'setSelection' * rework _selectUntilFile to index in sub array * fix FileItem test * implement advanced shift-click behaviours * Added label to wrap around div object to allow click on whole div element to control checkbox * Fixed label placement issue * Styled filename div * Fixed styling issue by importing and applying fileLabelStyle to the appropriate label container * tried implementing shiftclick but unsuccessful: * Fixed issue with shift click when clicking in reverse order * Implement markedFile getter in gitModel * implement shift click problem: the clicked file is not selected * Fix bug for shift-click for simple staging * Clean up * remove console logs * insert in FileItemStyle.ts * added simple ui tests for ctlr and shift click on file selection for normal staging * Add skeleton code for implementing de/select all button for simple staging * Fix original ui tests * Changed file name in ui-tests README and have the select all in simple staging selecting all files * Changed name of variables and function from markAllFile to toggleAllFiles for clarity * Added the ability to deselect items using select all * Simplified code in toggleAllFiles to use state and removed redundant code. * Improve mark-all button behaviour - sync checked state of the box to reflect if all files are marked * Fix ui tests * Add ui tests for simple staging * Clear all signal connections when unmounting FileList Co-authored-by: Frédéric Collonval <[email protected]> * Delete commented code in GitPanel Co-authored-by: Frédéric Collonval <[email protected]> * Delete unused prop from interface (GitStage) Co-authored-by: Frédéric Collonval <[email protected]> * Improve consistency and fix bug * fix ui test readme * Change control-click ui test to expect exactly 2 selected items * Stop propagation when users click on action buttons on FileItem * Add doc strings for functions * Document helper functions Co-authored-by: iflinda <[email protected]> Co-authored-by: Frédéric Collonval <[email protected]>
- Loading branch information