Skip to content

Commit a7eae2c

Browse files
authored
Merge pull request #7463 from IgniteUI/9.1.x
Merging 9.1.x into master
2 parents ddee12e + 985d8d1 commit a7eae2c

23 files changed

+200
-45
lines changed

.github/workflows/nodejs.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Node.js CI
5+
6+
on:
7+
push:
8+
branches: [ master, 9.1.x ]
9+
pull_request:
10+
branches: [ master, 9.1.x ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
node-version: [10.x, 12.x, 14.x]
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v1
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
- run: npm ci
28+
- run: npm run lint:lib
29+
- run: npm run build:lib
30+
- run: npm run test:lib:others
31+
env:
32+
NODE_OPTIONS: --max_old_space_size=4096
33+
- run: npm run test:lib:grid
34+
env:
35+
NODE_OPTIONS: --max_old_space_size=4096
36+
- run: npm run test:lib:tgrid
37+
env:
38+
NODE_OPTIONS: --max_old_space_size=4096
39+
- run: npm run test:lib:hgrid
40+
env:
41+
NODE_OPTIONS: --max_old_space_size=4096
42+
- run: npm run test:schematics

projects/igniteui-angular/src/lib/action-strip/grid-actions/grid-editing-actions.component.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Component, HostBinding } from '@angular/core';
22
import { IgxGridActionsBaseDirective } from './grid-actions-base.directive';
3+
import { showMessage } from '../../core/deprecateDecorators';
34

