Skip to content

Commit 73584f5

Browse files
authored
Merge branch '8.1.x' into nrobakova/fix-issue-5763-81
2 parents 187f4be + cd309bf commit 73584f5

File tree

8 files changed

+85
-12
lines changed

8 files changed

+85
-12
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ export class IgxButtonGroupComponent extends DisplayDensityBase implements After
7878
@Input()
7979
public id = `igx-buttongroup-${NEXT_ID++}`;
8080

81+
/**
82+
* @hidden
83+
*/
84+
@HostBinding('style.zIndex')
85+
public zIndex = 0;
86+
8187
/**
8288
* Allows you to set a style using the `itemContentCssClass` input.
8389
* The value should be the CSS class name that will be applied to the button group.
@@ -251,7 +257,7 @@ export class IgxButtonGroupComponent extends DisplayDensityBase implements After
251257

252258
constructor(private _cdr: ChangeDetectorRef, private _renderer: Renderer2,
253259
@Optional() @Inject(DisplayDensityToken) protected _displayDensityOptions: IDisplayDensityOptions) {
254-
super(_displayDensityOptions);
260+
super(_displayDensityOptions);
255261
}
256262

257263
/**
@@ -360,7 +366,7 @@ export class IgxButtonGroupComponent extends DisplayDensityBase implements After
360366
* @hidden
361367
*/
362368
public ngAfterContentInit() {
363-
this.templateButtons.forEach( (button) => {
369+
this.templateButtons.forEach((button) => {
364370
if (!button.initialDensity) {
365371
button.displayDensity = this.displayDensity;
366372
}
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
<div class="igx-button-group" role="group" [class.igx-button-group--vertical]="isVertical">
2-
<span *ngFor="let button of values; let i = 'index'" type="button" igxButton="flat" [displayDensity]="displayDensity" [selected]="button.selected"
3-
[attr.data-togglable]="button.togglable" [disabled]="disabled || button.disabled" [igxButtonColor]="button.color"
4-
[igxButtonBackground]="button.bgcolor" [igxLabel]="button.label" [igxRipple]="button.ripple">
2+
<button *ngFor="let button of values; let i = 'index'"
3+
type="button"
4+
igxButton="flat"
5+
[displayDensity]="displayDensity"
6+
[selected]="button.selected"
7+
[attr.data-togglable]="button.togglable"
8+
[disabled]="disabled || button.disabled"
9+
[igxButtonColor]="button.color"
10+
[igxButtonBackground]="button.bgcolor"
11+
[igxLabel]="button.label"
12+
[igxRipple]="button.ripple"
13+
>
514
<div class="igx-button-group__item-content {{ itemContentCssClass }}">
615
<igx-icon *ngIf="button.icon" fontSet="material">{{button.icon}}</igx-icon>
716
<span *ngIf="button.label">{{button.label}}</span>
817
</div>
9-
</span>
18+
</button>
1019
<ng-content></ng-content>
1120
</div>

projects/igniteui-angular/src/lib/buttonGroup/buttongroup.component.spec.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,25 @@ describe('IgxButtonGroup', () => {
232232
expect(groupChildren[1].element.nativeElement.classList.contains('igx-button--cosy')).toBe(true, 'Missing density class!');
233233
});
234234

235+
it('Button Group - should support tab navigation', () => {
236+
const fixture = TestBed.createComponent(InitButtonGroupWithValuesComponent);
237+
fixture.detectChanges();
238+
239+
const buttongroup = fixture.componentInstance.buttonGroup;
240+
const groupChildren = buttongroup.buttons;
241+
242+
for (let i = 0; i < groupChildren.length; i++) {
243+
const button = groupChildren[i];
244+
expect(button.nativeElement.tagName).toBe('BUTTON');
245+
246+
if (i < groupChildren.length - 1) {
247+
expect(button.nativeElement.disabled).toBe(false);
248+
} else {
249+
expect(button.nativeElement.disabled).toBe(true);
250+
}
251+
}
252+
});
253+
235254
});
236255

237256
@Component({ template: `<igx-buttongroup [values]="buttons"></igx-buttongroup>` })

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,7 @@
867867

868868
&%igx-grid__tr--ghost {
869869
background: --var($theme, 'row-ghost-background');
870+
z-index: 1;
870871
}
871872
}
872873

projects/igniteui-angular/src/lib/core/utils.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,17 @@ export function isFirefox(): boolean {
226226
return firefoxBrowser;
227227
}
228228

229+
/**
230+
* @hidden
231+
* TODO: make injectable, check isPlatformBrowser()
232+
*/
233+
export class PlatformUtil {
234+
static isIOS(): boolean {
235+
const iosBrowser = typeof window !== 'undefined' && /iPad|iPhone|iPod/.test(navigator.userAgent) && !('MSStream' in window);
236+
return iosBrowser;
237+
}
238+
}
239+
229240
/**
230241
* @hidden
231242
*/

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ export class IgxButtonDirective extends DisplayDensityBase {
4848
*/
4949
private _backgroundColor: string;
5050

51+
/**
52+
*@hidden
53+
*/
54+
private _disabled: boolean;
55+
5156
constructor(public element: ElementRef, private _renderer: Renderer2,
5257
@Optional() @Inject(DisplayDensityToken) protected _displayDensityOptions: IDisplayDensityOptions) {
5358
super(_displayDensityOptions);
@@ -141,6 +146,7 @@ export class IgxButtonDirective extends DisplayDensityBase {
141146
*/
142147
@Input() set disabled(val) {
143148
val = !!val;
149+
this._disabled = val;
144150
if (val) {
145151
this._renderer.addClass(this.nativeElement, `${this._cssClassPrefix}--disabled`);
146152
} else {
@@ -182,6 +188,14 @@ export class IgxButtonDirective extends DisplayDensityBase {
182188
return this._type === 'fab' && this.displayDensity === DisplayDensity.compact;
183189
}
184190

191+
/**
192+
* @hidden
193+
*/
194+
@HostBinding('attr.disabled')
195+
public get disabledAttribute() {
196+
return this._disabled ? this._disabled : null;
197+
}
198+
185199
/**
186200
* Gets or sets whether the button is selected.
187201
* Mainly used in the IgxButtonGroup component and it will have no effect if set separately.
@@ -195,7 +209,7 @@ export class IgxButtonDirective extends DisplayDensityBase {
195209
/**
196210
*@hidden
197211
*/
198-
@HostListener('click', ['$event'])
212+
@HostListener('click', ['$event'])
199213
public onClick(ev) {
200214
this.buttonClick.emit(ev);
201215
}

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ import { IgxSelectionAPIService } from '../core/selection';
1818
import { IgxTextHighlightDirective } from '../directives/text-highlight/text-highlight.directive';
1919
import { GridBaseAPIService } from './api.service';
2020
import { IgxColumnComponent } from './column.component';
21-
import { getNodeSizeViaRange, ROW_COLLAPSE_KEYS, ROW_EXPAND_KEYS, SUPPORTED_KEYS, NAVIGATION_KEYS, isIE, isLeftClick } from '../core/utils';
21+
import {
22+
getNodeSizeViaRange, ROW_COLLAPSE_KEYS, ROW_EXPAND_KEYS, SUPPORTED_KEYS, NAVIGATION_KEYS, isIE, isLeftClick, PlatformUtil
23+
} from '../core/utils';
2224
import { State } from '../services/index';
2325
import { IgxGridBaseComponent, IGridEditEventArgs, IGridDataBindable } from './grid-base.component';
2426
import { IgxGridSelectionService, ISelectionNode, IgxGridCRUDService } from '../core/grid-selection';
@@ -555,9 +557,11 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
555557
this.nativeElement.addEventListener('compositionend', this.compositionEndHandler);
556558
}
557559
});
558-
this.touchManager.addEventListener(this.nativeElement, 'doubletap', this.onDoubleClick, {
559-
cssProps: { } /* don't disable user-select, etc */
560-
} as HammerOptions);
560+
if (PlatformUtil.isIOS()) {
561+
this.touchManager.addEventListener(this.nativeElement, 'doubletap', this.onDoubleClick, {
562+
cssProps: { } /* don't disable user-select, etc */
563+
} as HammerOptions);
564+
}
561565
}
562566

563567
/**

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { configureTestSuite } from '../../test-utils/configure-suite';
99
import { IgxStringFilteringOperand } from '../../data-operations/filtering-condition';
1010
import { SampleTestData } from '../../test-utils/sample-test-data.spec';
1111
import { HammerGesturesManager } from '../../core/touch';
12+
import { PlatformUtil } from '../../core/utils';
1213

1314
const DEBOUNCETIME = 30;
1415

@@ -186,8 +187,16 @@ describe('IgxGrid - Cell component', () => {
186187
expect(firstCell).toBe(fix.componentInstance.clickedCell);
187188
});
188189

189-
it('Should handle doubletap, trigger onDoubleClick event', () => {
190+
it('Should not attach doubletap handler for non-iOS', () => {
190191
const addListenerSpy = spyOn(HammerGesturesManager.prototype, 'addEventListener');
192+
spyOn(PlatformUtil, 'isIOS').and.returnValue(false);
193+
const fix = TestBed.createComponent(DefaultGridComponent);
194+
fix.detectChanges();
195+
});
196+
197+
it('Should handle doubletap on iOS, trigger onDoubleClick event', () => {
198+
const addListenerSpy = spyOn(HammerGesturesManager.prototype, 'addEventListener');
199+
spyOn(PlatformUtil, 'isIOS').and.returnValue(true);
191200
const fix = TestBed.createComponent(DefaultGridComponent);
192201
fix.detectChanges();
193202

0 commit comments

Comments
 (0)