Skip to content

Commit 93a9014

Browse files
authored
Merge branch '8.2.x' into ddincheva/summary5754
2 parents 7eff358 + ce9218c commit 93a9014

28 files changed

+177
-99
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ For more information about the theming please read our [documentation](https://w
8181
- `isCellSelected` method has been deprecated. Now you can use `selected` property.
8282
- `rowSelectable` property has been deprecated. Now you can use `rowSelection` property to enable row selection and also you can show and hide the row selectors by setting `hideRowSelectors` property to true or false (which is the default value).
8383
- Removed deprecated event `OnFocusChange`
84+
- `IgxGridBaseComponent` exposes a new property, `dataView` that returns the currently transformed paged/filtered/sorted/grouped data, displayed in the grid
8485
- **Breaking Change** `igxExcelStyleSortingTemplate` directive is renamed to `igxExcelStyleSorting`.
8586
- **Breaking Change** `igxExcelStyleMovingTemplate` directive is renamed to `igxExcelStyleMoving`.
8687
- **Breaking Change** `igxExcelStyleHidingTemplate` directive is renamed to `igxExcelStyleHiding`.

projects/igniteui-angular/src/lib/core/styles/components/chip/_chip-component.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
@extend %igx-chip__item--hover !optional;
2424
}
2525

26-
&:focus,
27-
&:focus-within {
26+
&:focus {
2827
@extend %igx-chip__item--focus !optional;
2928
}
3029
}

projects/igniteui-angular/src/lib/core/styles/components/chip/_chip-theme.scss

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,20 @@
402402
display: none;
403403
}
404404