45
@Component({
56
selector: 'igx-grid-editing-actions',
@@ -16,6 +17,8 @@ export class IgxGridEditingActionsComponent extends IgxGridActionsBaseDirective
1617
@HostBinding('class.igx-action-strip__editing-actions')
1718
public cssClass = 'igx-action-strip__editing-actions';
1819

20+
private isMessageShown = false;
21+
1922
/**
2023
* Enter row or cell edit mode depending the grid rowEditable option
2124
* @example
@@ -33,6 +36,12 @@ export class IgxGridEditingActionsComponent extends IgxGridActionsBaseDirective
3336
const row = this.strip.context;
3437
const firstEditable = row.cells.filter(cell => cell.editable)[0];
3538
const grid = row.grid;
39+
if (!grid.hasEditableColumns) {
40+
this.isMessageShown = showMessage(
41+
'The grid should be editable in order to use IgxGridEditingActionsComponent',
42+
this.isMessageShown);
43+
return;
44+
}
3645
// be sure row is in view
3746
if (grid.rowList.filter(r => r === row).length !== 0) {
3847
grid.crudService.begin(firstEditable);

projects/igniteui-angular/src/lib/core/styles/components/grid/_grid-theme.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,8 @@
11321132

11331133
%igx-grid__tr--pinned-bottom {
11341134
border-top: map-get($cell-pin, 'style') map-get($cell-pin, 'color') !important;
1135+
position: absolute;
1136+
bottom: 0;
11351137
}
11361138

11371139
%igx-grid__tr--edit {

projects/igniteui-angular/src/lib/grids/cell.component.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -588,14 +588,12 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
588588

589589
private addPointerListeners(selection) {
590590
if (selection !== GridSelectionMode.multiple) { return; }
591-
this.nativeElement.addEventListener('pointerdown', this.pointerdown);
592591
this.nativeElement.addEventListener('pointerenter', this.pointerenter);
593592
this.nativeElement.addEventListener('pointerup', this.pointerup);
594593
}
595594

596595
private removePointerListeners(selection) {
597596
if (selection !== GridSelectionMode.multiple) { return; }
598-
this.nativeElement.removeEventListener('pointerdown', this.pointerdown);
599597
this.nativeElement.removeEventListener('pointerenter', this.pointerenter);
600598
this.nativeElement.removeEventListener('pointerup', this.pointerup);
601599
}
@@ -606,6 +604,7 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
606604
*/
607605
ngOnInit() {
608606
this.zone.runOutsideAngular(() => {
607+
this.nativeElement.addEventListener('pointerdown', this.pointerdown);
609608
this.addPointerListeners(this.cellSelectionMode);
610609
// IE 11 workarounds
611610
if (isIE()) {
@@ -629,6 +628,7 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
629628
*/
630629
ngOnDestroy() {
631630
this.zone.runOutsideAngular(() => {
631+
this.nativeElement.removeEventListener('pointerdown', this.pointerdown);
632632
this.removePointerListeners(this.cellSelectionMode);
633633
if (isIE()) {
634634
this.nativeElement.removeEventListener('compositionstart', this.compositionStartHandler);
@@ -755,6 +755,10 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
755755
* @internal
756756
*/
757757
pointerdown = (event: PointerEvent) => {
758+
if (this.cellSelectionMode !== GridSelectionMode.multiple) {
759+
this.activate(event);
760+
return;
761+
}
758762
if (!isLeftClick(event)) {
759763
this.selectionService.addKeyboardRange();
760764
this.selectionService.initKeyboardState();
@@ -816,9 +820,6 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
816820
*/
817821
@HostListener('click', ['$event'])
818822
public onClick(event: MouseEvent) {
819-
if (this.cellSelectionMode !== GridSelectionMode.multiple) {
820-
this.activate(event);
821-
}
822823
this.grid.onCellClick.emit({
823824
cell: this,
824825
event

projects/igniteui-angular/src/lib/grids/columns/column-group.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ export class IgxColumnGroupComponent extends IgxColumnComponent implements After
239239
}
240240

241241
/**
242-
* Enables/Disables the column group selection.
243-
* ```html
244-
* <igx-column [selected] = "true"></igx-column>
242+
* Select/deselect the column group.
243+
* ```typescript
244+
* this.columnGroup.selected = true;
245245
* ```
246246
* @memberof IgxColumnGroupComponent
247247
*/

projects/igniteui-angular/src/lib/grids/columns/column.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,10 @@ export class IgxColumnComponent implements AfterContentInit {
294294
}
295295

296296
/**
297-
* Enables/Disables column selection.
297+
* Select/deselect a column.
298298
* Default value is `false`.
299-
* ```html
300-
* <igx-column [selected] = "true"></igx-column>
299+
* ```typescript
300+
* this.column.selected = true;
301301
* ```
302302
* @memberof IgxColumnComponent
303303
*/

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4294,14 +4294,6 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
42944294
return this.calcHeight ? this.calcHeight + this.pinnedRowHeight : this.calcHeight;
42954295
}
42964296

4297-
get pinnedBottom() {
4298-
const start = this.verticalScrollContainer.state.startIndex;
4299-
const end = this.verticalScrollContainer.state.startIndex + this.verticalScrollContainer.state.chunkSize - 1;
4300-
const bottom = this.verticalScrollContainer.getScrollForIndex(end, true) - this.verticalScrollContainer.getScrollForIndex(start);
4301-
return bottom;
4302-
}
4303-
4304-
43054297
/**
43064298
* Recalculates grid width/height dimensions.
43074299
* @remarks

projects/igniteui-angular/src/lib/grids/grid/grid-api.service.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,16 @@ export class IgxGridAPIService extends GridBaseAPIService<IgxGridComponent> {
4343
names.forEach((colName) => {
4444
const grExprIndex = groupingState.findIndex((exp) => exp.fieldName === colName);
4545
const grpExpandState = this.grid.groupingExpansionState;
46-
/* remove expansion states related to the cleared group
47-
and all with deeper hierarchy than the cleared group */
48-
this.grid.groupingExpansionState = grpExpandState
49-
.filter((val) => {
50-
return val.hierarchy && val.hierarchy.length <= grExprIndex;
51-
});
46+
/* remove expansion states related to the cleared group
47+
and all with deeper hierarchy than the cleared group */
48+
const newExpandState = grpExpandState.filter((val) => {
49+
return val.hierarchy && val.hierarchy.length <= grExprIndex;
50+
});
51+
/* Do not set the new instance produced by filter
52+
when there are no differences between expansion states */
53+
if (newExpandState.length !== grpExpandState.length) {
54+
this.grid.groupingExpansionState = newExpandState;
55+
}
5256
});
5357
} else {
5458
// clear all

projects/igniteui-angular/src/lib/grids/grid/grid-filtering-ui.spec.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2524,6 +2524,25 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
25242524
expect(GridFunctions.getFilterCell(fix, 'ReleaseDate').query(By.css('.custom-filter'))).not.toBeNull(
25252525
'\`ReleaseDate\` customer filter template was not found.');
25262526
}));
2527+
2528+
it('Should close default filter template when clicking on a column with custom one.', fakeAsync(() => {
2529+
// Click on a column with default filter
2530+
GridFunctions.clickFilterCellChip(fix, 'Licensed');
2531+
fix.detectChanges();
2532+
2533+
// Verify filter row is visible
2534+
let filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW));
2535+
expect(filterUIRow).not.toBeNull();
2536+
2537+
// Click on a column with custom filter
2538+
const header = GridFunctions.getColumnHeaderByIndex(fix, 1);
2539+
header.click();
2540+
fix.detectChanges();
2541+
2542+
// Expect the filter row is closed
2543+
filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW));
2544+
expect(filterUIRow).toBeNull('Default filter template was found on a column with custom filtering.');
2545+
}));
25272546
});
25282547
});
25292548

