Skip to content

Commit 38e8553

Browse files
authored
Merge branch 'master' into set-width-hideallcolumns-master
2 parents cbe7648 + ed84ad9 commit 38e8553

26 files changed

+552
-523
lines changed

package-lock.json

Lines changed: 301 additions & 264 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@
4545
},
4646
"private": true,
4747
"dependencies": {
48-
"@angular/animations": "^9.0.0-rc.5",
49-
"@angular/common": "^9.0.0-rc.5",
50-
"@angular/compiler": "^9.0.0-rc.5",
51-
"@angular/core": "^9.0.0-rc.5",
52-
"@angular/forms": "^9.0.0-rc.5",
53-
"@angular/platform-browser": "^9.0.0-rc.5",
54-
"@angular/platform-browser-dynamic": "^9.0.0-rc.5",
55-
"@angular/router": "^9.0.0-rc.5",
48+
"@angular/animations": "^9.0.0-rc.7",
49+
"@angular/common": "^9.0.0-rc.7",
50+
"@angular/compiler": "^9.0.0-rc.7",
51+
"@angular/core": "^9.0.0-rc.7",
52+
"@angular/forms": "^9.0.0-rc.7",
53+
"@angular/platform-browser": "^9.0.0-rc.7",
54+
"@angular/platform-browser-dynamic": "^9.0.0-rc.7",
55+
"@angular/router": "^9.0.0-rc.7",
5656
"@types/hammerjs": "^2.0.36",
5757
"@types/source-map": "0.5.2",
5858
"classlist.js": "^1.1.20150312",
@@ -66,12 +66,12 @@
6666
"zone.js": "~0.10.2"
6767
},
6868
"devDependencies": {
69-
"@angular-devkit/build-angular": "~0.900.0-rc.5",
70-
"@angular-devkit/build-ng-packagr": "~0.900.0-rc.5",
69+
"@angular-devkit/build-angular": "~0.900.0-rc.7",
70+
"@angular-devkit/build-ng-packagr": "~0.900.0-rc.7",
7171
"@angular-devkit/schematics": "^7.2.1",
72-
"@angular/cli": "~9.0.0-rc.5",
73-
"@angular/compiler-cli": "^9.0.0-rc.5",
74-
"@angular/language-service": "^9.0.0-rc.5",
72+
"@angular/cli": "~9.0.0-rc.7",
73+
"@angular/compiler-cli": "^9.0.0-rc.7",
74+
"@angular/language-service": "^9.0.0-rc.7",
7575
"@angularclass/hmr": "^2.1.3",
7676
"@types/jasmine": "~3.3.5",
7777
"@types/jasminewd2": "~2.0.6",

projects/igniteui-angular/src/lib/data-operations/data-util.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,14 @@ export class DataUtil {
211211
return data;
212212
}
213213

214+
public static parseValue(dataType: DataType, value: any): any {
215+
if (dataType === DataType.Number) {
216+
value = parseFloat(value);
217+
}
218+
219+
return value;
220+
}
221+
214222
private static findParentFromPath(data: any[], primaryKey: any, childDataKey: any, path: any[]): any {
215223
let collection: any[] = data;
216224
let result: any;

projects/igniteui-angular/src/lib/directives/drag-drop/drag-drop.directive.ts

Lines changed: 12 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -563,33 +563,25 @@ export class IgxDragDirective implements AfterContentInit, OnDestroy {
563563
}
564564

565565
protected set ghostLeft(pageX: number) {
566-
// To Do: Remove requestAnimationFrame when deprecated animations inputs are removed as well.
567-
// We use requestAnimationFrame for the old drop animations in combination with updateDragRelativePos.
568-
requestAnimationFrame(() => {
569-
if (this.ghostElement) {
570-
// We need to take into account marginLeft, since top style does not include margin, but pageX includes the margin.
571-
const ghostMarginLeft = parseInt(document.defaultView.getComputedStyle(this.ghostElement)['margin-left'], 10);
572-
// If ghost host is defined it needs to be taken into account.
573-
this.ghostElement.style.left = (pageX - ghostMarginLeft - this._ghostHostX) + 'px';
574-
}
575-
});
566+
if (this.ghostElement) {
567+
// We need to take into account marginLeft, since top style does not include margin, but pageX includes the margin.
568+
const ghostMarginLeft = parseInt(document.defaultView.getComputedStyle(this.ghostElement)['margin-left'], 10);
569+
// If ghost host is defined it needs to be taken into account.
570+
this.ghostElement.style.left = (pageX - ghostMarginLeft - this._ghostHostX) + 'px';
571+
}
576572
}
577573

578574
protected get ghostLeft() {
579575
return parseInt(this.ghostElement.style.left, 10) + this._ghostHostX;
580576
}
581577

582578
protected set ghostTop(pageY: number) {
583-
// To Do: Remove requestAnimationFrame when deprecated animations inputs are removed as well.
584-
// We use requestAnimationFrame for the old drop animations in combination with updateDragRelativePos.
585-
requestAnimationFrame(() => {
586-
if (this.ghostElement) {
587-
// We need to take into account marginTop, since top style does not include margin, but pageY includes the margin.
588-
const ghostMarginTop = parseInt(document.defaultView.getComputedStyle(this.ghostElement)['margin-top'], 10);
589-
// If ghost host is defined it needs to be taken into account.
590-
this.ghostElement.style.top = (pageY - ghostMarginTop - this._ghostHostY) + 'px';
591-
}
592-
});
579+
if (this.ghostElement) {
580+
// We need to take into account marginTop, since top style does not include margin, but pageY includes the margin.
581+
const ghostMarginTop = parseInt(document.defaultView.getComputedStyle(this.ghostElement)['margin-top'], 10);
582+
// If ghost host is defined it needs to be taken into account.
583+
this.ghostElement.style.top = (pageY - ghostMarginTop - this._ghostHostY) + 'px';
584+
}
593585
}
594586

595587
protected get ghostTop() {
@@ -611,10 +603,6 @@ export class IgxDragDirective implements AfterContentInit, OnDestroy {
611603
*/
612604
public animInProgress = false;
613605

614-
protected _baseMarginLeft = 0;
615-
protected _baseMarginTop = 0;
616-
protected _baseOriginX;
617-
protected _baseOriginY;
618606
protected _startX = 0;
619607
protected _startY = 0;
620608
protected _lastX = 0;
@@ -712,12 +700,6 @@ export class IgxDragDirective implements AfterContentInit, OnDestroy {
712700
});
713701
});
714702

715-
this._baseMarginLeft = parseInt(document.defaultView.getComputedStyle(this.element.nativeElement)['margin-left'], 10);
716-
this._baseMarginTop = parseInt(document.defaultView.getComputedStyle(this.element.nativeElement)['margin-top'], 10);
717-
this._baseOriginX = this.baseLeft;
718-
this._baseOriginY = this.baseTop;
719-
this._ghostStartX = this.baseLeft;
720-
this._ghostStartY = this.baseTop;
721703
// Set transition duration to 0s. This also helps with setting `visibility: hidden` to the base to not lag.
722704
this.element.nativeElement.style.transitionDuration = '0.0s';
723705
}
@@ -877,11 +859,6 @@ export class IgxDragDirective implements AfterContentInit, OnDestroy {
877859
event.preventDefault();
878860
}
879861

