Skip to content

Commit 18a2603

Browse files
authored
Merge branch '19.1.x' into bpachilova/fix-unpinned-col-position-15542-19.1.x
2 parents 0009fba + e049b15 commit 18a2603

File tree

8 files changed

+129
-86
lines changed

8 files changed

+129
-86
lines changed

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2084,7 +2084,7 @@
20842084

20852085
.sort-icon {
20862086
color: var-get($theme, 'header-selected-text-color');
2087-
2087+
20882088
::after {
20892089
background: var-get($theme, 'header-selected-background');
20902090
}
@@ -2112,10 +2112,18 @@
21122112
&%igx-grid-th--sorted {
21132113
.sort-icon {
21142114
color: var-get($theme, 'header-selected-text-color');
2115+
2116+
> igx-icon {
2117+
color: inherit;
2118+
}
21152119

21162120
&:focus,
21172121
&:hover {
21182122
color: var-get($theme, 'header-selected-text-color');
2123+
2124+
> igx-icon {
2125+
color: inherit;
2126+
}
21192127
}
21202128
}
21212129
}
@@ -2169,9 +2177,17 @@
21692177
.sort-icon {
21702178
opacity: 1;
21712179
color: var-get($theme, 'sorted-header-icon-color');
2180+
2181+
> igx-icon {
2182+
color: inherit;
2183+
}
21722184

21732185
&:hover {
21742186
color: var-get($theme, 'sortable-header-icon-hover-color');
2187+
2188+
> igx-icon {
2189+
color: inherit;
2190+
}
21752191
}
21762192
}
21772193
}

projects/igniteui-angular/src/lib/data-operations/filtering-expression.interface.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export enum FilteringLogic {
77
Or
88
}
99

