Skip to content

Commit 0c7ad50

Browse files
authored
Merge branch 'master' into simeonoff/merge-sassdocs
2 parents a598262 + b08e01c commit 0c7ad50

File tree

9 files changed

+241
-138
lines changed

9 files changed

+241
-138
lines changed

projects/igniteui-angular/src/lib/action-strip/action-strip.component.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,24 @@ export class IgxActionStripComponent extends DisplayDensityBase implements After
134134
return this._resourceStrings;
135135
}
136136

137+
/**
138+
* Hide or not the Action Strip based on if it is a menu.
139+
*
140+
* @hidden
141+
* @internal
142+
*/
143+
public get hideOnRowLeave(): boolean{
144+
if(this.menu.items.length === 0){
145+
return true;
146+
}else if(this.menu.items.length > 0){
147+
if(this.menu.collapsed){
148+
return true;
149+
}else{
150+
return false;
151+
}
152+
}
153+
}
154+
137155
/**
138156
* Reference to the menu
139157
*

projects/igniteui-angular/src/lib/action-strip/grid-actions/grid-editing-actions.component.spec.ts

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ describe('igxGridEditingActions #grid ', () => {
2929
IgxActionStripPinEditComponent,
3030
IgxActionStripEditMenuComponent,
3131
IgxHierarchicalGridActionStripComponent,
32-
IgxTreeGridEditActionsComponent
32+
IgxTreeGridEditActionsComponent,
33+
IgxActionStripOneRowComponent,
34+
IgxActionStripMenuOneRowComponent
3335
],
3436
imports: [
3537
NoopAnimationsModule,
@@ -153,6 +155,28 @@ describe('igxGridEditingActions #grid ', () => {
153155

154156
expect(grid.rowList.first.data['ID']).toBe('ANATR');
155157
});
158+
it('should not auto-hide on mouse leave of row if action strip is menu', () => {
159+
fixture = TestBed.createComponent(IgxActionStripMenuOneRowComponent);
160+
fixture.detectChanges();
161+
actionStrip = fixture.componentInstance.actionStrip;
162+
grid = fixture.componentInstance.grid;
163+
164+
const row = grid.getRowByIndex(0);
165+
row.pin();
166+
const rowElem = grid.pinnedRows[0];
167+
row.unpin();
168+
169+
actionStrip.show(row);
170+
fixture.detectChanges();
171+
172+
actionStrip.menu.open();
173+
fixture.detectChanges();
174+
175+
UIInteractions.simulateMouseEvent('mouseleave', rowElem.element.nativeElement, 0, 200);
176+
fixture.detectChanges();
177+
178+
expect(actionStrip.hidden).toBeFalse();
179+
});
156180
});
157181

158182
describe('integration with pinning actions ', () => {
@@ -191,6 +215,25 @@ describe('igxGridEditingActions #grid ', () => {
191215
expect(actionStrip.context).toBe(row);
192216
expect(actionStrip.hidden).toBeFalse();
193217
});
218+
it('should auto-hide on mouse leave of row.', async () => {
219+
fixture = TestBed.createComponent(IgxActionStripOneRowComponent);
220+
fixture.detectChanges();
221+
actionStrip = fixture.componentInstance.actionStrip;
222+
grid = fixture.componentInstance.grid;
223+
224+
const row = grid.getRowByIndex(0);
225+
row.pin();
226+
const rowElem = grid.pinnedRows[0];
227+
228+
actionStrip.show(row);
229+
fixture.detectChanges();
230+
231+
expect(actionStrip.hidden).toBeFalse();
232+
UIInteractions.simulateMouseEvent('mouseleave', rowElem.element.nativeElement, 0, 200);
233+
fixture.detectChanges();
234+
235+
expect(actionStrip.hidden).toBeTrue();
236+
});
194237
it('should auto-hide on mouse leave of grid.', () => {
195238
const row = grid.getRowByIndex(0);
196239
actionStrip.show(row);
@@ -329,6 +372,7 @@ class IgxActionStripTestingComponent implements OnInit {
329372
public grid: IgxGridComponent;
330373

331374
private data: any[];
375+
private dataOneRow: any[];
332376
private columns: any[];
333377

334378
public ngOnInit() {
@@ -377,6 +421,10 @@ class IgxActionStripTestingComponent implements OnInit {
377421
{ ID: 'FRANS', CompanyName: 'Franchi S.p.A.', ContactName: 'Paolo Accorti', ContactTitle: 'Sales Representative', Address: 'Via Monte Bianco 34', City: 'Torino', Region: null, PostalCode: '10100', Country: 'Italy', Phone: '011-4988260', Fax: '011-4988261' }
378422
];
379423
/* eslint-enable max-len */
424+
425+
this.dataOneRow = [
426+
{ ID: 'ALFKI', CompanyName: 'Alfreds Futterkiste', ContactName: 'Maria Anders', ContactTitle: 'Sales Representative', Address: 'Obere Str. 57', City: 'Berlin', Region: null, PostalCode: '12209', Country: 'Germany', Phone: '030-0074321', Fax: '030-0076545' },
427+
];
380428
}
381429
}
382430