880-
if (!this._baseOriginX && !this._baseOriginY) {
881-
this._baseOriginX = this.baseLeft;
882-
this._baseOriginY = this.baseTop;
883-
}
884-
885862
if (this.pointerEventsEnabled || !this.touchEventsEnabled) {
886863
// Check first for pointer events or non touch, because we can have pointer events and touch events at once.
887864
this._startX = event.pageX;
@@ -1239,57 +1216,6 @@ export class IgxDragDirective implements AfterContentInit, OnDestroy {
12391216
this._lastDropArea = null;
12401217
}
12411218

1242-
/**
1243-
* @hidden
1244-
* Update relative positions
1245-
*/
1246-
public updateDragRelativePos() {
1247-
let newPosX, newPosY;
1248-
if (this.ghost && this.ghostElement) {
1249-
// Calculate the new ghostElement position to remain where the mouse is, so it doesn't jump
1250-
const totalDraggedX = this.ghostLeft - this._ghostStartX;
1251-
const totalDraggedY = this.ghostTop - this._ghostStartY;
1252-
newPosX = this.baseLeft;
1253-
newPosY = this.baseTop;
1254-
const diffStartX = this._ghostStartX - newPosX;
1255-
const diffStartY = this._ghostStartY - newPosY;
1256-
this.ghostTop = newPosX + totalDraggedX - diffStartX;
1257-
this.ghostLeft = newPosY + totalDraggedY - diffStartY;
1258-
} else if (!this.ghost) {
1259-
const totalDraggedX = this.getTransformX(this.element.nativeElement);
1260-
const totalDraggedY = this.getTransformY(this.element.nativeElement);
1261-
newPosX = this.baseLeft - totalDraggedX;
1262-
newPosY = this.baseTop - totalDraggedY;
1263-
const deltaX = this._baseOriginX - newPosX;
1264-
const deltaY = this._baseOriginY - newPosY;
1265-
this.setTransformXY(totalDraggedX + deltaX, totalDraggedY + deltaY);
1266-
}
1267-
this._baseOriginX = newPosX !== undefined ? newPosX : this._baseOriginX;
1268-
this._baseOriginY = newPosY !== undefined ? newPosY : this._baseOriginY;
1269-
}
1270-
1271-
/**
1272-
* @deprecated This method will be removed in future major version. Please use `transitionToOrigin` or `transitionTo`.
1273-
* Informs the `igxDrag` directive that it has been dropped/released.
1274-
* This should usually be called when `animateOnRelease` is set to `true`.
1275-
* When canceling or defining custom drop logic this tells the igxDrag to update it's positions and
1276-
* animate correctly to the new position.
1277-
* ```typescript
1278-
* public onDropElem(event) {
1279-
* // Function bound to the igxDrop directive event `onDrop`
1280-
* // This cancels the default drop logic of the `igxDrop`
1281-
* event.cancel = true;
1282-
* event.drag.dropFinished();
1283-
* }
1284-
* ```
1285-
*/
1286-
public dropFinished() {
1287-
this.updateDragRelativePos();
1288-
if (this.animateOnRelease && this.ghostElement) {
1289-
this.transitionToOrigin();
1290-
}
1291-
}
1292-
12931219
/**
12941220
* @hidden
12951221
*/

projects/igniteui-angular/src/lib/directives/drag-drop/drag-drop.spec.ts

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,106 +1175,6 @@ describe('General igxDrag/igxDrop', () => {
11751175
expect(dragDirsRects[0].top + 50).toBeLessThan(currTop);
11761176
expect(currTop).toBeLessThanOrEqual(dragDirsRects[0].top + 100);
11771177
}));
1178-
1179-
it('should keep same base element page position when element is moved in the DOM after executing updateDragRelativePos.', (async() => {
1180-
const firstDrag = fix.componentInstance.dragElems.first;
1181-
const firstElement = firstDrag.element.nativeElement;
1182-
const startingX = (dragDirsRects[0].left + dragDirsRects[0].right) / 2;
1183-
const startingY = (dragDirsRects[0].top + dragDirsRects[0].bottom) / 2;
1184-
firstDrag.ghost = false;
1185-
1186-
// Step 1.
1187-
UIInteractions.simulatePointerEvent('pointerdown', firstElement, startingX, startingY);
1188-
fix.detectChanges();
1189-
await wait();
1190-
1191-
// Step 2.
1192-
UIInteractions.simulatePointerEvent('pointermove', firstElement, startingX + 10, startingY + 10);
1193-
fix.detectChanges();
1194-
await wait(100);
1195-
1196-
// Step 3.
1197-
UIInteractions.simulatePointerEvent('pointermove', firstElement, startingX + 20, startingY + 20);
1198-
fix.detectChanges();
1199-
await wait(100);
1200-
1201-
expect(firstDrag.element.nativeElement.getBoundingClientRect().left).toEqual(dragDirsRects[0].left + 20);
1202-
expect(firstDrag.element.nativeElement.getBoundingClientRect().top).toEqual(dragDirsRects[0].top + 20);
1203-
1204-
fix.componentInstance.renderer.removeChild(firstElement.parentNode, firstElement);
1205-
fix.componentInstance.renderer.appendChild(dropArea.element.nativeElement, firstElement);
1206-
fix.detectChanges();
1207-
1208-
firstDrag.updateDragRelativePos();
1209-
fix.detectChanges();
1210-
1211-
expect(firstDrag.element.nativeElement.getBoundingClientRect().left).toEqual(dragDirsRects[0].left + 20);
1212-
expect(firstDrag.element.nativeElement.getBoundingClientRect().top).toEqual(dragDirsRects[0].top + 20);
1213-
1214-
// Step 4.
1215-
UIInteractions.simulatePointerEvent('pointermove', firstElement, startingX + 30, startingY + 30);
1216-
fix.detectChanges();
1217-
await wait(100);
1218-
1219-
expect(firstDrag.element.nativeElement.getBoundingClientRect().left).toEqual(dragDirsRects[0].left + 30);
1220-
expect(firstDrag.element.nativeElement.getBoundingClientRect().top.toFixed(2)).toEqual((dragDirsRects[0].top + 30).toFixed(2));
1221-
1222-
// Step 5.
1223-
UIInteractions.simulatePointerEvent('pointerup', firstElement, startingX + 30, startingY + 30);
1224-
fix.detectChanges();
1225-
await wait();
1226-
1227-
expect(firstDrag.element.nativeElement.getBoundingClientRect().left).toEqual(dragDirsRects[0].left + 30);
1228-
expect(firstDrag.element.nativeElement.getBoundingClientRect().top.toFixed(2)).toEqual((dragDirsRects[0].top + 30).toFixed(2));
1229-
}));
1230-
1231-
it('should keep same ghost page position when element is moved in the DOM after executing updateDragRelativePos.', (async() => {
1232-
const firstDrag = fix.componentInstance.dragElems.first;
1233-
const firstElement = firstDrag.element.nativeElement;
1234-
const startingX = (dragDirsRects[0].left + dragDirsRects[0].right) / 2;
1235-
const startingY = (dragDirsRects[0].top + dragDirsRects[0].bottom) / 2;
1236-
1237-
// Step 1.
1238-
UIInteractions.simulatePointerEvent('pointerdown', firstElement, startingX, startingY);
1239-
fix.detectChanges();
1240-
await wait();
1241-
1242-
// Step 2.
1243-
UIInteractions.simulatePointerEvent('pointermove', firstElement, startingX + 10, startingY + 10);
1244-
fix.detectChanges();
1245-
await wait(100);
1246-
1247-
// Step 3.
1248-
UIInteractions.simulatePointerEvent('pointermove', firstDrag.ghostElement, startingX + 20, startingY + 20);
1249-
fix.detectChanges();
1250-
await wait(100);
1251-
1252-
expect(firstDrag.ghostElement.getBoundingClientRect().left).toEqual(dragDirsRects[0].left + 20);
1253-
expect(firstDrag.ghostElement.getBoundingClientRect().top).toEqual(dragDirsRects[0].top + 20);
1254-
1255-
fix.componentInstance.renderer.removeChild(firstDrag.ghostElement.parentNode, firstDrag.ghostElement);
1256-
fix.componentInstance.renderer.appendChild(dropArea.element.nativeElement, firstDrag.ghostElement);
1257-
fix.detectChanges();
1258-
1259-
firstDrag.updateDragRelativePos();
1260-
fix.detectChanges();
1261-
1262-
expect(firstDrag.ghostElement.getBoundingClientRect().left).toEqual(dragDirsRects[0].left + 20);
1263-
expect(firstDrag.ghostElement.getBoundingClientRect().top).toEqual(dragDirsRects[0].top + 20);
1264-
1265-
// Step 4.
1266-
UIInteractions.simulatePointerEvent('pointermove', firstDrag.ghostElement, startingX + 30, startingY + 30);
1267-
fix.detectChanges();
1268-
await wait(100);
1269-
1270-
expect(firstDrag.ghostElement.getBoundingClientRect().left).toEqual(dragDirsRects[0].left + 30);
1271-
expect(firstDrag.ghostElement.getBoundingClientRect().top).toEqual((dragDirsRects[0].top + 30));
1272-
1273-
// Step 5.
1274-
UIInteractions.simulatePointerEvent('pointerup', firstElement, startingX + 30, startingY + 30);
1275-
fix.detectChanges();
1276-
await wait();
1277-
}));
12781178
});
12791179