10-
/* tsPlainInterface */
1110
/* marshalByValue */
1211
/**
1312
* Represents filtering expressions.

projects/igniteui-angular/src/lib/data-operations/filtering-expressions-tree.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export declare interface IExpressionTree {
1616
returnFields?: string[] | null;
1717
}
1818

19+
/* alternateBaseType: ExpressionTree */
1920
/* marshalByValue */
2021
export declare interface IFilteringExpressionsTree extends IBaseEventArgs, IExpressionTree {
2122
filteringOperands: (IFilteringExpressionsTree | IFilteringExpression)[];

projects/igniteui-angular/src/lib/data-operations/filtering-strategy.spec.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,29 @@ describe('Unit testing FilteringStrategy', () => {
4949
const res = fs.matchRecord(rec, expressionTree);
5050
expect(res).toBeTruthy();
5151
});
52+
53+
it ('tests `findMatchByExpression` for working with filtering operands with missing condition', () => {
54+
const rec = data[0];
55+
const expressionTree = JSON.parse('{"filteringOperands":[{"fieldName":"Missing","condition":{"name":"notEmpty","isUnary":true,"iconName":"filter_not_empty"},"conditionName":"notEmpty","ignoreCase":true,"searchVal":null,"searchTree":null}],"operator":0,"returnFields":[],"type":1}');
56+
const res = fs.matchRecord(rec, expressionTree);
57+
expect(res).toBeFalsy();
58+
});
59+
60+
it ('no error when condition is missing in the filtering expressions tree', () => {
61+
const rec = data[0];
62+
const expressionTree = new FilteringExpressionsTree(FilteringLogic.Or);
63+
expressionTree.filteringOperands = [
64+
{
65+
conditionName: 'contains',
66+
fieldName: 'string',
67+
ignoreCase: false,
68+
searchVal: 'ROW'
69+
}
70+
];
71+
const res = fs.matchRecord(rec, expressionTree);
72+
expect(res).toBeFalsy();
73+
});
74+
5275
it ('tests `findMatch`', () => {
5376
const rec = data[0];
5477
const res = fs.findMatchByExpression(rec, {

projects/igniteui-angular/src/lib/data-operations/filtering-strategy.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ export interface IgxFilterItem {
3939
export abstract class BaseFilteringStrategy implements IFilteringStrategy {
4040
// protected
4141
public findMatchByExpression(rec: any, expr: IFilteringExpression, isDate?: boolean, isTime?: boolean, grid?: GridType): boolean {
42-
const cond = expr.condition;
4342
const val = this.getFieldValue(rec, expr.fieldName, isDate, isTime, grid);
44-
return cond.logic(val, expr.searchVal, expr.ignoreCase);
43+
if (expr.condition?.logic) {
44+
return expr.condition.logic(val, expr.searchVal, expr.ignoreCase);
45+
}
4546
}
4647

4748
// protected

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6608,10 +6608,10 @@ export abstract class IgxGridBaseDirective implements GridType,
66086608
.filter((c) => c.pinned);
66096609
this._unpinnedColumns = newColumns.filter((c) => !c.pinned);
66106610
this._columns = newColumns;
6611-
if (this._columns && this._filteringExpressionsTree) {
6611+
if (this._columns && this._columns.length && this._filteringExpressionsTree) {
66126612
this._filteringExpressionsTree = recreateTreeFromFields(this._filteringExpressionsTree, this.columns) as IFilteringExpressionsTree;
66136613
}
6614-
if (this._columns && this._advancedFilteringExpressionsTree) {
6614+
if (this._columns && this._columns.length && this._advancedFilteringExpressionsTree) {
66156615
this._advancedFilteringExpressionsTree = recreateTreeFromFields(this._advancedFilteringExpressionsTree, this.columns) as IFilteringExpressionsTree;
66166616
}
66176617
this.resetCaches();
@@ -6676,10 +6676,10 @@ export abstract class IgxGridBaseDirective implements GridType,
66766676
} else {
66776677
this._columns = this.getColumnList();
66786678
}
6679-
if (this._columns && this._filteringExpressionsTree) {
6679+
if (this._columns && this._columns.length && this._filteringExpressionsTree) {
66806680
this._filteringExpressionsTree = recreateTreeFromFields(this._filteringExpressionsTree, this._columns) as IFilteringExpressionsTree;
66816681
}
6682-
if (this._columns && this._advancedFilteringExpressionsTree) {
6682+
if (this._columns && this._columns.length && this._advancedFilteringExpressionsTree) {
66836683
this._advancedFilteringExpressionsTree = recreateTreeFromFields(this._advancedFilteringExpressionsTree, this._columns) as IFilteringExpressionsTree;
66846684
}
66856685

projects/igniteui-angular/src/lib/query-builder/query-builder-functions.spec.ts

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,4 +934,71 @@ export class QueryBuilderFunctions {
934934

935935
return [dropGhost, prevElement, nextElement, newChipContents];
936936
}
937+
938+
public static verifyGhostPositionOnMouseDrag(fix: ComponentFixture<any>, draggedChip: any, X: number, Y: number, moveDown: boolean) {
939+
const ghostPositionVisits: boolean[] = [false, false, false, false, false, false, false, false];
940+
const draggedChipCenter = QueryBuilderFunctions.getElementCenter(draggedChip.chipArea.nativeElement);
941+
const dragDir = draggedChip.dragDirective;
942+
943+
//pickup chip
944+
dragDir.onPointerDown({ pointerId: 1, pageX: draggedChipCenter.X, pageY: draggedChipCenter.Y });
945+
fix.detectChanges();
946+
947+
//trigger ghost
948+
QueryBuilderFunctions.dragMove(dragDir, draggedChipCenter.X + 10, draggedChipCenter.Y + 10);
949+
fix.detectChanges();
950+
951+
spyOn(dragDir.ghostElement, 'dispatchEvent').and.callThrough();
952+
953+
let target = moveDown ? 350 : 0;
954+
let shift = moveDown ? 1 : -1
955+
//Drag ghost up or down and check if drop ghost is rendered in the expected positions
956+
for (let i = moveDown ? 0 : 350; moveDown ? i <= target : i >= target; i += shift) {
957+
Y += moveDown ? 1 : -1;
958+
959+
QueryBuilderFunctions.dragMove(dragDir, X, Y);
960+
tick();
961+
fix.detectChanges();
962+
963+
const [dropGhost, prevElement, nextElement] = QueryBuilderFunctions.getDropGhostAndItsSiblings(fix);
964+
965+
if (i < 40 && !ghostPositionVisits[0]) {
966+
if (i <= 42) tick(50);
967+
if (!dropGhost) ghostPositionVisits[0] = true;
968+
}
969+
970+
if (i > 35 && i < 122 && !ghostPositionVisits[1]) {
971+
if (dropGhost && !prevElement && nextElement == 'OrderName Equals foo') ghostPositionVisits[1] = true;
972+
}
973+
974+
if (i > 120 && i < 165 && !ghostPositionVisits[2]) {
975+
if (dropGhost && prevElement == 'OrderName Equals foo' && nextElement === 'or OrderName Ends With a OrderDate Today') ghostPositionVisits[2] = true;
976+
}
977+
978+
if (i > 166 && i < 201 && !ghostPositionVisits[3]) {
979+
if (dropGhost && !prevElement && nextElement == 'OrderName Ends With a') ghostPositionVisits[3] = true;
980+
}
981+
982+
if (i > 202 && i < 241 && !ghostPositionVisits[4]) {
983+
if (dropGhost && prevElement == 'OrderName Ends With a' && nextElement === 'OrderDate Today') ghostPositionVisits[4] = true;
984+
}
985+
986+
if (i > 240 && i < 273 && !ghostPositionVisits[5]) {
987+
if (dropGhost && prevElement == 'OrderDate Today' && !nextElement) ghostPositionVisits[5] = true;
988+
}
989+
990+
if (i > 256 && i < 316 && !ghostPositionVisits[6]) {
991+
if (X > 400 || (dropGhost && prevElement == 'or OrderName Ends With a OrderDate Today' && !nextElement)) ghostPositionVisits[6] = true;
992+
}
993+
994+
if (i > 320 && !ghostPositionVisits[7]) {
995+
if (i >= 340) tick(50);
996+
if (!dropGhost) ghostPositionVisits[7] = true;
997+
}
998+
}
999+
1000+
//When dragged to the end, check results
1001+
expect(ghostPositionVisits).not.toContain(false,
1002+
`Ghost was not rendered on position(s) ${ghostPositionVisits.reduce((arr, e, ix) => ((e == false) && arr.push(ix), arr), []).toString()}`);
1003+
}
9371004
}

projects/igniteui-angular/src/lib/query-builder/query-builder.component.spec.ts

Lines changed: 14 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,88 +2461,24 @@ describe('IgxQueryBuilder', () => {
24612461
expect(chipComponents[1].nativeElement.getBoundingClientRect().height).toBe(0);
24622462
});
24632463

2464-
it('Should render drop ghost properly when mouse dragged.', fakeAsync(() => {
2464+
it('Should render drop ghost properly when mouse dragged down on the left.', fakeAsync(() => {
24652465
const draggedChip = chipComponents[1].componentInstance;
2466-
const draggedChipCenter = QueryBuilderFunctions.getElementCenter(draggedChip.chipArea.nativeElement);
2467-
const dragDir = draggedChip.dragDirective;
2468-
2469-
let X = 100, Y = 75;
2470-
2471-
//pickup chip
2472-
dragDir.onPointerDown({ pointerId: 1, pageX: draggedChipCenter.X, pageY: draggedChipCenter.Y });
2473-
fix.detectChanges();
2474-
2475-
//trigger ghost
2476-
QueryBuilderFunctions.dragMove(dragDir, draggedChipCenter.X + 10, draggedChipCenter.Y + 10);
2477-
fix.detectChanges();
2478-
2479-
spyOn(dragDir.ghostElement, 'dispatchEvent').and.callThrough();
2480-
2481-
const ghostPositionVisits: boolean[] = [false, false, false, false, false, false, false, false]
2482-
2483-
let i = 0, pass = 1, inc = 1;
2484-
2485-
//Drag ghost up and down four times and check if drop ghost is rendered in the expected positions
2486-
while (pass <= 4) {
2487-
i += inc;
2488-
Y += inc;
2489-
2490-
QueryBuilderFunctions.dragMove(dragDir, X, Y);
2491-
tick();
2492-
fix.detectChanges();
2493-
2494-
const [dropGhost, prevElement, nextElement] = QueryBuilderFunctions.getDropGhostAndItsSiblings(fix);
2495-
2496-
if (i < 40 && !ghostPositionVisits[0]) {
2497-
if (i <= 42) tick(50);
2498-
if (!dropGhost) ghostPositionVisits[0] = true;
2499-
}
2500-
2501-
if (i > 35 && i < 122 && !ghostPositionVisits[1]) {
2502-
if (dropGhost && !prevElement && nextElement == 'OrderName Equals foo') ghostPositionVisits[1] = true;
2503-
}
2504-
2505-
if (i > 120 && i < 165 && !ghostPositionVisits[2]) {
2506-
if (dropGhost && prevElement == 'OrderName Equals foo' && nextElement === 'or OrderName Ends With a OrderDate Today') ghostPositionVisits[2] = true;
2507-
}
2508-
2509-
if (i > 166 && i < 201 && !ghostPositionVisits[3]) {
2510-
if (dropGhost && !prevElement && nextElement == 'OrderName Ends With a') ghostPositionVisits[3] = true;
2511-
}
2512-
2513-
if (i > 202 && i < 241 && !ghostPositionVisits[4]) {
2514-
if (dropGhost && prevElement == 'OrderName Ends With a' && nextElement === 'OrderDate Today') ghostPositionVisits[4] = true;
2515-
}
2516-
2517-
if (i > 240 && i < 273 && !ghostPositionVisits[5]) {
2518-
if (dropGhost && prevElement == 'OrderDate Today' && !nextElement) ghostPositionVisits[5] = true;
2519-
}
2520-
2521-
if (i > 256 && i < 316 && !ghostPositionVisits[6]) {
2522-
if (pass > 2 || (dropGhost && prevElement == 'or OrderName Ends With a OrderDate Today' && !nextElement)) ghostPositionVisits[6] = true;
2523-
}
2524-
2525-
if (i > 320 && !ghostPositionVisits[7]) {
2526-
if (i >= 340) tick(50);
2527-
if (!dropGhost) ghostPositionVisits[7] = true;
2528-
}
2529-
2530-
//When dragged to the end, check results and reverse direction for next pass
2531-
if (i === 350 || i === 0) {
2532-
expect(ghostPositionVisits).not.toContain(false,
2533-
`Ghost was not rendered on position(s) ${ghostPositionVisits.reduce((arr, e, ix) => ((e == false) && arr.push(ix), arr), []).toString()} on pass:${pass}`);
2466+
QueryBuilderFunctions.verifyGhostPositionOnMouseDrag(fix, draggedChip, 100, 75, true);
2467+
}));
25342468

2535-
ghostPositionVisits.fill(false);
2536-
pass++;
2537-
inc *= -1;
2538-
if (pass % 2 === 0) Y -= ROW_HEIGHT;
2539-
if (pass % 2 !== 0) Y += ROW_HEIGHT;
2469+
it('Should render drop ghost properly when mouse dragged up on the left.', fakeAsync(() => {
2470+
const draggedChip = chipComponents[1].componentInstance;
2471+
QueryBuilderFunctions.verifyGhostPositionOnMouseDrag(fix, draggedChip, 100, 75 + 350, false);
2472+
}));
25402473

2541-
//go to the left and test the whole chip div as well(blank space to the right)
2542-
if (pass == 3) X += 400;
2543-
}
2544-
}
2474+
it('Should render drop ghost properly when mouse dragged down on the right.', fakeAsync(() => {
2475+
const draggedChip = chipComponents[1].componentInstance;
2476+
QueryBuilderFunctions.verifyGhostPositionOnMouseDrag(fix, draggedChip, 500, 75, true);
2477+
}));
25452478

2479+
it('Should render drop ghost properly when mouse dragged up on the right.', fakeAsync(() => {
2480+
const draggedChip = chipComponents[1].componentInstance;
2481+
QueryBuilderFunctions.verifyGhostPositionOnMouseDrag(fix, draggedChip, 500, 75 + 350, false);
25462482
}));
25472483

25482484
it('Should position drop ghost below the target condition on dragging down.', () => {

0 commit comments

Comments
 (0)