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

Refactoring filter cell navigation so that it is handled in the navigation service. Handling special scenarios for hierarchical grid in the hierarchical navigation service. #4267

Merged
merged 22 commits into from Apr 1, 2019

Conversation

MayaKirova
Copy link
Contributor

@MayaKirova MayaKirova commented Mar 11, 2019

Closes #4217
Closes #4277

Additional information (check all that apply):

  • Bug fix
  • New functionality
  • Documentation
  • Demos
  • CI/CD

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code
  • This PR includes API docs for newly added methods/properties
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes
  • This PR includes behavioral changes and the feature specification has been updated with them

MKirova added 2 commits March 8, 2019 18:32
…is handled in the navigation service. Hanling special scenarios for hierarchical grid in the hierarchical navigation service.
…ilter cells in performTab since navigation should consider them only for Tab navigation (should skip them with arrow keys). Adding test.
}
}

public navigatePrevFilterCell(column: IgxColumnComponent, eventArgs) {
const cols = this.grid.filteringService.unpinnedFilterableColumns;
const prevFilterableIndex = this.grid.filteringService.unpinnedFilterableColumns.indexOf(column) - 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use the 'cols' variable you defined above instead of 'this.grid.filteringService.unpinnedFilterableColumns'


if (prevIndex >= 0 && visibleIndex > 0 && !this.isColumnLeftFullyVisible(prevIndex) && !column.pinned) {
eventArgs.preventDefault();
this.grid.filteringService.scrollToFilterCell(this.grid.filteringService.unpinnedFilterableColumns[prevIndex], false);
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use the 'cols' variable here as well

return;
}

if (nextIndex >= this.grid.filteringService.unpinnedFilterableColumns.length) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use the 'cols' variable here.

eventArgs.preventDefault();
} else if (!column.pinned && !this.isColumnFullyVisible(nextIndex)) {
eventArgs.preventDefault();
this.grid.filteringService.scrollToFilterCell(this.grid.filteringService.unpinnedFilterableColumns[nextIndex], true);
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use the 'cols' variable here.

@@ -1,6 +1,7 @@
import { IgxGridNavigationService } from '../grid-navigation.service';
import { IgxHierarchicalGridComponent } from './hierarchical-grid.component';
import { first } from 'rxjs/operators';
import { IgxColumnComponent, FilterMode } from '../grid';
Copy link
Member

Choose a reason for hiding this comment

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

Wrong import! Either import them from the respective files or explicitly import from the barrel file


private getLastPinnedFilterableColumn(): IgxColumnComponent {
const pinnedFilterableColums =
this.grid.pinnedColumns.filter(col => !(col instanceof IgxColumnGroupComponent) && col.filterable);
Copy link
Member

Choose a reason for hiding this comment

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

Columns and column groups have a getter for this check: get columnGroup(): Boolean

}

private getFirstPinnedFilterableColumn(): IgxColumnComponent {
return this.grid.pinnedColumns.filter(col => !(col instanceof IgxColumnGroupComponent) && col.filterable)[0];
Copy link
Member

Choose a reason for hiding this comment

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

As above

const isNextChild = nextIndex <= virt.igxForOf.length - 1 &&
this.grid.isChildGridRecord(virt.igxForOf[nextIndex]);
if (!this.grid.rowList.find(row => row.index === rowIndex + 1) && this.grid.parent &&
this.grid.unpinnedColumns[this.grid.unpinnedColumns.length - 1].visibleIndex === visibleColumnIndex) {
Copy link
Member

Choose a reason for hiding this comment

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

Is that not the same check as line 231?

public navigateNextFilterCell(column: IgxColumnComponent, eventArgs) {
const cols = this.grid.filteringService.unpinnedFilterableColumns;
const nextIndex = cols.indexOf(column) + 1;
if (column === this.getLastPinnedFilterableColumn() &&
Copy link
Member

Choose a reason for hiding this comment

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

Please format this code

public navigatePrevFilterCell(column: IgxColumnComponent, eventArgs) {
const cols = this.grid.filteringService.unpinnedFilterableColumns;
const prevFilterableIndex = cols.indexOf(column) - 1;
const prevIndex = cols[prevFilterableIndex].visibleIndex;
Copy link
Member

@skrustev skrustev Mar 13, 2019

Choose a reason for hiding this comment

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

The prevFilterableIndex can become -1 if the index of the column is 0 which will result in error getting visibleIndex straight without a check.


if (prevIndex >= 0 && visibleIndex > 0 && !this.isColumnLeftFullyVisible(prevIndex) && !column.pinned) {
eventArgs.preventDefault();
this.grid.filteringService.scrollToFilterCell(cols[prevIndex], false);
Copy link
Member

@skrustev skrustev Mar 13, 2019

Choose a reason for hiding this comment

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

If visible index is used for the prevIndex, for the unpinned filterable columns collection the index of the column may be different that the visible index.

this.goToFirstCell();
}
eventArgs.preventDefault();
} else if (!column.pinned && !this.isColumnFullyVisible(nextIndex)) {
Copy link
Member

@skrustev skrustev Mar 13, 2019

Choose a reason for hiding this comment

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

isColumnFullyVisible() takes visible index for a column here as well.

public navigateNextFilterCell(column: IgxColumnComponent, eventArgs) {
const cols = this.grid.filteringService.unpinnedFilterableColumns;
const nextIndex = cols.indexOf(column) + 1;
if (column === this.getLastPinnedFilterableColumn() && !this.isColumnFullyVisible(nextIndex)) {
Copy link
Member

Choose a reason for hiding this comment

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

isColumnFullyVisible() takes visible index for a column

if (this.isColumnFullyVisible(columns.length - 1)) {
this.grid.filteringService.focusFilterCellChip(columns[columns.length - 1], false);
const targetIndex = toStart ? 0 : columns.length - 1;
const isVisible = toStart ? this.isColumnLeftFullyVisible(targetIndex) : this.isColumnFullyVisible(targetIndex);
Copy link
Member

Choose a reason for hiding this comment

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

isColumnFullyVisible() takes visible index and index from the unpinnedFilterableColumns collection wouldn't work in some scenarios.

MKirova added 2 commits March 14, 2019 14:32
…ng sure isColumnFullyVisible uses visibleIndex, while scrollToFilterCell uses index from the unpinnedFilterableColumns collection.
skrustev
skrustev previously approved these changes Mar 26, 2019
@PavlovVasil PavlovVasil added 💥 status: in-test PRs currently being tested and removed ❌ status: awaiting-test PRs awaiting manual verification labels Mar 26, 2019
@PavlovVasil
Copy link
Contributor

@MayaKirova @mpavlinov
I don't know if these should be logged as separate issues, or fixed with this PR:

I noticed that the Ctrl + Right Arrow is not working in an expanded child grid - it gets scrolled down and the selected cell get out of viewport:

  1. Open http://localhost:4200/hierarchicalGrid
  2. expand the first row - ID 0
  3. Click the first cell in the child grid - ID 00
  4. Press Ctrl + Right Arrow

A few more:

Run the igniteui-angular-samples and open:
http://localhost:4201/samples/hierarchical-grid/hierarchical-grid-filtering

  1. When the child grid gets expanded and has Filtering enabled, when Tab is used to navigate through its filtering chips, the two red vertical lines on the right do not appear, until the first child cell gets reached - refer to the screenshot below. Either the vertical lines should appear when the first filtering chip in the child grid gets selected, or they should disappear if the user uses Shift + Tab from the first child cell and selects the last filtering chip (meaning chips would not trigger the vertical lines)?

Sketch

  1. When the expanded child grid has no data, using Tab scrolls the parent grid and the child is not visible: open the same Filtering sample: http://localhost:4201/samples/hierarchical-grid/hierarchical-grid-filtering . Expand the second to last record - Alicia Stanger and scroll down so that the child grid is into view. Then select the "Alicia Stanger" cell in the parent grid and press Tab several times - it should select the Filtering chips in the first row island. Once you get to the second one (with no data), the parent grid gets scrolled up and the child is out of view - see the attached gif:

FilteringKeyboardNav

@PavlovVasil PavlovVasil added 🛠️ status: in-development Issues and PRs with active development on them and removed 💥 status: in-test PRs currently being tested labels Mar 27, 2019
@MayaKirova
Copy link
Contributor Author

@PavlovVasil Are issues 1) and 3) related to this particular PR or are they also reproducible in branch 7.2.x?
Regarding 2) Since the filter cells are not selectable it is not expected for the red lines to appear as their purpose is to show the path to the currently selected (not focused) cell and selection is available only on data cells.

@MayaKirova MayaKirova dismissed stale reviews from skrustev and sstoyanovIG via 02e234b March 27, 2019 16:56
@MayaKirova MayaKirova added ❌ status: awaiting-test PRs awaiting manual verification and removed 🛠️ status: in-development Issues and PRs with active development on them labels Mar 27, 2019
@MayaKirova
Copy link
Contributor Author

@PavlovVasil
Regarding 1) - Log as separate issue as it also reproduces in 7.2.x.
Regarding 2) - Expected behavior.
Regarding 3) - Fixed.

Please re-test.

@PavlovVasil PavlovVasil added 💥 status: in-test PRs currently being tested ✅ status: verified Applies to PRs that have passed manual verification and removed ❌ status: awaiting-test PRs awaiting manual verification 💥 status: in-test PRs currently being tested labels Mar 28, 2019
@bkulov bkulov removed their request for review March 28, 2019 12:39
@mpavlinov mpavlinov merged commit f171ea7 into 7.2.x Apr 1, 2019
@mpavlinov mpavlinov deleted the mkirova/fix-4217 branch April 1, 2019 11:52
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.

None yet

8 participants