Skip to content

Commit eb3c974

Browse files
authored
Merge branch 'master' into vmihalkov/fix-10074
2 parents 6c4f5f4 + c7f70c9 commit eb3c974

17 files changed

+173
-50
lines changed

CHANGELOG.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,33 @@ All notable changes for each version of this project will be documented in this
55
## 12.2.0
66

77
### New Features
8+
- `igxGrid`, `igxHierarchicalGrid`, `igxTreeGrid`
9+
- Added capability to restore the state of multi column headers with `IgxGridStateDirective`.
10+
- Introduced new 'rowStyles' and 'rowClasses' grid properties which allows to define a custom styling on each grid row
11+
- Introduced two new *cancellable* outputs related to CRUD - `rowDelete` and `rowAdd`. Both use an `IGridEditEventArgs` object as an event argument.
12+
```html
13+
<igx-grid #grid [data]="localData" (rowAdd)="rowAdd($event)" (rowDelete)="rowDelete($event)" [autoGenerate]="true"></igx-grid>
14+
```
815
- `igxTreeGrid`
916
- Added `TreeGridMatchingRecordsOnlyFilteringStrategy`, which allows you to display only the records matching particular filtering condition without any trace for their parents.
10-
11-
## 12.1.6
17+
- `IgxSnackbarComponent`
18+
- Introduced new 'positionSettings' input which allows to define a custom animation and position.
19+
- `IgxToastComponent`
20+
- Introduced new 'positionSettings' input which allows to define a custom animation and position.
1221

1322
### General
1423
- `igxGrid`, `igxHierarchicalGrid`, `igxTreeGrid`
1524
- 'oddRowCSS' and 'evenRowCSS' properties has been deprecated
25+
- `IgxForOf` - now takes margins into account when calculating the space that each element takes.
26+
_Note:_ If your virtualized items contain margins, please calculate them into the `itemSize` value for the best possible initial virtualized state.
27+
28+
## 12.1.6
29+
30+
## 12.1.6
1631

