Skip to content

Commit aab8776

Browse files
authored
Merge branch 'master' into vslavov/combo-ivy-renderer
2 parents a9b722c + aa19538 commit aab8776

File tree

6 files changed

+683
-468
lines changed

6 files changed

+683
-468
lines changed

CHANGELOG.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

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

5+
56
## 9.0.0
67

78
### General
@@ -16,14 +17,22 @@ All notable changes for each version of this project will be documented in this
1617
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
1718
- **Behavioral Change** - Pinning columns is no longer automatically prevented when the pinning area would exceed the size of the grid.
1819

20+
21+
## 8.2.6
22+
23+
### New Features
24+
- `IgxSelectItem`
25+
- `text` input is added. By default, the Select component will display the selected item's element inner text. In cases with a more complex item template, where more than just text interpolation is used, set the text property to specify what to display in the select field when the item is selected.
26+
27+
1928
## 8.2.4
2029
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
2130
- The header text of the columns and the column groups now has the `title` attribute set to it in order to expose a native browser tooltip.
2231

2332
### RTL Support
24-
Most of the components in the framework now have full right-to-left (RTL) support via the newly included RTL themes.
33+
Most of the components in the framework now have full right-to-left (RTL) support via the newly included RTL themes.
2534

26-
For CSS-based projects add `node_modules/igniteui-angular/styles/igniteui-angular-rtl.css` to your angular.json styles collection.
35+
For CSS-based projects add `node_modules/igniteui-angular/styles/igniteui-angular-rtl.css` to your angular.json styles collection.
2736

2837
For Sass-based projects pass `$direction` to the `igx-core` mixin in your root stylesheet.
2938

@@ -39,7 +48,7 @@ Currently the following components have only partial RTL support:
3948
- Circular Progress Indicator (igx-circular-bar)
4049

4150
We plan on adding support for the aforementioned components in the upcoming releases.
42-
51+
4352
### New Features
4453

4554
- Columns now expose the `cellStyles` property which allows conditional styling of the column cells. Similar to `cellClasses` it accepts an object literal where the keys are style properties and the values are expressions for evaluation.
@@ -61,6 +70,20 @@ The callback signature for both `cellStyles` and `cellClasses` is now changed to
6170

6271
- `IgxChip`
6372
- **Breaking Change** The `originalEvent` property for the events `onMoveStart`, `onMoveEnd`, `onClick` and `onSelection` now provides the events, passed from the `igxDrag` directive. The passed original events are in other words the previous events that triggered the `igxChip` ones. They also have original events until a browser event is reached.
73+
- `IgxGrid` - Now you can access all grid data inside the custom column summary. Two additional optional parameters are introduced in the IgxSummaryOperand `operate` method.
74+
75+
```typescript
76+
class MySummary extends IgxNumberSummaryOperand {
77+
constructor() {
78+
super();
79+
}
80+
operate(columnData: any[], allGridData = [], fieldName?): IgxSummaryResult[] {
81+
const result = super.operate(allData.map(r => r[fieldName]));
82+
result.push({ key: 'test', label: 'Total Discounted', summaryResult: allData.filter((rec) => rec.Discontinued).length });
83+
return result;
84+
}
85+
}
86+
```
6487

6588
## 8.2.0
6689
### New theme

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,8 @@ export class GridBaseAPIService <T extends IgxGridBaseDirective & GridType> {
198198
row.data = { ...row.data, ...rowInEditMode.transactionState };
199199
// TODO: Workaround for updating a row in edit mode through the API
200200
} else if (this.grid.transactions.enabled) {
201-
const lastCommitedValue = grid.transactions.getState(row.id) ?
202-
grid.transactions.getState(row.id).value : null;
203-
row.data = lastCommitedValue ? Object.assign(row.data, lastCommitedValue) : row.data;
201+
const state = grid.transactions.getState(row.id);
202+
row.data = state ? Object.assign({}, row.data, state.value) : row.data;
204203
}
205204
}
206205

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3839,7 +3839,13 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
38393839
}
38403840
const row = new IgxRow(rowSelector, -1, this.gridAPI.getRowData(rowSelector));
38413841
this.gridAPI.update_row(row, value);
3842-
this.cdr.detectChanges();
3842+
3843+
// TODO: fix for #5934 and probably break for #5763
3844+
// consider adding of third optional boolean parameter in updateRow.
3845+
// If developer set this parameter to true we should call notifyChanges(true), and
3846+
// vise-versa if developer set it to false we should call notifyChanges(false).
3847+
// The parameter should default to false
3848+
this.notifyChanges();
38433849
}
38443850
}
38453851

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,44 @@ describe('IgxGrid - Cell Editing #grid', () => {
694694
expect(cell.value).toEqual('New Name');
695695
});
696696