12801180
describe('Linked igxDrag/igxDrop ', () => {

projects/igniteui-angular/src/lib/directives/template-outlet/template_outlet.directive.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ export class IgxTemplateOutletDirective implements OnChanges {
3232
@Output()
3333
public onCachedViewLoaded = new EventEmitter<ICachedViewLoadedEventArgs>();
3434

35+
@Output()
36+
public onBeforeViewDetach = new EventEmitter<IViewChangeEventArgs>();
37+
3538
constructor(public _viewContainerRef: ViewContainerRef, private _zone: NgZone, public cdr: ChangeDetectorRef) {
3639
}
3740

@@ -66,6 +69,7 @@ export class IgxTemplateOutletDirective implements OnChanges {
6669
const prevIndex = this._viewRef ? this._viewContainerRef.indexOf(this._viewRef) : -1;
6770
// detach old and create new
6871
if (prevIndex !== -1) {
72+
this.onBeforeViewDetach.emit({ owner: this, view: this._viewRef, context: this.igxTemplateOutletContext });
6973
this._viewContainerRef.detach(prevIndex);
7074
}
7175
if (this.igxTemplateOutlet) {
@@ -92,9 +96,11 @@ export class IgxTemplateOutletDirective implements OnChanges {
9296
if (view !== this._viewRef) {
9397
if (owner._viewContainerRef.indexOf(view) !== -1) {
9498
// detach in case view it is attached somewhere else at the moment.
99+
this.onBeforeViewDetach.emit({ owner: this, view: this._viewRef, context: this.igxTemplateOutletContext });
95100
owner._viewContainerRef.detach(owner._viewContainerRef.indexOf(view));
96101
}
97102
if (this._viewRef && this._viewContainerRef.indexOf(this._viewRef) !== -1) {
103+
this.onBeforeViewDetach.emit({ owner: this, view: this._viewRef, context: this.igxTemplateOutletContext });
98104
this._viewContainerRef.detach(this._viewContainerRef.indexOf(this._viewRef));
99105
}
100106
this._viewRef = view;
@@ -113,6 +119,7 @@ export class IgxTemplateOutletDirective implements OnChanges {
113119
// then detach old view and insert the stored one with the matching template
114120
// after that update its context.
115121
if (this._viewContainerRef.length > 0) {
122+
this.onBeforeViewDetach.emit({ owner: this, view: this._viewRef, context: this.igxTemplateOutletContext });
116123
this._viewContainerRef.detach(this._viewContainerRef.indexOf(this._viewRef));
117124
}
118125

projects/igniteui-angular/src/lib/grids/filtering/advanced-filtering/advanced-filtering-dialog.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { KEYS } from '../../../core/utils';
1818
import { AbsoluteScrollStrategy, AutoPositionStrategy } from '../../../services/index';
1919
import { IgxColumnComponent } from '../../columns/column.component';
2020
import { GridType } from '../../common/grid.interface';
21+
import { DataUtil } from './../../../data-operations/data-util';
2122

2223
/**
2324
*@hidden
@@ -468,7 +469,7 @@ export class IgxAdvancedFilteringDialogComponent implements AfterViewInit, OnDes
468469
if (this.editedExpression) {
469470
this.editedExpression.expression.fieldName = this.selectedColumn.field;
470471
this.editedExpression.expression.condition = this.selectedColumn.filters.condition(this.selectedCondition);
471-
this.editedExpression.expression.searchVal = this.searchValue;
472+
this.editedExpression.expression.searchVal = DataUtil.parseValue(this.selectedColumn.dataType, this.searchValue);
472473

473474
this.editedExpression.inEditMode = false;
474475
this.editedExpression = null;

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
ChangeDetectionStrategy,
1414
ViewRef
1515
} from '@angular/core';
16-
import { DataType } from '../../../data-operations/data-util';
16+
import { DataType, DataUtil } from '../../../data-operations/data-util';
1717
import { IgxColumnComponent } from '../../columns/column.component';
1818
import { IgxDropDownComponent, ISelectionEventArgs } from '../../../drop-down/index';
1919
import { IFilteringOperation } from '../../../data-operations/filtering-condition';
@@ -100,7 +100,7 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
100100
this.expression.searchVal = null;
101101
this.showHideArrowButtons();
102102
} else {
103-
this.expression.searchVal = this.transformValue(val);
103+
this.expression.searchVal = DataUtil.parseValue(this.column.dataType, val);
104104
if (this.expressionsList.find(item => item.expression === this.expression) === undefined) {
105105
this.addExpression(true);
106106
}
@@ -659,16 +659,6 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
659659
});
660660
}
661661

662-
private transformValue(value): any {
663-
if (this.column.dataType === DataType.Number) {
664-
value = parseFloat(value);
665-
} else if (this.column.dataType === DataType.Boolean) {
666-
value = Boolean(value);
667-
}
668-
669-
return value;
670-
}
671-
672662
private addExpression(isSelected: boolean) {
673663
const exprUI = new ExpressionUI();
674664
exprUI.expression = this.expression;

0 commit comments

Comments
 (0)