1732
### New Features
1833
- `igxGrid`, `igxHierarchicalGrid`, `igxTreeGrid`
19-
- Added two public methods that spawn the add row UI for an arbitrary record in the current data view. One that accepts a rowID to use as the row the UI spawns under and the other accepting an index that has a distinct implementation for `IgxTreeGrid`. Please, refer to the official documentation for more information:[Grid Row Adding](https://www.infragistics.com/products/ignite-ui-angular/angular/components/grid/row-adding) and [Tree Grid Row Adding](https://www.infragistics.com/products/ignite-ui-angular/angular/components/treegrid/row-adding).
34+
- Added two public methods that spawn the add row UI for an arbitrary record in the current data view. One that accepts a rowID to use as the row the UI spawns under and the other accepting an index that has a distinct implementation for `IgxTreeGrid`. Please, refer to the official documentation for more information: [Grid Row Adding](https://www.infragistics.com/products/ignite-ui-angular/angular/components/grid/row-adding) and [Tree Grid Row Adding](https://www.infragistics.com/products/ignite-ui-angular/angular/components/treegrid/row-adding).
2035

2136
_Note:_ That the new record is still added at the end of the data view, after the end-user submits it.
2237
```typescript
@@ -28,16 +43,6 @@ All notable changes for each version of this project will be documented in this
2843
this.treeGrid.beginAddRowByIndex(10, true); // spawns the add row UI to add a child for the row at index 10
2944
this.treeGrid.beginAddRowByIndex(null); // spawns the add row UI as the first record
3045
```
31-
- Added capability to restore the state of multi column headers with `IgxGridStateDirective`.
32-
- Introduced new 'rowStyles' and 'rowClasses' grid properties which allows to define a custom styling on each grid row
33-
- Introduced two new *cancellable* outputs related to CRUD - `rowDelete` and `rowAdd`. Both use an `IGridEditEventArgs` object as an event argument.
34-
```html
35-
<igx-grid #grid [data]="localData" (rowAdd)="rowAdd($event)" (rowDelete)="rowDelete($event)" [autoGenerate]="true"></igx-grid>
36-
```
37-
- `IgxSnackbarComponent`
38-
- Introduced new 'positionSettings' input which allows to define a custom animation and position.
39-
- `IgxToastComponent`
40-
- Introduced new 'positionSettings' input which allows to define a custom animation and position.
4146

4247
## 12.1.3
4348

ROADMAP.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@
88
2. **[DONE]** Grid row styles and classes [#9969](https://github.com/IgniteUI/igniteui-angular/issues/9969)
99
3. **[DONE]** Freezing Columns/Rows on Export to Excel (Angular) [#9863](https://github.com/IgniteUI/igniteui-angular/issues/9863)
1010
4. **[DONE]** Persistent State directive for column group [#8516](https://github.com/IgniteUI/igniteui-angular/issues/8516)
11-
5. IgxTreeGrid: display only filtered records [#9923](https://github.com/IgniteUI/igniteui-angular/issues/9923)
12-
6. IgxCombo: being able to set groups sorting order [#10125](https://github.com/IgniteUI/igniteui-angular/issues/10125)
13-
7. IgxCsvExporterService: Support multi-column headers export [#10078](https://github.com/IgniteUI/igniteui-angular/issues/10078)
14-
8. **[DONE]** Snackbar support for animation customization [#10126](https://github.com/IgniteUI/igniteui-angular/issues/10126)
15-
9. IgxLinearProgressBar: animate initial progress [#10068](https://github.com/IgniteUI/igniteui-angular/issues/10068)
16-
10. Getting only one sort and one filter event after changing the state of grid using setState function [#8064](https://github.com/IgniteUI/igniteui-angular/issues/8064)
11+
5. **[DONE]** IgxTreeGrid: display only filtered records [#9923](https://github.com/IgniteUI/igniteui-angular/issues/9923)
12+
6. **[DONE]** Snackbar support for animation customization [#10126](https://github.com/IgniteUI/igniteui-angular/issues/10126)
1713

1814
## Going down the road
1915

@@ -24,6 +20,9 @@
2420
5. Themes: Split themes and aid with Grid refactoring [#9556](https://github.com/IgniteUI/igniteui-angular/issues/9556)
2521
6. Stepper component [#8667](https://github.com/IgniteUI/igniteui-angular/issues/8667)
2622
7. Make IgxDropDownBaseToken public [#10103](https://github.com/IgniteUI/igniteui-angular/issues/10103)
23+
8. IgxLinearProgressBar: animate initial progress [#10068](https://github.com/IgniteUI/igniteui-angular/issues/10068)
24+
9. IgxCombo: being able to set groups sorting order [#10125](https://github.com/IgniteUI/igniteui-angular/issues/10125)
25+
10. Getting only one sort and one filter event after changing the state of grid using setState function [#8064](https://github.com/IgniteUI/igniteui-angular/issues/8064)
2726

2827
# Previous Milestone
2928

projects/igniteui-angular/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@
7777
"@igniteui/material-icons-extended": "^2.8.0"
7878
},
7979
"peerDependencies": {
80-
"@angular/common": "^12.1.1",
81-
"@angular/core": "^12.1.1",
82-
"@angular/animations": "^12.1.1",
83-
"@angular/forms": "^12.1.1",
80+
"@angular/common": "^12.2.0",
81+
"@angular/core": "^12.2.0",
82+
"@angular/animations": "^12.2.0",
83+
"@angular/forms": "^12.2.0",
8484
"web-animations-js": "^2.3.2"
8585
},
8686
"igxDevDependencies": {
87-
"@igniteui/angular-schematics": "~12.1.810"
87+
"@igniteui/angular-schematics": "~12.2.820-alpha.0"
8888
},
8989
"ng-update": {
9090
"migrations": "./migrations/migration-collection.json"

projects/igniteui-angular/src/lib/data-operations/data-util.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,9 +487,9 @@ const testMerging = () => {
487487
describe('Test merging', () => {
488488
it('Should merge add transactions correctly', () => {
489489
const data = SampleTestData.personIDNameData();
490-
const addRow4 = { ID: 4, Name: 'Peter' };
491-
const addRow5 = { ID: 5, Name: 'Mimi' };
492-
const addRow6 = { ID: 6, Name: 'Pedro' };
490+
const addRow4 = { ID: 4, IsEmployed: true, Name: 'Peter' };
491+
const addRow5 = { ID: 5, IsEmployed: true, Name: 'Mimi' };
492+
const addRow6 = { ID: 6, IsEmployed: false, Name: 'Pedro' };
493493
const transactions: Transaction[] = [
494494
{ id: addRow4.ID, newValue: addRow4, type: TransactionType.ADD },
495495
{ id: addRow5.ID, newValue: addRow5, type: TransactionType.ADD },

projects/igniteui-angular/src/lib/data-operations/filtering-strategy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class FormattedValuesFilteringStrategy extends FilteringStrategy {
134134
let value = resolveNestedPath(rec, fieldName);
135135

136136
value = column.formatter && this.shouldApplyFormatter(fieldName) ?
137-
column.formatter(value) : value && (isDate || isTime) ? parseDate(value) : value;
137+
column.formatter(value, rec) : value && (isDate || isTime) ? parseDate(value) : value;
138138

139139
return value;
140140
}

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.spec.ts

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,33 @@ describe('IgxForOf directive -', () => {
324324
chunkSize = (virtualContainer as any)._calcMaxChunkSize();
325325
expect(chunkSize).toEqual(10);
326326
});
327+
328+
it('should take item margins into account when calculating the size cache', async () => {
329+
fix.componentInstance.height = '600px';
330+
fix.componentInstance.itemSize = '100px';
331+
const virtualContainer = fix.componentInstance.parentVirtDir;
332+
virtualContainer.igxForSizePropName = 'height';
333+
fix.componentInstance.data = [
334+
{ 1: '1', height: '100px', margin: '30px' },
335+
{ 1: '2', height: '100px', margin: '0px' },
336+
{ 1: '3', height: '100px', margin: '0px' },
337+
{ 1: '4', height: '100px', margin: '0px' },
338+
{ 1: '5', height: '100px', margin: '0px' },
339+
{ 1: '6', height: '100px', margin: '0px' },
340+
{ 1: '7', height: '100px', margin: '0px' },
341+
{ 1: '8', height: '100px', margin: '30px' },
342+
{ 1: '9', height: '100px', margin: '30px' },
343+
{ 1: '10', height: '100px', margin: '30px' }
344+
];
345+
fix.detectChanges();
346+
await wait(200);
347+
const cache = (fix.componentInstance.parentVirtDir as any).heightCache;
348+
expect(cache).toEqual([130, 100, 100, 100, 100, 100, 100, 100, 100, 100]);
349+
fix.componentInstance.scrollTop(400);
350+
fix.detectChanges();
351+
await wait(200);
352+
expect(cache).toEqual([130, 100, 100, 100, 100, 100, 100, 130, 130, 130]);
353+
});
327354
});
328355

329356
describe('vertical and horizontal virtual component', () => {
@@ -1185,7 +1212,7 @@ describe('IgxForOf directive -', () => {
11851212
const secondForOf = fix.componentInstance.secondForOfDir;
11861213
expect(secondForOf.state.startIndex).toBe(0);
11871214
});
1188-
});
1215+
});
11891216
});
11901217

11911218
class DataGenerator {
@@ -1401,7 +1428,9 @@ export class VirtualComponent {
14011428
[igxForScrollOrientation]="'vertical'"
14021429
[igxForContainerSize]='height'
14031430
[igxForItemSize]='itemSize'>
1404-
<div [style.display]="'flex'" [style.height]="rowData.height || itemSize || '50px'">
1431+
<div [style.display]="'flex'"
1432+
[style.height]="rowData.height || itemSize || '50px'"
1433+
[style.margin-top]="rowData.margin || '0px'">
14051434
<div [style.min-width]=cols[0].width>{{rowData['1']}}</div>
14061435
<div [style.min-width]=cols[1].width>{{rowData['2']}}</div>
14071436
<div [style.min-width]=cols[2].width>{{rowData['3']}}</div>

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
735735

736736
/**
737737
* @hidden
738-
* Function that recaculates and updates cache sizes.
738+
* Function that recalculates and updates cache sizes.
739739
*/
740740
public recalcUpdateSizes() {
741741
const dimension = this.igxForScrollOrientation === 'horizontal' ?
@@ -753,8 +753,9 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
753753
if (!this.isRemote && !this.igxForOf[index]) {
754754
continue;
755755
}
756+
const margin = this.getMargin(rNode, dimension);
756757
const oldVal = dimension === 'height' ? this.heightCache[index] : this.igxForOf[index][dimension];
757-
const newVal = dimension === 'height' ? h : rNode.clientWidth;
758+
const newVal = (dimension === 'height' ? h : rNode.clientWidth) + margin;
758759
if (dimension === 'height') {
759760
this.heightCache[index] = newVal;
760761
} else {
@@ -855,6 +856,8 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
855856

856857
this.dc.instance._viewContainer.element.nativeElement.style.top = -(scrollOffset) + 'px';
857858

859+
this._zone.onStable.pipe(first()).subscribe(this.recalcUpdateSizes.bind(this));
860+
858861
this.dc.changeDetectorRef.detectChanges();
859862
if (prevStartIndex !== this.state.startIndex) {
860863
this.chunkLoad.emit(this.state);
@@ -1404,6 +1407,16 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
14041407
this.scrollPosition = newSize === this.scrollPosition ? newSize + 1 : newSize;
14051408
}
14061409
}
1410+
1411+
private getMargin(node, dimension: string): number {
1412+
const styles = window.getComputedStyle(node);
1413+
if (dimension === 'height') {
1414+
return parseFloat(styles['marginTop']) +
1415+
parseFloat(styles['marginBottom']) || 0;
1416+
}
1417+
return parseFloat(styles['marginLeft']) +
1418+
parseFloat(styles['marginRight']) || 0;
1419+
}
14071420
}
14081421

14091422
export const getTypeNameForDebugging = (type: any): string => type.name || typeof type;

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
>
99
</ng-template>
1010
<ng-template #defaultCell>
11-
<div *ngIf="column.dataType !== 'boolean'"
11+
<div *ngIf="column.dataType !== 'boolean' || (column.dataType === 'boolean' && this.formatter)"
1212
igxTextHighlight
1313
class="igx-grid__td-text"
1414
style="pointer-events: none;"
@@ -46,13 +46,14 @@
4646
: value
4747
}}</div>
4848
<igx-icon
49-
*ngIf="column.dataType === 'boolean'"
49+
*ngIf="column.dataType === 'boolean' && !this.formatter"
5050
[ngClass]="{ 'igx-icon--success': value, 'igx-icon--error': !value }"
5151
>{{ value ? "check" : "close" }}</igx-icon
5252
>
5353
</ng-template>
5454
<ng-template #addRowCell let-cell="cell">
55-
<div igxTextHighlight class="igx-grid__td-text" style="pointer-events: none"
55+
<div *ngIf="column.dataType !== 'boolean' || (column.dataType === 'boolean' && this.formatter)"
56+
igxTextHighlight class="igx-grid__td-text" style="pointer-events: none"
5657
[cssClass]="highlightClass"
5758
[activeCssClass]="activeHighlightClass"
5859
[groupName]="gridID"

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,16 @@ describe('IgxGrid - Column properties #grid', () => {
126126
const grid = fix.componentInstance.grid;
127127
const formatter = fix.componentInstance.multiplier;
128128

129+
const boolFormatter = fix.componentInstance.boolFormatter;
130+
129131
expect(grid.columnList.first.formatter).toBeDefined();
130132

131133
for (let i = 0; i < 3; i++) {
132134
const cell = grid.gridAPI.get_cell_by_index(i, 'ID');
133135
expect(cell.nativeElement.textContent).toMatch(formatter(cell.value));
136+
137+
const cellBool = grid.gridAPI.get_cell_by_index(i, 'IsEmployed');
138+
expect(cellBool.nativeElement.textContent).toMatch(boolFormatter(cellBool.value));
134139
}
135140
});
136141

@@ -161,18 +166,18 @@ describe('IgxGrid - Column properties #grid', () => {
161166

162167
headers = fix.debugElement.queryAll(By.css(COLUMN_HEADER_CLASS));
163168
expect(headers[0].nativeElement.textContent).toMatch('ID');
164-
expect(headers[1].nativeElement.textContent).toMatch('Name');
169+
expect(headers[2].nativeElement.textContent).toMatch('Name');
165170

166171
// Swap columns
167172
grid.moveColumn(grid.columnList.first, grid.columnList.last);
168173
fix.detectChanges();
169174

170-
expect(grid.columnList.first.field).toMatch('Name');
175+
expect(grid.columnList.first.field).toMatch('IsEmployed');
171176
expect(grid.columnList.last.field).toMatch('ID');
172177

173178
headers = fix.debugElement.queryAll(By.css(COLUMN_HEADER_CLASS));
174-
expect(headers[0].nativeElement.textContent).toMatch('Name');
175-
expect(headers[1].nativeElement.textContent).toMatch('ID');
179+
expect(headers[0].nativeElement.textContent).toMatch('IsEmployed');
180+
expect(headers[1].nativeElement.textContent).toMatch('Name');
176181
});
177182

178183
it('should support adding and removing columns through a declared iterable', fakeAsync(/** columnList.changes rAF */() => {

projects/igniteui-angular/src/lib/grids/grid/expandable-cell.component.html

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<igx-chip *ngIf="displayPinnedChip" class="igx-grid__td--pinned-chip" [disabled]="true" [displayDensity]="'compact'">{{ grid.resourceStrings.igx_grid_pinned_row_indicator }}</igx-chip>
33
</ng-template>
44
<ng-template #defaultCell>
5-
<div igxTextHighlight class="igx-grid__td-text" style="pointer-events: none"
5+
<div *ngIf="column.dataType !== 'boolean' || (column.dataType === 'boolean' && this.formatter)"
6+
igxTextHighlight class="igx-grid__td-text" style="pointer-events: none"
67
[cssClass]="highlightClass"
78
[activeCssClass]="activeHighlightClass"
89
[groupName]="gridID"
@@ -13,18 +14,27 @@
1314
? (value | date:column.pipeArgs.format:column.pipeArgs.timezone:grid.locale)
1415
: column.dataType === 'currency'
1516
? (value | currency:currencyCode:column.pipeArgs.display:column.pipeArgs.digitsInfo:grid.locale)
16-
: column.dataType === 'percent' ? (value | percent:column.pipeArgs.digitsInfo:grid.locale) : value"
17+
: column.dataType === 'percent'
18+
? (value | percent:column.pipeArgs.digitsInfo:grid.locale)
19+
: value"
1720
[row]="rowData"
1821
[column]="this.column.field"
1922
[containerClass]="'igx-grid__td-text'"
2023
[metadata]="searchMetadata">{{ formatter ? (value | columnFormatter:formatter:rowData) : column.dataType === "number"
2124
? (value | number:column.pipeArgs.digitsInfo:grid.locale) : (column.dataType === 'date' || column.dataType === 'time' || column.dataType === 'dateTime')
2225
? (value | date:column.pipeArgs.format:column.pipeArgs.timezone:grid.locale) : column.dataType === 'currency'
2326
? (value | currency:currencyCode:column.pipeArgs.display:column.pipeArgs.digitsInfo:grid.locale) : column.dataType === 'percent'
24-
? (value | percent:column.pipeArgs.digitsInfo:grid.locale) : value }}</div>
27+
? (value | percent:column.pipeArgs.digitsInfo:grid.locale) : value}}</div>
28+
29+
<igx-icon
30+
*ngIf="column.dataType === 'boolean' && !this.formatter"
31+
[ngClass]="{ 'igx-icon--success': value, 'igx-icon--error': !value }"
32+
>{{ value ? "check" : "close" }}</igx-icon
33+
>
2534
</ng-template>
2635
<ng-template #addRowCell let-cell="cell">
27-
<div igxTextHighlight class="igx-grid__td-text" style="pointer-events: none"
36+
<div *ngIf="column.dataType !== 'boolean' || (column.dataType === 'boolean' && this.formatter)"
37+
igxTextHighlight class="igx-grid__td-text" style="pointer-events: none"
2838
[cssClass]="highlightClass"
2939
[activeCssClass]="activeHighlightClass"
3040
[groupName]="gridID"

0 commit comments

Comments
 (0)