@@ -414,3 +462,38 @@ class IgxActionStripPinEditComponent extends IgxActionStripTestingComponent {
414462
})
415463
class IgxActionStripEditMenuComponent extends IgxActionStripTestingComponent {
416464
}
465+
466+
@Component({
467+
template: `
468+
<igx-grid #grid [data]="dataOneRow" [width]="'800px'" [height]="'500px'"
469+
[rowEditable]="true" [primaryKey]="'ID'">
470+
<igx-column *ngFor="let c of columns" [sortable]="true" [field]="c.field" [header]="c.field"
471+
[width]="c.width" [pinned]='c.pinned' [hidden]='c.hidden'>
472+
</igx-column>
473+
474+
<igx-action-strip #actionStrip>
475+
<igx-grid-pinning-actions></igx-grid-pinning-actions>
476+
<igx-grid-editing-actions></igx-grid-editing-actions>
477+
</igx-action-strip>
478+
</igx-grid>
479+
`
480+
})
481+
class IgxActionStripOneRowComponent extends IgxActionStripTestingComponent {
482+
}
483+
484+
@Component({
485+
template: `
486+
<igx-grid #grid [data]="dataOneRow" [width]="'800px'" [height]="'500px'"
487+
[rowEditable]="true" [primaryKey]="'ID'">
488+
<igx-column *ngFor="let c of columns" [sortable]="true" [field]="c.field" [header]="c.field"
489+
[width]="c.width" [pinned]='c.pinned' [hidden]='c.hidden'>
490+
</igx-column>
491+
492+
<igx-action-strip #actionStrip>
493+
<igx-grid-editing-actions [asMenuItems]='true'></igx-grid-editing-actions>
494+
</igx-action-strip>
495+
</igx-grid>
496+
`
497+
})
498+
class IgxActionStripMenuOneRowComponent extends IgxActionStripTestingComponent {
499+
}

