Skip to content

Commit d83e0ec

Browse files
Merge branch '8.1.x' into astaev/issue5627-8.1.x
2 parents 5d98bfb + e9156c6 commit d83e0ec

34 files changed

+464
-223
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ export class IgxButtonGroupComponent extends DisplayDensityBase implements After
279279

280280
/**
281281
* Selects a button by its index.
282-
* @memberOf {@link IgxButtonGroupComponent}
283282
*```typescript
284283
*@ViewChild("MyChild")
285284
*private buttonG: IgxButtonGroupComponent;
@@ -288,6 +287,7 @@ export class IgxButtonGroupComponent extends DisplayDensityBase implements After
288287
* this.cdr.detectChanges();
289288
*}
290289
*```
290+
* @memberOf {@link IgxButtonGroupComponent}
291291
*/
292292
public selectButton(index: number) {
293293
if (index >= this.buttons.length || index < 0) {
@@ -326,7 +326,6 @@ export class IgxButtonGroupComponent extends DisplayDensityBase implements After
326326

327327
/**
328328
* Deselects a button by its index.
329-
* @memberOf {@link IgxButtonGroupComponent}
330329
* ```typescript
331330
*@ViewChild("MyChild")
332331
*private buttonG: IgxButtonGroupComponent;
@@ -335,6 +334,7 @@ export class IgxButtonGroupComponent extends DisplayDensityBase implements After
335334
* this.cdr.detectChanges();
336335
*}
337336
* ```
337+
* @memberOf {@link IgxButtonGroupComponent}
338338
*/
339339
public deselectButton(index: number) {
340340
if (index >= this.buttons.length || index < 0) {

projects/igniteui-angular/src/lib/combo/combo.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<ng-container ngProjectAs="igx-hint, [igxHint]">
2525
<ng-content select="igx-hint, [igxHint]"></ng-content>
2626
</ng-container>
27-
<input igxInput #comboInput name="comboInput" type="text" [value]="value" readonly [placeholder]="placeholder"
27+
<input igxInput #comboInput name="comboInput" type="text" [value]="value" readonly [attr.placeholder]="placeholder"
2828
[disabled]="disabled" (blur)="onBlur()" />
2929
<ng-container ngProjectAs="igx-suffix">
3030
<ng-content select="igx-suffix"></ng-content>
@@ -47,7 +47,7 @@
4747
<igx-input-group *ngIf="displaySearchInput" [displayDensity]="displayDensity" class="igx-combo__search">
4848
<input class="igx-combo-input" igxInput #searchInput name="searchInput" autocomplete="off" type="text"
4949
[(ngModel)]="searchValue" (ngModelChange)="handleInputChange($event)" (keyup)="handleKeyUp($event)"
50-
(keydown)="handleKeyDown($event)" (focus)="dropdown.onBlur($event)" [placeholder]="searchPlaceholder"
50+
(keydown)="handleKeyDown($event)" (focus)="dropdown.onBlur($event)" [attr.placeholder]="searchPlaceholder"
5151
aria-autocomplete="both" [attr.aria-owns]="dropdown.id" [attr.aria-labelledby]="ariaLabelledBy" />
5252
</igx-input-group>
5353
<ng-container *ngTemplateOutlet="headerTemplate">

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
683683
* ```
684684
*/
685685
@Input()
686-
public placeholder = '';
686+
public placeholder;
687687

688688
/**
689689
* @hidden @internal

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

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -168,38 +168,11 @@
168168
height: map-get($grid-toolbar-height, 'comfortable');
169169

170170
%igx-button--flat {
171-
background: --var($theme, 'button-background');
172-
color: --var($theme, 'button-text-color');
173171
margin-left: rem(8);
174-
175-
&:hover {
176-
background: --var($theme, 'button-hover-background');
177-
color: --var($theme, 'button-hover-text-color');
178-
}
179-
180-
&:focus,
181-
&:active {
182-
background: --var($theme, 'button-focus-background');
183-
color: --var($theme, 'button-focus-text-color');
184-
}
185172
}
186173

187174
%igx-button--icon {
188-
background: --var($theme, 'button-background');
189-
color: --var($theme, 'button-text-color');
190175
margin-left: rem(8);
191-
border-radius: 0;
192-
193-
&:hover {
194-
background: --var($theme, 'button-hover-background');
195-
color: --var($theme, 'button-hover-text-color');
196-
}
197-
198-
&:focus,
199-
&:active {
200-
background: --var($theme, 'button-focus-background');
201-
color: --var($theme, 'button-focus-text-color');
202-
}
203176
}
204177

205178
%igx-grid-toolbar__button-space {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
/// @requires --var
1313
@mixin _excel-filtering($theme, $palette) {
1414
%grid-excel-filter {
15-
height: rem(15px);
1615
display: block;
1716
}
1817

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

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Inject, Injectable, NgZone } from '@angular/core';
22
import { ɵgetDOM as getDOM } from '@angular/platform-browser';
33
import { DOCUMENT } from '@angular/common';
4+
import { PlatformUtil } from './utils';
45

56
const EVENT_SUFFIX = 'precise';
67

@@ -11,26 +12,31 @@ const EVENT_SUFFIX = 'precise';
1112
*/
1213
@Injectable()
1314
export class HammerGesturesManager {
15+
private platformBrowser: boolean;
1416
/**
1517
* Event option defaults for each recognizer, see http://hammerjs.github.io/api/ for API listing.
1618
*/
17-
protected hammerOptions: HammerOptions = {
18-
// D.P. #447 Force TouchInput due to PointerEventInput bug (https://github.com/hammerjs/hammer.js/issues/1065)
19-
// see https://github.com/IgniteUI/igniteui-angular/issues/447#issuecomment-324601803
20-
inputClass: Hammer.TouchInput,
21-
recognizers: [
22-
[ Hammer.Pan, { threshold: 0 } ],
23-
[ Hammer.Swipe, {
24-
direction: Hammer.DIRECTION_HORIZONTAL
25-
}],
26-
[Hammer.Tap],
27-
[Hammer.Tap, { event: 'doubletap', taps: 2 }, ['tap']]
28-
]
29-
};
19+
protected hammerOptions: HammerOptions = {};
3020

3121
private _hammerManagers: Array<{ element: EventTarget, manager: HammerManager; }> = [];
3222

33-
constructor(private _zone: NgZone, @Inject(DOCUMENT) private doc: any) {
23+
constructor(private _zone: NgZone, @Inject(DOCUMENT) private doc: any, private platformUtil: PlatformUtil) {
24+
this.platformBrowser = this.platformUtil.isBrowser;
25+
if (this.platformBrowser) {
26+
this.hammerOptions = {
27+
// D.P. #447 Force TouchInput due to PointerEventInput bug (https://github.com/hammerjs/hammer.js/issues/1065)
28+
// see https://github.com/IgniteUI/igniteui-angular/issues/447#issuecomment-324601803
29+
inputClass: Hammer.TouchInput,
30+
recognizers: [
31+
[Hammer.Pan, { threshold: 0 }],
32+
[Hammer.Swipe, {
33+
direction: Hammer.DIRECTION_HORIZONTAL
34+
}],
35+
[Hammer.Tap],
36+
[Hammer.Tap, { event: 'doubletap', taps: 2 }, ['tap']]
37+
]
38+
};
39+
}
3440
}
3541

3642
public supports(eventName: string): boolean {
@@ -41,10 +47,14 @@ export class HammerGesturesManager {
4147
* Add listener extended with options for Hammer.js. Will use defaults if none are provided.
4248
* Modeling after other event plugins for easy future modifications.
4349
*/
44-
public addEventListener(element: HTMLElement,
45-
eventName: string,
46-
eventHandler: (eventObj) => void,
47-
options: HammerOptions = null): () => void {
50+
public addEventListener(
51+
element: HTMLElement,
52+
eventName: string,
53+
eventHandler: (eventObj) => void,
54+
options: HammerOptions = null): () => void {
55+
if (!this.platformBrowser) {
56+
return;
57+
}
4858

4959
// Creating the manager bind events, must be done outside of angular
5060
return this._zone.runOutsideAngular(() => {
@@ -67,6 +77,10 @@ export class HammerGesturesManager {
6777
* @param target Can be one of either window, body or document(fallback default).
6878
*/
6979
public addGlobalEventListener(target: string, eventName: string, eventHandler: (eventObj) => void): () => void {
80+
if (!this.platformBrowser) {
81+
return;
82+
}
83+
7084
const element = this.getGlobalEventTarget(target);
7185

7286
// Creating the manager bind events, must be done outside of angular

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

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import { Injectable, PLATFORM_ID, Inject } from '@angular/core';
2+
import { isPlatformBrowser } from '@angular/common';
3+
14
/**
25
*@hidden
36
*/
@@ -228,12 +231,14 @@ export function isFirefox(): boolean {
228231

229232
/**
230233
* @hidden
231-
* TODO: make injectable, check isPlatformBrowser()
232234
*/
235+
@Injectable({ providedIn: 'root' })
233236
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+
public isBrowser: boolean = isPlatformBrowser(this.platformId);
238+
239+
public isIOS = this.isBrowser && /iPad|iPhone|iPod/.test(navigator.userAgent) && !('MSStream' in window);
240+
241+
constructor(@Inject(PLATFORM_ID) private platformId: Object) {
237242
}
238243
}
239244

@@ -246,8 +251,21 @@ export function isLeftClick(event: PointerEvent) {
246251

247252
/** @hidden */
248253
export function isNavigationKey(key: string): boolean {
249-
return ['down', 'up', 'left', 'right', 'arrowdown', 'arrowup', 'arrowleft', 'arrowright',
250-
'home', 'end', 'space', 'spacebar', ' '].indexOf(key) !== -1;
254+
return [
255+
'down',
256+
'up',
257+
'left',
258+
'right',
259+
'arrowdown',
260+
'arrowup',
261+
'arrowleft',
262+
'arrowright',
263+
'home',
264+
'end',
265+
'space',
266+
'spacebar',
267+
' '
268+
].indexOf(key) !== -1;
251269
}
252270

253271
/**
@@ -278,8 +296,21 @@ export interface CancelableBrowserEventArgs extends CancelableEventArgs {
278296
event?: Event;
279297
}
280298

281-
export const NAVIGATION_KEYS = new Set(['down', 'up', 'left', 'right', 'arrowdown', 'arrowup', 'arrowleft', 'arrowright',
282-
'home', 'end', 'space', 'spacebar', ' ']);
299+
export const NAVIGATION_KEYS = new Set([
300+
'down',
301+
'up',
302+
'left',
303+
'right',
304+
'arrowdown',
305+
'arrowup',
306+
'arrowleft',
307+
'arrowright',
308+
'home',
309+
'end',
310+
'space',
311+
'spacebar',
312+
' '
313+
]);
283314
export const ROW_EXPAND_KEYS = new Set('right down arrowright arrowdown'.split(' '));
284315
export const ROW_COLLAPSE_KEYS = new Set('left up arrowleft arrowup'.split(' '));
285316
export const SUPPORTED_KEYS = new Set([...Array.from(NAVIGATION_KEYS), 'tab', 'enter', 'f2', 'escape', 'esc']);

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,19 @@ describe('IgxForOf directive -', () => {
255255
}
256256
});
257257

258+
it('should not throw error when itemSize is changed while data is null/undefined.', () => {
259+
let errorMessage = '';
260+
fix.componentInstance.data = null;
261+
fix.detectChanges();
262+
try {
263+
fix.componentInstance.itemSize = '100px';
264+
fix.detectChanges();
265+
} catch (ex) {
266+
errorMessage = ex.message;
267+
}
268+
expect(errorMessage).toBe('');
269+
});
270+
258271
it('should allow initially undefined value for igxForOf and then detect changes correctly once the value is updated', async () => {
259272
fix = TestBed.createComponent(VerticalVirtualNoDataComponent);
260273
expect(() => {

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,8 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
423423
}
424424
}
425425
const defaultItemSize = 'igxForItemSize';
426-
if (defaultItemSize in changes && !changes[defaultItemSize].firstChange && this.igxForScrollOrientation === 'vertical') {
426+
if (defaultItemSize in changes && !changes[defaultItemSize].firstChange &&
427+
this.igxForScrollOrientation === 'vertical' && this.igxForOf) {
427428
// handle default item size changed.
428429
this.initSizesCache(this.igxForOf);
429430
this._applyChanges();
@@ -443,7 +444,7 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
443444
if (changes) {
444445
// re-init cache.
445446
if (!this.igxForOf) {
446-
return;
447+
this.igxForOf = [];
447448
}
448449
this._updateSizeCache();
449450
this._zone.run(() => {
@@ -1325,7 +1326,8 @@ export class IgxGridForOfDirective<T> extends IgxForOfDirective<T> implements On
13251326
}
13261327
}
13271328
const defaultItemSize = 'igxForItemSize';
1328-
if (defaultItemSize in changes && !changes[defaultItemSize].firstChange && this.igxForScrollOrientation === 'vertical') {
1329+
if (defaultItemSize in changes && !changes[defaultItemSize].firstChange &&
1330+
this.igxForScrollOrientation === 'vertical' && this.igxForOf) {
13291331
// handle default item size changed.
13301332
this.initSizesCache(this.igxForOf);
13311333
}
@@ -1486,7 +1488,7 @@ export class IgxGridForOfDirective<T> extends IgxForOfDirective<T> implements On
14861488
this.onDataChanging.emit(args);
14871489
// re-init cache.
14881490
if (!this.igxForOf) {
1489-
return;
1491+
this.igxForOf = [];
14901492
}
14911493
/* we need to reset the master dir if all rows are removed
14921494
(e.g. because of filtering); if all columns are hidden, rows are

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,10 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
437437
}
438438
} else {
439439
const rowTransaction: State = this.grid.transactions.getState(this.row.rowID);
440-
return rowTransaction && rowTransaction.value && rowTransaction.value[this.column.field];
440+
return rowTransaction && rowTransaction.value &&
441+
(rowTransaction.value[this.column.field] ||
442+
rowTransaction.value[this.column.field] === 0 ||
443+
rowTransaction.value[this.column.field] === false);
441444
}
442445

443446
return false;
@@ -535,7 +538,8 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
535538
public cdr: ChangeDetectorRef,
536539
private element: ElementRef,
537540
protected zone: NgZone,
538-
private touchManager: HammerGesturesManager) { }
541+
private touchManager: HammerGesturesManager,
542+
protected platformUtil: PlatformUtil) { }
539543

540544

541545
/**
@@ -557,7 +561,7 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
557561
this.nativeElement.addEventListener('compositionend', this.compositionEndHandler);
558562
}
559563
});
560-
if (PlatformUtil.isIOS()) {
564+
if (this.platformUtil.isIOS) {
561565
this.touchManager.addEventListener(this.nativeElement, 'doubletap', this.onDoubleClick, {
562566
cssProps: { } /* don't disable user-select, etc */
563567
} as HammerOptions);

0 commit comments

Comments
 (0)