405-
&:focus-within {
405+
// FIX IE11 and Edge focus styles.
406+
// [focus-within] is not supported by IE & Edge.
407+
&:focus {
406408
outline-style: none;
407-
color: igx-color(map-get($theme, 'palette'), error);
409+
410+
igx-icon {
411+
color: igx-color(map-get($theme, 'palette'), error);
412+
}
413+
}
414+
415+
igx-icon {
416+
&:focus{
417+
outline-style: none;
418+
}
408419
}
409420

410421
[dir='rtl'] & {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,7 @@
11891189
%grid-cell-text {
11901190
font-style: italic;
11911191
color: --var($theme, 'cell-edited-value-color');
1192+
padding: 0 1px;
11921193
}
11931194
}
11941195

projects/igniteui-angular/src/lib/core/styles/themes/schemas/dark/_grid.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
/// @prop {Color} row-even-background [#222] - The background color of even rows.
1414
/// @prop {Map} row-hover-background [igx-color: ('grays', 100), hexrgba: #222] - The hover row background color.
1515
/// @prop {Map} row-selected-background [igx-color: ('secondary', 500), rgba: .24, hexrgba: #222] - The selected row background color.
16+
/// @prop {Map} row-selected-hover-background [igx-color: ('secondary', 'A700'), rgba: .24, hexrgba: #222] - The selected row background color on hover.
1617
/// @prop {Color} row-selected-text-color [#fff] - The selected row text color.
1718
/// @prop {Color} ghost-header-background [#222] - The dragged header background color.
1819
/// @prop {Color} cell-editing-background [#222] - The background for the cell in editing mode.
@@ -52,6 +53,12 @@ $_base-dark-grid: (
5253
hexrgba: #222
5354
),
5455

56+
row-selected-hover-background: (
57+
igx-color: ('secondary', 'A700'),
58+
rgba: .24,
59+
hexrgba: #222
60+
),
61+
5562
row-selected-text-color: #fff,
5663

5764
ghost-header-background: #222,

projects/igniteui-angular/src/lib/core/styles/themes/schemas/light/_grid.scss

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
/// @prop {Color} row-even-background [#fff] - The background color of even rows.
2828
/// @prop {Color} row-odd-text-color [inherit] - The text color of odd rows.
2929
/// @prop {Color} row-even-text-color [inherit] - The text color of even rows.
30-
/// @prop {Map} row-selected-background [igx-color: ('secondary', 50), hexrgba: #fff] - The selected row background color.
30+
/// @prop {Map} row-selected-background [igx-color: ('secondary', 50)] - The selected row background color.
3131
/// @prop {Map} row-selected-text-color [igx-contrast-color: ('secondary', 50)] - The selected row text color.
32-
/// @prop {Map} row-selected-hover-background [igx-color: ('secondary', 50), hexrgba: #fff] - The selected row hover background.
32+
/// @prop {Map} row-selected-hover-background [igx-color: ('secondary', 50)] - The selected row hover background.
3333
/// @prop {Map} row-hover-background [igx-color: ('grays', 100), hexrgba: #fff] - The hover row background color.
3434
/// @prop {Map} row-hover-text-color [igx-contrast-color: ('grays', 200)] - The hover row text color.
3535
/// @prop {Map} row-border-color [igx-color: ('grays', 300)] - The row bottom border color.
@@ -132,12 +132,10 @@ $_light-grid: extend(
132132

133133
row-selected-background: (
134134
igx-color: ('secondary', 50),
135-
hexrgba: #fff
136135
),
137136

138137
row-selected-hover-background: (
139138
igx-color: ('secondary', 50),
140-
hexrgba: #fff
141139
),
142140

143141
row-selected-text-color: (
@@ -334,7 +332,7 @@ $_light-grid: extend(
334332
/// @prop {Map} row-selected-hover-background [igx-color: ('grays', 200), hexrgba: #fff] - The selected row hover background.
335333
/// @prop {Map} row-border-color [igx-color: ('grays', 100)] - The row bottom border color.
336334
/// @prop {Map} pinned-border-color [igx-color: ('grays', 200)] - The color of the pinned border.
337-
/// @prop {Map} cell-active-border-color [igx-color: ('primary', 100), hexrgba: #fff] - The active(focused) cell border color.
335+
/// @prop {Map} cell-active-border-color [igx-color: ('primary', 100)] - The active(focused) cell border color.
338336
/// @prop {Map} cell-selected-background [igx-color: ('grays', 300), hexrgba: #fff] - The selected cell background color.
339337
/// @prop {Map} grouparea-background [igx-color: 'surface'] - The grid group area background color.
340338
/// @prop {Map} group-row-background [igx-color: ('grays', 50), hexrgba: #fff] - The grid group row background color.
@@ -385,7 +383,6 @@ $_fluent-grid: extend(
385383

386384
cell-active-border-color: (
387385
igx-color: ('primary', 100),
388-
hexrgba: #fff
389386
),
390387

391388
cell-selected-background: (

projects/igniteui-angular/src/lib/grids/common/grid.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export interface GridType {
2525
pinnedColumns: any;
2626
summariesRowList: any;
2727
headerContainer: any;
28+
dataView: any[];
2829

2930
rowInEditMode: any;
3031
rowEditTabs: any;

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

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,10 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
890890
this._isLoading = value;
891891
this.evaluateLoadingState();
892892
}
893-
this.notifyChanges();
893+
Promise.resolve().then(() => {
894+
// wait for the current detection cycle to end before triggering a new one.
895+
this.notifyChanges();
896+
});
894897
}
895898

896899
/**
@@ -4630,8 +4633,8 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
46304633
public hasVerticalSroll() {
46314634
if (this._init) { return false; }
46324635
const isScrollable = this.verticalScrollContainer ? this.verticalScrollContainer.isScrollable() : false;
4633-
return !!(this.calcWidth && this.verticalScrollContainer.igxForOf &&
4634-
this.verticalScrollContainer.igxForOf.length > 0 &&
4636+
return !!(this.calcWidth && this.dataView &&
4637+
this.dataView.length > 0 &&
46354638
isScrollable);
46364639
}
46374640

@@ -4997,6 +5000,17 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
49975000
return 0;
49985001
}
49995002

5003+
/**
5004+
* Returns the currently transformed paged/filtered/sorted/grouped data, displayed in the grid.
5005+
* ```typescript
5006+
* const dataView = this.grid.dataView;
5007+
* ```
5008+
* @memberof IgxGridComponent
5009+
*/
5010+
get dataView(): any[] {
5011+
return this.verticalScrollContainer.igxForOf;
5012+
}
5013+
50005014
/**
50015015
* Get current selection state.
50025016
* Returns an array with selected rows' IDs (primaryKey or rowData)
@@ -5215,7 +5229,7 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
52155229
* If `headers` is enabled, it will use the column header (if any) instead of the column field.
52165230
*/
52175231
getSelectedData(formatters = false, headers = false) {
5218-
const source = this.verticalScrollContainer.igxForOf;
5232+
const source = this.dataView;
52195233
return this.extractDataFromSelection(source, formatters, headers);
52205234
}
52215235

@@ -5284,12 +5298,12 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
52845298
* @memberof IgxGridBaseComponent
52855299
*/
52865300
public navigateTo(rowIndex: number, visibleColIndex = -1, cb: Function = null) {
5287-
if (rowIndex < 0 || rowIndex > this.verticalScrollContainer.igxForOf.length - 1
5301+
if (rowIndex < 0 || rowIndex > this.dataView.length - 1
52885302
|| (visibleColIndex !== -1 && this.columnList.map(col => col.visibleIndex).indexOf(visibleColIndex) === -1)) {
52895303
return;
52905304
}
52915305
this.wheelHandler();
5292-
if (this.verticalScrollContainer.igxForOf.slice(rowIndex, rowIndex + 1).find(rec => rec.expression || rec.childGridsData)) {
5306+
if (this.dataView.slice(rowIndex, rowIndex + 1).find(rec => rec.expression || rec.childGridsData)) {
52935307
visibleColIndex = -1;
52945308
}
52955309
if (visibleColIndex === -1 || this.navigation.isColumnFullyVisible(visibleColIndex)) {
@@ -5325,7 +5339,7 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
53255339
const colIndexes = callback ? columns.filter((col) => callback(col)).map(editCol => editCol.visibleIndex).sort((a, b) => a - b) :
53265340
columns.map(editCol => editCol.visibleIndex).sort((a, b) => a - b);
53275341
const nextCellIndex = colIndexes.find(index => index > curVisibleColIndex);
5328-
if (this.verticalScrollContainer.igxForOf.slice(currRowIndex, currRowIndex + 1)
5342+
if (this.dataView.slice(currRowIndex, currRowIndex + 1)
53295343
.find(rec => !rec.expression && !rec.summaries && !rec.childGridsData) && nextCellIndex !== undefined) {
53305344
return { rowIndex: currRowIndex, visibleColumnIndex: nextCellIndex };
53315345
} else {
@@ -5357,7 +5371,7 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
53575371
const colIndexes = callback ? columns.filter((col) => callback(col)).map(editCol => editCol.visibleIndex).sort((a, b) => b - a) :
53585372
columns.map(editCol => editCol.visibleIndex).sort((a, b) => b - a);
53595373
const prevCellIndex = colIndexes.find(index => index < curVisibleColIndex);
5360-
if (this.verticalScrollContainer.igxForOf.slice(currRowIndex, currRowIndex + 1)
5374+
if (this.dataView.slice(currRowIndex, currRowIndex + 1)
53615375
.find(rec => !rec.expression && !rec.summaries && !rec.childGridsData) && prevCellIndex !== undefined) {
53625376
return { rowIndex: currRowIndex, visibleColumnIndex: prevCellIndex };
53635377
} else {
@@ -5400,24 +5414,24 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
54005414
private getPrevDataRowIndex(currentRowIndex): number {
54015415
if (currentRowIndex <= 0) { return currentRowIndex; }
54025416

5403-
const prevRow = this.verticalScrollContainer.igxForOf.slice(0, currentRowIndex).reverse()
5417+
const prevRow = this.dataView.slice(0, currentRowIndex).reverse()
54045418
.find(rec => !rec.expression && !rec.summaries && !rec.childGridsData);
5405-
return prevRow ? this.verticalScrollContainer.igxForOf.indexOf(prevRow) : currentRowIndex;
5419+
return prevRow ? this.dataView.indexOf(prevRow) : currentRowIndex;
54065420
}
54075421

54085422
private getNextDataRowIndex(currentRowIndex): number {
5409-
if (currentRowIndex === this.verticalScrollContainer.igxForOf.length) { return currentRowIndex; }
5423+
if (currentRowIndex === this.dataView.length) { return currentRowIndex; }
54105424

5411-
const nextRow = this.verticalScrollContainer.igxForOf.slice(currentRowIndex + 1, this.verticalScrollContainer.igxForOf.length)
5425+
const nextRow = this.dataView.slice(currentRowIndex + 1, this.dataView.length)
54125426
.find(rec => !rec.expression && !rec.summaries && !rec.childGridsData);
5413-
return nextRow ? this.verticalScrollContainer.igxForOf.indexOf(nextRow) : currentRowIndex;
5427+
return nextRow ? this.dataView.indexOf(nextRow) : currentRowIndex;
54145428
}
54155429

54165430
private isValidPosition(rowIndex, colIndex): boolean {
54175431
const rows = this.summariesRowList.filter(s => s.index !== 0).concat(this.rowList.toArray()).length;
54185432
const cols = this.columnList.filter(col => !col.columnGroup && col.visibleIndex >= 0).length;
54195433
if (rows < 1 || cols < 1) { return false; }
5420-
if (rowIndex > -1 && rowIndex < this.verticalScrollContainer.igxForOf.length &&
5434+
if (rowIndex > -1 && rowIndex < this.dataView.length &&
54215435
colIndex > - 1 && colIndex <= this.unpinnedColumns[this.unpinnedColumns.length - 1].visibleIndex) {
54225436
return true;
54235437
}
@@ -5614,11 +5628,11 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
56145628
if (delayScrolling) {
56155629
this.verticalScrollContainer.onDataChanged.pipe(first()).subscribe(() => {
56165630
this.scrollDirective(this.verticalScrollContainer,
5617-
typeof (row) === 'number' ? row : this.verticalScrollContainer.igxForOf.indexOf(row));
5631+
typeof (row) === 'number' ? row : this.dataView.indexOf(row));
56185632
});
56195633
} else {
56205634
this.scrollDirective(this.verticalScrollContainer,
5621-
typeof (row) === 'number' ? row : this.verticalScrollContainer.igxForOf.indexOf(row));
5635+
typeof (row) === 'number' ? row : this.dataView.indexOf(row));
56225636
}
56235637

56245638
this.scrollToHorizontally(column);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ export class IgxGridMRLNavigationService extends IgxGridNavigationService {
249249
moveNext = true;
250250
}
251251
const rowIndex = moveNext ? selectedNode.row + 1 : selectedNode.row;
252-
if (rowIndex > this.grid.verticalScrollContainer.igxForOf.length - 1) {
252+
if (rowIndex > this.grid.dataView.length - 1) {
253253
// end of rows reached.
254254
return;
255255
}
@@ -469,7 +469,7 @@ export class IgxGridMRLNavigationService extends IgxGridNavigationService {
469469
}
470470

471471
private _isGroupRecordAt(rowIndex: number) {
472-
const record = this.grid.verticalScrollContainer.igxForOf[rowIndex];
472+
const record = this.grid.dataView[rowIndex];
473473
return record.records && record.records.length;
474474
}
475475

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ export class IgxGridNavigationService {
267267
(cells[cells.length - 1] as HTMLElement).focus();
268268
} else {
269269
this.getFocusableGrid().nativeElement.focus({ preventScroll: true });
270-
this.grid.verticalScrollContainer.scrollTo(this.grid.verticalScrollContainer.igxForOf.length - 1);
270+
this.grid.verticalScrollContainer.scrollTo(this.grid.dataView.length - 1);
271271
this.grid.verticalScrollContainer.onChunkLoad
272272
.pipe(first()).subscribe(() => {
273273
const cells = this.grid.nativeElement.querySelectorAll(
@@ -315,7 +315,7 @@ export class IgxGridNavigationService {
315315
public navigateDown(rowElement, selectedNode: ISelectionNode) {
316316
const currentRowIndex = selectedNode.row;
317317
const visibleColumnIndex = selectedNode.column;
318-
if (currentRowIndex === this.grid.verticalScrollContainer.igxForOf.length - 1 ||
318+
if (currentRowIndex === this.grid.dataView.length - 1 ||
319319
(currentRowIndex === 0 && rowElement.tagName.toLowerCase() === 'igx-grid-summary-row')) {
320320
// check if this is rootSummary row
321321
return;
@@ -389,7 +389,7 @@ export class IgxGridNavigationService {
389389
this.onKeydownEnd(rowIndex);
390390
} else {
391391
this.getFocusableGrid().nativeElement.focus({ preventScroll: true });
392-
this.grid.verticalScrollContainer.scrollTo(this.grid.verticalScrollContainer.igxForOf.length - 1);
392+
this.grid.verticalScrollContainer.scrollTo(this.grid.dataView.length - 1);
393393
this.grid.verticalScrollContainer.onChunkLoad
394394
.pipe(first()).subscribe(() => {
395395
const rows = this.getAllRows();
@@ -405,7 +405,7 @@ export class IgxGridNavigationService {
405405
const verticalScroll = this.grid.verticalScrollContainer.getVerticalScroll();
406406
if (verticalScroll.scrollHeight === 0 ||
407407
verticalScroll.scrollTop === verticalScroll.scrollHeight - this.grid.verticalScrollContainer.igxForContainerSize) {
408-
const rowIndex = this.grid.verticalScrollContainer.igxForOf.length - 1;
408+
const rowIndex = this.grid.dataView.length - 1;
409409
const row = this.grid.nativeElement.querySelector(`[data-rowindex="${rowIndex}"]`) as HTMLElement;
410410
if (row && row.tagName.toLowerCase() === 'igx-grid-groupby-row') {
411411
row.focus();
@@ -414,10 +414,10 @@ export class IgxGridNavigationService {
414414
const isSummary = (row && row.tagName.toLowerCase() === 'igx-grid-summary-row') ? true : false;
415415
this.onKeydownEnd(rowIndex, isSummary);
416416
} else {
417-
this.grid.verticalScrollContainer.scrollTo(this.grid.verticalScrollContainer.igxForOf.length - 1);
417+
this.grid.verticalScrollContainer.scrollTo(this.grid.dataView.length - 1);
418418
this.grid.verticalScrollContainer.onChunkLoad
419419
.pipe(first()).subscribe(() => {
420-
const rowIndex = this.grid.verticalScrollContainer.igxForOf.length - 1;
420+
const rowIndex = this.grid.dataView.length - 1;
421421
const row = this.grid.nativeElement.querySelector(`[data-rowindex="${rowIndex}"]`) as HTMLElement;
422422
if (row && row.tagName.toLowerCase() === 'igx-grid-groupby-row') {
423423
row.focus();
@@ -447,7 +447,7 @@ export class IgxGridNavigationService {
447447
const rowEl = this.grid.rowList.find(row => row.index === rowIndex + 1) ?
448448
this.grid.rowList.find(row => row.index === rowIndex + 1) :
449449
this.grid.summariesRowList.find(row => row.index === rowIndex + 1);
450-
if (rowIndex === this.grid.verticalScrollContainer.igxForOf.length - 1 && this.grid.rootSummariesEnabled) {
450+
if (rowIndex === this.grid.dataView.length - 1 && this.grid.rootSummariesEnabled) {
451451
this.onKeydownHome(0, true);
452452
return;
453453
}

0 commit comments

Comments
 (0)