697+
it(`Should not update data in grid with transactions, when row is updated in onCellEdit and onCellEdit is canceled`, () => {
698+
fixture = TestBed.createComponent(SelectionWithTransactionsComponent);
699+
fixture.detectChanges();
700+
grid = fixture.componentInstance.grid;
701+
702+
grid.primaryKey = 'ID';
703+
fixture.detectChanges();
704+
705+
// update the cell value via updateRow and cancel the event
706+
grid.onCellEdit.subscribe((e: IGridEditEventArgs) => {
707+
const rowIndex: number = e.cellID.rowIndex;
708+
const row = grid.getRowByIndex(rowIndex);
709+
grid.updateRow({[row.columns[e.cellID.columnID].field]: e.newValue}, row.rowID);
710+
e.cancel = true;
711+
});
712+
713+
const cell = grid.getCellByColumn(0, 'Name');
714+
const initialValue = cell.value;
715+
const firstNewValue = 'New Value';
716+
const secondNewValue = 'Very New Value';
717+
718+
cell.update(firstNewValue);
719+
fixture.detectChanges();
720+
expect(cell.value).toBe(firstNewValue);
721+
722+
cell.update(secondNewValue);
723+
fixture.detectChanges();
724+
expect(cell.value).toBe(secondNewValue);
725+
726+
grid.transactions.undo();
727+
fixture.detectChanges();
728+
expect(cell.value).toBe(firstNewValue);
729+
730+
grid.transactions.undo();
731+
fixture.detectChanges();
732+
expect(cell.value).toBe(initialValue);
733+
});
734+
697735
it(`Should properly emit 'onCellEditCancel' event`, () => {
698736
spyOn(grid.onCellEditCancel, 'emit').and.callThrough();
699737
const cell = grid.getCellByColumn(0, 'fullName');

projects/igniteui-angular/src/lib/select/select-item.component.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,42 @@
11
import { IgxDropDownItemComponent } from './../drop-down/drop-down-item.component';
2-
import { Component, DoCheck } from '@angular/core';
2+
import { Component, DoCheck, Input } from '@angular/core';
33

44
@Component({
55
selector: 'igx-select-item',
66
template: '<ng-content></ng-content>'
77
})
88
export class IgxSelectItemComponent extends IgxDropDownItemComponent implements DoCheck {
99

10+
private _text: any;
11+
12+
/**
13+
* An @Input property that gets/sets the item's text to be displayed in the select component's input when the item is selected.
14+
*
15+
* ```typescript
16+
* //get
17+
* let mySelectedItem = this.dropDown.selectedItem;
18+
* let selectedItemText = mySelectedItem.text;
19+
* ```
20+
21+
* ```html
22+
* // set
23+
* <igx-select-item [text]="'London'"></igx-select-item>
24+
* ```
25+
*/
26+
@Input()
27+
public get text(): string {
28+
return this._text;
29+
}
30+
31+
public set text(text: string) {
32+
this._text = text;
33+
}
34+
1035
/** @hidden @internal */
1136
public get itemText() {
37+
if (this._text !== undefined) {
38+
return this._text;
39+
}
1240
return this.elementRef.nativeElement.innerText.trim();
1341
}
1442

0 commit comments

Comments
 (0)