Skip to content

Commit 2209237

Browse files
committed
Merge remote-tracking branch 'origin/master' into pivot-grid-master
2 parents 82a3c74 + dc629e2 commit 2209237

24 files changed

+296
-205
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
All notable changes for each version of this project will be documented in this file.
44

5+
## 13.0.0
6+
7+
### New Features
8+
- `IgxCsvExporterService`, `IgxExcelExporterService`
9+
- Exporter services are no longer required to be provided in the application since they are now injected on a root level.
10+
11+
## 12.2.1
12+
13+
### New Features
14+
- `igxGrid`, `igxHierarchicalGrid`, `igxTreeGrid`
15+
- new `rowPinned` event is emitted after a row is pinned/unpinned and grid has already refreshed its state to represent the pinned/unpinned rows in the DOM.
16+
517
## 12.2.0
618

719
### New Features

ROADMAP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
## Going down the road
1515

1616
1. Angular Pivot Grid [#5700](https://github.com/IgniteUI/igniteui-angular/issues/5700)
17-
2. Grid Cell Merging
17+
2. Grid Cell Merging [#3514](https://github.com/IgniteUI/igniteui-angular/issues/3514)
1818
3. PDF Export feature on Angular Grid [#5696](https://github.com/IgniteUI/igniteui-angular/issues/5696)
1919
4. Themes: Move code to Sass modules [#9554](https://github.com/IgniteUI/igniteui-angular/issues/9554)
2020
5. Themes: Split themes and aid with Grid refactoring [#9556](https://github.com/IgniteUI/igniteui-angular/issues/9556)

projects/igniteui-angular/src/lib/checkbox/checkbox.component.spec.ts

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, ViewChild } from '@angular/core';
22
import { fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
3-
import { FormsModule } from '@angular/forms';
3+
import { FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';
44
import { By } from '@angular/platform-browser';
55
import { IgxRippleModule } from '../directives/ripple/ripple.directive';
66
import { IgxCheckboxComponent } from './checkbox.component';
@@ -22,9 +22,10 @@ describe('IgxCheckbox', () => {
2222
CheckboxExternalLabelComponent,
2323
CheckboxInvisibleLabelComponent,
2424
CheckboxDisabledTransitionsComponent,
25+
CheckboxFormGroupComponent,
2526
IgxCheckboxComponent
2627
],
27-
imports: [FormsModule, IgxRippleModule, NoopAnimationsModule]
28+
imports: [FormsModule, ReactiveFormsModule, IgxRippleModule, NoopAnimationsModule]
2829
})
2930
.compileComponents();
3031
}));
@@ -34,7 +35,7 @@ describe('IgxCheckbox', () => {
3435
fixture.detectChanges();
3536

3637
const checkbox = fixture.componentInstance.cb;
37-
const nativeCheckbox = fixture.debugElement.query(By.css('input')).nativeElement;
38+
const nativeCheckbox = checkbox.nativeCheckbox.nativeElement;
3839
const nativeLabel = checkbox.nativeLabel.nativeElement;
3940
const placeholderLabel = fixture.debugElement.query(By.css('.igx-checkbox__label')).nativeElement;
4041

@@ -69,7 +70,7 @@ describe('IgxCheckbox', () => {
6970
fixture.detectChanges();
7071

7172
expect(nativeCheckbox.checked).toBe(false);
72-
expect(checkboxInstance.checked).toBe(false);
73+
expect(checkboxInstance.checked).toBe(null);
7374

7475
testInstance.subscribed = true;
7576
checkboxInstance.name = 'my-checkbox';
@@ -85,6 +86,22 @@ describe('IgxCheckbox', () => {
8586
expect(checkboxInstance.name).toEqual('my-checkbox');
8687
}));
8788

89+
it('Initializes with form group', () => {
90+
const fixture = TestBed.createComponent(CheckboxFormGroupComponent);
91+
fixture.detectChanges();
92+
93+
const testInstance = fixture.componentInstance;
94+
const checkboxInstance = testInstance.cb;
95+
const form = testInstance.myForm;
96+
97+
form.setValue({ checkbox: true });
98+
expect(checkboxInstance.checked).toBe(true);
99+
100+
form.reset();
101+
102+
expect(checkboxInstance.checked).toBe(null);
103+
});
104+
88105
it('Initializes with external label', () => {
89106
const fixture = TestBed.createComponent(CheckboxExternalLabelComponent);
90107
const checkboxInstance = fixture.componentInstance.cb;
@@ -197,7 +214,7 @@ describe('IgxCheckbox', () => {
197214
fixture.detectChanges();
198215

199216
// Should not update
200-
expect(checkboxInstance.checked).toBe(false);
217+
expect(checkboxInstance.checked).toBe(null);
201218
expect(testInstance.subscribed).toBe(false);
202219
});
203220

@@ -398,3 +415,14 @@ class CheckboxInvisibleLabelComponent {
398415
class CheckboxDisabledTransitionsComponent {
399416
@ViewChild('cb', { static: true }) public cb: IgxCheckboxComponent;
400417
}
418+
419+
@Component({
420+
template: `<form [formGroup]="myForm"><igx-checkbox #cb formControlName="checkbox">Form Group</igx-checkbox></form>`
421+
})
422+
class CheckboxFormGroupComponent {
423+
@ViewChild('cb', { static: true }) public cb: IgxCheckboxComponent;
424+
425+
public myForm = this.fb.group({ checkbox: [''] });
426+
427+
constructor(private fb: FormBuilder) {}
428+
}

projects/igniteui-angular/src/lib/checkbox/checkbox.component.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,7 @@ export class IgxCheckboxComponent implements ControlValueAccessor, EditorProvide
428428

429429
/** @hidden @internal */
430430
public writeValue(value: boolean) {
431-
if (typeof value === 'boolean') {
432-
this._checked = value;
433-
}
431+
this._checked = value;
434432
}
435433

436434
/** @hidden @internal */

projects/igniteui-angular/src/lib/dialog/dialog.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ describe('Dialog', () => {
345345
fix.detectChanges();
346346

347347
dialog.open();
348-
tick();
348+
tick(16);
349349
fix.detectChanges();
350350

351351
overlaydiv = document.getElementsByClassName(OVERLAY_MAIN_CLASS)[0];

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,9 @@
9191
</igx-input-group>
9292
</ng-container>
9393
<ng-container *ngIf="column.dataType === 'boolean'">
94-
<!-- The additional [checked] binding is needed as after the initial call of the checked getter
95-
it is never called again as no change detection is triggered in the grid after that, resulting in wrong
96-
rendered state of the checkbox. -->
9794
<igx-checkbox
98-
[(ngModel)]="editValue"
9995
[checked]="editValue"
96+
(change)="editValue = $event.checked"
10097
[igxFocus]="true"
10198
[disableRipple]="true"
10299
></igx-checkbox>

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

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ import {
5454
Action,
5555
} from '../services/public_api';
5656
import { GridBaseAPIService } from './api.service';
57-
import { IgxGridCellComponent } from './cell.component';
5857
import { IgxSummaryOperand, ISummaryExpression } from './summaries/grid-summary';
5958
import { RowEditPositionStrategy, IPinningConfig } from './grid.common';
6059
import { IgxGridToolbarComponent } from './toolbar/grid-toolbar.component';
@@ -941,6 +940,17 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
941940
@Output()
942941
public rowPinning = new EventEmitter<IPinRowEventArgs>();
943942

943+
/**
944+
* Emitted when the pinned state of a row is changed.
945+
*
946+
* @example
947+
* ```html
948+
* <igx-grid [data]="employeeData" (rowPinned)="rowPin($event)" [autoGenerate]="true"></igx-grid>
949+
* ```
950+
*/
951+
@Output()
952+
public rowPinned = new EventEmitter<IPinRowEventArgs>();
953+
944954
/**
945955
* Emmited when the active node is changed.
946956
*
@@ -4829,6 +4839,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
48294839
if (this._pinnedRecordIDs.indexOf(rowID) !== -1) {
48304840
return false;
48314841
}
4842+
48324843
const eventArgs: IPinRowEventArgs = {
48334844
insertAtIndex: index,
48344845
isPinned: true,
@@ -4843,8 +4854,10 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
48434854
this._pinnedRecordIDs.splice(insertIndex, 0, rowID);
48444855
this.pipeTrigger++;
48454856
if (this.gridAPI.grid) {
4846-
this.notifyChanges();
4857+
this.cdr.detectChanges();
4858+
this.rowPinned.emit(eventArgs);
48474859
}
4860+
48484861
return true;
48494862
}
48504863

@@ -4870,12 +4883,15 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
48704883
row
48714884
};
48724885
this.rowPinning.emit(eventArgs);
4886+
48734887
this.crudService.endEdit(false);
48744888
this._pinnedRecordIDs.splice(index, 1);
48754889
this.pipeTrigger++;
48764890
if (this.gridAPI.grid) {
48774891
this.cdr.detectChanges();
4892+
this.rowPinned.emit(eventArgs);
48784893
}
4894+
48794895
return true;
48804896
}
48814897

@@ -6923,16 +6939,21 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
69236939
const activeEl = this.selectionService.activeElement;
69246940

69256941
if (this.nativeElement.tagName.toLowerCase() === 'igx-hierarchical-grid') {
6926-
const expansionRowIndexes = Array.from(this.expansionStates.keys());
6942+
const expansionRowIndexes = [];
6943+
for (const [key, value] of this.expansionStates.entries()) {
6944+
if (value) {
6945+
expansionRowIndexes.push(key);
6946+
}
6947+
}
69276948
if (this.selectionService.selection.size > 0) {
69286949
if (expansionRowIndexes.length > 0) {
69296950
for (const [key, value] of this.selectionService.selection.entries()) {
69306951
let updatedKey = key;
69316952
expansionRowIndexes.forEach(row => {
69326953
let rowIndex;
6933-
if (row.ID) {
6954+
if (!isNaN(row.ID)) {
69346955
rowIndex = Number(row.ID);
6935-
}else {
6956+
} else {
69366957
rowIndex = Number(row);
69376958
}
69386959

projects/igniteui-angular/src/lib/grids/grid-public-row.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ abstract class BaseRow implements RowType {
211211
* ```
212212
*/
213213
public pin(): boolean {
214-
return this.grid.pinRow(this.key);
214+
return this.grid.pinRow(this.key, this.index);
215215
}
216216

217217
/**

0 commit comments

Comments
 (0)