projects/igniteui-angular/src/lib/grids/grid/grid-keyBoardNav.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ describe('IgxGrid - Keyboard navigation #grid', () => {
663663
it('should toggle expand/collapse state of group row with ArrowRight/ArrowLeft key.', () => {
664664
const gRow = grid.groupsRowList.toArray()[0];
665665
const gRowElement = GridFunctions.getGroupedRows(fix)[0];
666-
gRowElement.triggerEventHandler('click', {});
666+
gRowElement.triggerEventHandler('pointerdown', {});
667667
fix.detectChanges();
668668
expect(gRow.expanded).toBe(true);
669669

@@ -680,7 +680,7 @@ describe('IgxGrid - Keyboard navigation #grid', () => {
680680
it('should toggle expand/collapse state of group row with ArrowUp/ArrowDown key.', () => {
681681
const gRow = grid.groupsRowList.toArray()[0];
682682
const gRowElement = GridFunctions.getGroupedRows(fix)[0];
683-
gRowElement.triggerEventHandler('click', {});
683+
gRowElement.triggerEventHandler('pointerdown', {});
684684
fix.detectChanges();
685685

686686
expect(gRow.expanded).toBe(true);
@@ -704,7 +704,7 @@ describe('IgxGrid - Keyboard navigation #grid', () => {
704704
let groupedRowsCount = grid.groupsRowList.length;
705705
let groupRow = grid.groupsRowList.toArray()[groupedRowsCount - 1];
706706
const groupRowElement = GridFunctions.getGroupedRows(fix)[groupedRowsCount - 1];
707-
groupRowElement.triggerEventHandler('click', null);
707+
groupRowElement.triggerEventHandler('pointerdown', null);
708708
fix.detectChanges();
709709

710710
GridFunctions.verifyGroupRowIsFocused(groupRow);
@@ -737,7 +737,7 @@ describe('IgxGrid - Keyboard navigation #grid', () => {
737737
expect(grid.groupsRowList.last.expanded).toBeTruthy();
738738

739739
const groupRowIndex = grid.groupsRowList.last.index;
740-
grid.groupsRowList.last.nativeElement.dispatchEvent(new Event('click'));
740+
grid.groupsRowList.last.nativeElement.dispatchEvent(new Event('pointerdown'));
741741
await wait();
742742
fix.detectChanges();
743743
UIInteractions.triggerEventHandlerKeyDown('arrowDown', gridContent);
@@ -762,7 +762,7 @@ describe('IgxGrid - Keyboard navigation #grid', () => {
762762
fix.detectChanges();
763763

764764
let row = grid.getRowByIndex(1);
765-
row.nativeElement.dispatchEvent(new Event('click'));
765+
row.nativeElement.dispatchEvent(new Event('pointerdown'));
766766
await wait();
767767
fix.detectChanges();
768768

@@ -916,7 +916,7 @@ describe('IgxGrid - Keyboard navigation #grid', () => {
916916
await wait(DEBOUNCETIME);
917917
fix.detectChanges();
918918

919-
grid.navigateTo(9, -1, (args) => { args.target.nativeElement.click(); });
919+
grid.navigateTo(9, -1, (args) => { args.target.nativeElement.dispatchEvent(new Event('pointerdown')); });
920920
await wait(100);
921921
fix.detectChanges();
922922
await wait(100);

0 commit comments

Comments
 (0)