projects/igniteui-angular/src/lib/directives/autocomplete/autocomplete.directive.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,14 @@ describe('IgxAutocomplete', () => {
781781
fixture.detectChanges();
782782
expect(input.nativeElement.attributes['aria-expanded'].value).toEqual('false');
783783
}));
784+
it('Should accept Japanese input', fakeAsync(() => {
785+
UIInteractions.setInputElementValue(input, '東京', fixture);
786+
fixture.detectChanges();
787+
tick();
788+
UIInteractions.triggerKeyDownEvtUponElem('enter', input.nativeElement, true);
789+
fixture.detectChanges();
790+
expect(input.value).toBe('東京');
791+
}));
784792
});
785793
describe('Positioning settings tests', () => {
786794
it('Panel settings - direction and startPoint: top', fakeAsync(() => {

projects/igniteui-angular/src/lib/directives/autocomplete/autocomplete.directive.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ export class IgxAutocompleteDirective extends IgxDropDownItemNavigationDirective
211211
return 'list';
212212
}
213213

214+
protected _composing: boolean;
214215
protected id: string;
215216
protected get model() {
216217
return this.ngModel || this.formControl;
@@ -234,6 +235,20 @@ export class IgxAutocompleteDirective extends IgxDropDownItemNavigationDirective
234235
this.open();
235236
}
236237

238+
/** @hidden @internal */
239+
@HostListener('compositionstart')
240+
public onCompositionStart(): void {
241+
if (!this._composing) {
242+
this._composing = true;
243+
}
244+
}
245+
246+
/** @hidden @internal */
247+
@HostListener('compositionend')
248+
public onCompositionEnd(): void {
249+
this._composing = false;
250+
}
251+
237252
/** @hidden @internal */
238253
@HostListener('keydown.ArrowDown', ['$event'])
239254
@HostListener('keydown.Alt.ArrowDown', ['$event'])
@@ -253,7 +268,7 @@ export class IgxAutocompleteDirective extends IgxDropDownItemNavigationDirective
253268

254269
/** @hidden @internal */
255270
public handleKeyDown(event) {
256-
if (!this.collapsed) {
271+
if (!this.collapsed && !this._composing) {
257272
switch (event.key.toLowerCase()) {
258273
case 'space':
259274
case 'spacebar':

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { configureTestSuite } from '../../test-utils/configure-suite';
2-
import { TestBed, tick, fakeAsync, ComponentFixture } from '@angular/core/testing';
2+
import { TestBed, tick, fakeAsync, ComponentFixture, waitForAsync } from '@angular/core/testing';
33
import { By } from '@angular/platform-browser';
44
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
55
import { IgxHierarchicalGridModule } from './public_api';
@@ -32,21 +32,23 @@ describe('IgxHierarchicalGrid Integration #hGrid', () => {
3232
const FILTERING_ROW_CLASS = 'igx-grid-filtering-row';
3333
const FILTERING_CELL_CLASS = 'igx-grid-filtering-cell';
3434

35-
configureTestSuite((() => {
35+
configureTestSuite();
36+
37+
beforeAll(waitForAsync(() => {
3638
TestBed.configureTestingModule({
3739
declarations: [
3840
IgxHierarchicalGridTestBaseComponent,
3941
IgxHierarchicalGridTestCustomToolbarComponent,
4042
IgxHierarchicalGridWithTransactionProviderComponent
4143
],
4244
imports: [
43-
NoopAnimationsModule, IgxHierarchicalGridModule, IgxIconModule]
44-
});
45-
}));
45+
NoopAnimationsModule, IgxHierarchicalGridModule, IgxIconModule
46+
]
47+
}).compileComponents();
48+
}))
4649

47-
beforeEach(fakeAsync(() => {
50+
beforeEach(waitForAsync(() => {
4851
fixture = TestBed.createComponent(IgxHierarchicalGridTestBaseComponent);
49-
tick();
5052
fixture.detectChanges();
5153
hierarchicalGrid = fixture.componentInstance.hgrid;
5254
}));
@@ -894,6 +896,7 @@ describe('IgxHierarchicalGrid Integration #hGrid', () => {
894896
const FIXED_ROW_CONTAINER = '.igx-grid__tr--pinned';
895897
const FIXED_ROW_CONTAINER_TOP = 'igx-grid__tr--pinned-top';
896898
const FIXED_ROW_CONTAINER_BOTTOM = 'igx-grid__tr--pinned-bottom';
899+
897900
beforeEach(() => {
898901
hierarchicalGrid.width = '800px';
899902
hierarchicalGrid.height = '500px';

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

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,21 @@ describe('IgxHierarchicalGrid Navigation', () => {
2323
let baseHGridContent: DebugElement;
2424
configureTestSuite();
2525

26+
beforeAll(waitForAsync(() => {
27+
TestBed.configureTestingModule({
28+
declarations: [
29+
IgxHierarchicalGridTestBaseComponent,
30+
IgxHierarchicalGridTestComplexComponent,
31+
IgxHierarchicalGridMultiLayoutComponent,
32+
IgxHierarchicalGridSmallerChildComponent
33+
],
34+
imports: [
35+
NoopAnimationsModule, IgxHierarchicalGridModule
36+
]
37+
}).compileComponents();
38+
}));
39+
2640
describe('IgxHierarchicalGrid Basic Navigation #hGrid', () => {
27-
beforeAll(waitForAsync(() => {
28-
TestBed.configureTestingModule({
29-
declarations: [
30-
IgxHierarchicalGridTestBaseComponent
31-
],
32-
imports: [
33-
NoopAnimationsModule, IgxHierarchicalGridModule
34-
]
35-
}).compileComponents();
36-
}));
3741

3842
beforeEach(waitForAsync(() => {
3943
fixture = TestBed.createComponent(IgxHierarchicalGridTestBaseComponent);
@@ -630,16 +634,6 @@ describe('IgxHierarchicalGrid Navigation', () => {
630634

631635

632636
describe('IgxHierarchicalGrid Complex Navigation #hGrid', () => {
633-
beforeAll(waitForAsync(() => {
634-
TestBed.configureTestingModule({
635-
declarations: [
636-
IgxHierarchicalGridTestComplexComponent
637-
],
638-
imports: [
639-
NoopAnimationsModule, IgxHierarchicalGridModule
640-
]
641-
}).compileComponents();
642-
}));
643637

644638
beforeEach(waitForAsync(() => {
645639
fixture = TestBed.createComponent(IgxHierarchicalGridTestComplexComponent);
@@ -753,16 +747,6 @@ describe('IgxHierarchicalGrid Navigation', () => {
753747
});
754748

755749
describe('IgxHierarchicalGrid sibling row islands Navigation #hGrid', () => {
756-
beforeAll(waitForAsync(() => {
757-
TestBed.configureTestingModule({
758-
declarations: [
759-
IgxHierarchicalGridMultiLayoutComponent
760-
],
761-
imports: [
762-
NoopAnimationsModule, IgxHierarchicalGridModule
763-
]
764-
}).compileComponents();
765-
}));
766750

767751
beforeEach(waitForAsync(() => {
768752
fixture = TestBed.createComponent(IgxHierarchicalGridMultiLayoutComponent);
@@ -884,16 +868,6 @@ describe('IgxHierarchicalGrid Navigation', () => {
884868
});
885869

886870
describe('IgxHierarchicalGrid Smaller Child Navigation #hGrid', () => {
887-
beforeAll(waitForAsync(() => {
888-
TestBed.configureTestingModule({
889-
declarations: [
890-
IgxHierarchicalGridSmallerChildComponent
891-
],
892-
imports: [
893-
NoopAnimationsModule, IgxHierarchicalGridModule
894-
]
895-
}).compileComponents();
896-
}));
897871

898872
beforeEach(waitForAsync(() => {
899873
fixture = TestBed.createComponent(IgxHierarchicalGridSmallerChildComponent);

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,17 @@ export class IgxRowDirective implements DoCheck, AfterViewInit, OnDestroy {
413413
}
414414
}
415415

416+
/**
417+
* @hidden
418+
* @internal
419+
*/
420+
@HostListener('mouseleave')
421+
public hideActionStrip() {
422+
if (this.grid.actionStrip && this.grid.actionStrip.hideOnRowLeave) {
423+
this.grid.actionStrip.hide();
424+
}
425+
}
426+
416427
/**
417428
* @hidden
418429
* @internal

0 commit comments

Comments
 (0)