Skip to content

Commit 39a2bea

Browse files
authored
Merge branch '7.3.x' into PMiteva/fix-drag-indicator-tmp
2 parents 961875d + c8058c3 commit 39a2bea

File tree

9 files changed

+71
-9
lines changed

9 files changed

+71
-9
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@
128128
@extend %grid-row--mrl !optional;
129129
}
130130

131+
@include e(tr, $mods: (mrl, edit)) {
132+
@extend %grid-row--edit-mrl !optional;
133+
}
134+
131135
@include e(summaries) {
132136
@extend %grid-summaries !optional;
133137

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,9 @@
708708
}
709709

710710
%grid-row--mrl {
711-
border-bottom: none !important;
711+
&%grid-row {
712+
border-bottom-color: transparent;
713+
}
712714

713715
%grid__cbx-selection,
714716
%igx-grid__row-indentation,
@@ -907,6 +909,10 @@
907909
background: --var($theme, 'edit-mode-color');
908910
}
909911

912+
&%grid-row {
913+
border-bottom: 1px solid --var($theme, 'edit-mode-color');
914+
}
915+
910916
%igx-grid__td--editing {
911917
border: none;
912918

@@ -920,6 +926,13 @@
920926
}
921927
}
922928

929+
%grid-row--edit-mrl {
930+
&:first-of-type::after {
931+
top: 0;
932+
z-index: 5;
933+
}
934+
}
935+
923936
%igx-grid__tr--edited {
924937
&::before {
925938
content: '';

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ export class IgxDialogComponent implements IToggleView, OnInit, OnDestroy, After
259259
public onRightButtonSelect = new EventEmitter<IDialogEventArgs>();
260260

261261
private _animaitonSettings: PositionSettings = {
262-
openAnimation: useAnimation(slideInBottom, {params: {fromPosition: 'translateY(100%)'}}),
263-
closeAnimation: useAnimation(slideOutTop, {params: {toPosition: 'translateY(-100%)'}})
262+
openAnimation: useAnimation(slideInBottom, { params: { fromPosition: 'translateY(100%)' } }),
263+
closeAnimation: useAnimation(slideOutTop, { params: { toPosition: 'translateY(-100%)' } })
264264
};
265265

266266
private _overlayDefaultSettings: OverlaySettings;
@@ -391,6 +391,9 @@ export class IgxDialogComponent implements IToggleView, OnInit, OnDestroy, After
391391
public open(overlaySettings: OverlaySettings = this._overlayDefaultSettings) {
392392
this.toggleRef.open(overlaySettings);
393393
this.onOpen.emit({ dialog: this, event: null });
394+
if (!this.leftButtonLabel && !this.rightButtonLabel) {
395+
this.toggleRef.element.focus();
396+
}
394397
}
395398

396399
/**

projects/igniteui-angular/src/lib/drop-down/drop-down-item.component.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,12 @@ export class IgxDropDownItemComponent extends IgxDropDownItemBase implements DoC
8383
this.dropDown.selectItem(this, event);
8484
}
8585
}
86+
87+
/**
88+
* @hidden @internal
89+
*/
90+
@HostListener('mousedown', ['$event'])
91+
mousedownHandler(event) {
92+
event.preventDefault();
93+
}
8694
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,11 +591,14 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
591591
/**
592592
* Sets whether rows can be edited.
593593
* ```html
594-
* <igx-grid #grid [showToolbar]="true" [rowEditable]="true" [columnHiding]="true"></igx-grid>
594+
* <igx-grid #grid [showToolbar]="true" [rowEditable]="true" [primaryKey]="'ProductID'" [columnHiding]="true"></igx-grid>
595595
* ```
596596
* @memberof IgxGridBaseComponent
597597
*/
598598
set rowEditable(val: boolean) {
599+
if (val && (this.primaryKey === undefined || this.primaryKey === null)) {
600+
console.warn('The grid must have a `primaryKey` specified when using `rowEditable`!');
601+
}
599602
this._rowEditable = val;
600603
if (this.gridAPI.grid) {
601604
this.refreshGridState();

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,6 +1342,36 @@ describe('IgxGrid Component Tests', () => {
13421342
}));
13431343

13441344
describe('Row Editing - General tests', () => {
1345+
it('Should throw a warning when [rowEditable] is set on a grid w/o [primaryKey]', fakeAsync(() => {
1346+
const fix = TestBed.createComponent(IgxGridRowEditingComponent);
1347+
fix.detectChanges();
1348+
const grid = fix.componentInstance.grid;
1349+
grid.primaryKey = null;
1350+
grid.rowEditable = false;
1351+
tick();
1352+
fix.detectChanges();
1353+
1354+
spyOn(console, 'warn');
1355+
grid.rowEditable = true;
1356+
tick();
1357+
fix.detectChanges();
1358+
expect(console.warn).toHaveBeenCalledWith('The grid must have a `primaryKey` specified when using `rowEditable`!');
1359+
expect(console.warn).toHaveBeenCalledTimes(1);
1360+
// Throws warinig but still sets the property correctly
1361+
expect(grid.rowEditable).toBeTruthy();
1362+
1363+
tick();
1364+
fix.detectChanges();
1365+
grid.primaryKey = 'ProductID';
1366+
grid.rowEditable = false;
1367+
tick();
1368+
fix.detectChanges();
1369+
grid.rowEditable = true;
1370+
tick();
1371+
fix.detectChanges();
1372+
expect(console.warn).toHaveBeenCalledTimes(1);
1373+
expect(grid.rowEditable).toBeTruthy();
1374+
}));
13451375
it('Should be able to enter edit mode on dblclick, enter and f2', fakeAsync(() => {
13461376
const fix = TestBed.createComponent(IgxGridRowEditingComponent);
13471377
fix.detectChanges();

projects/igniteui-angular/src/lib/grids/grid/grid.multi-row-layout.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ describe('IgxGrid - multi-row-layout', () => {
10911091
expect(lastRow.element.nativeElement.getBoundingClientRect().bottom).toBe(grid.tbody.nativeElement.getBoundingClientRect().bottom);
10921092

10931093
// check size is correct
1094-
expect(grid.verticalScrollContainer.getSizeAt(lastIndex)).toBe(150);
1094+
expect(grid.verticalScrollContainer.getSizeAt(lastIndex)).toBe(151);
10951095

10961096
// check DOM
10971097
const lastRowCells = lastRow.cells.toArray();

projects/igniteui-angular/src/lib/grids/grid/row-drag.directive.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,7 @@ describe('IgxGrid - Row Drag Tests', () => {
863863
<igx-grid #grid
864864
[width]='width'
865865
[height]='height'
866+
primaryKey="ID"
866867
[data]="data"
867868
[autoGenerate]="true" (onColumnInit)="columnsCreated($event)" (onGroupingDone)="onGroupingDoneHandler($event)"
868869
[rowEditable]="true" [rowDraggable]="enableRowDraggable"
@@ -916,7 +917,7 @@ export class IgxGridRowDraggableComponent extends DataParent {
916917
[width]="'800px'"
917918
[height]="'300px'"
918919
[data]="data"
919-
[primaryKey]="'ID'"
920+
primaryKey="ID"
920921
[autoGenerate]="true" (onGroupingDone)="onGroupingDoneHandler($event)"
921922
[rowEditable]="true" [rowDraggable]="true"
922923
>

src/app/grid-multi-row-layout/grid-mrl.sample.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="sample-wrapper">
22
<app-page-header title="Grid MRL"></app-page-header>
33
<section style="height: 800px" class="sample-content">
4-
<igx-grid [rowSelectable]="true" #grid [data]="data" displayDensity="compact" [width]="'100%'" [showToolbar]='true' [columnHiding]='true'>
4+
<igx-grid [rowEditable]="true" [primaryKey]="'PostalCode'" [rowSelectable]="true" #grid [data]="data" displayDensity="compact" [width]="'100%'" [showToolbar]='true' [columnHiding]='true'>
55
<igx-column-layout [movable]="false" [pinned]="true" field='group1'>
66
<igx-column [rowStart]="1" [colStart]="1" [colEnd]="5" field="ContactName"></igx-column>
77
<igx-column [rowStart]="1" [colStart]="5" field="ContactTitle"></igx-column>
@@ -13,8 +13,8 @@
1313
<igx-column [rowStart]="3" [colStart]="2" field="PostalCode"></igx-column>
1414
<igx-column [rowStart]="3" [colStart]="3" [colEnd]="7" field="Fax"></igx-column>
1515
</igx-column-layout>
16-
<igx-column-layout [movable]="false" [pinned]="false" field='group2'>
17-
<igx-column [rowStart]="1" [colStart]="1" [movable]="false" [pinned]="false" sortable="true" field="ContactName" [width]='"500px"'></igx-column>
16+
<igx-column-layout [movable]="false" [pinned]="true" field='group2'>
17+
<igx-column [rowStart]="1" [colStart]="1" [movable]="false" sortable="true" field="ContactName" [width]='"500px"'></igx-column>
1818
<igx-column [rowStart]="1" [colStart]="2" [movable]="false" sortable="true" field="ContactTitle" [width]='"200px"'></igx-column>
1919
<igx-column [rowStart]="1" [colStart]="3" [movable]="false" sortable="true" field="Country" [width]='"150px"'></igx-column>
2020
<igx-column [rowStart]="1" [colStart]="4" [movable]="false" sortable="true" field="Phone" [width]='"150px"'></igx-column>

0 commit comments

Comments
 (0)