• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IgniteUI / igniteui-angular / 13331632524

14 Feb 2025 02:51PM CUT coverage: 22.015% (-69.6%) from 91.622%
13331632524

Pull #15372

github

web-flow
Merge d52d57714 into bcb78ae0a
Pull Request #15372: chore(*): test ci passing

1990 of 15592 branches covered (12.76%)

431 of 964 new or added lines in 18 files covered. (44.71%)

19956 existing lines in 307 files now uncovered.

6452 of 29307 relevant lines covered (22.02%)

249.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

2.27
/projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-filtering.service.ts
1
import { Injectable } from '@angular/core';
2
import { first, takeUntil } from 'rxjs/operators';
3
import { IFilteringOperation } from '../../data-operations/filtering-condition';
4
import { FilteringLogic } from '../../data-operations/filtering-expression.interface';
5
import { FilteringExpressionsTree, IFilteringExpressionsTree } from '../../data-operations/filtering-expressions-tree';
6
import { DimensionValuesFilteringStrategy } from '../../data-operations/pivot-strategy';
7
import { ColumnType } from '../common/grid.interface';
8
import { IgxFilteringService } from '../filtering/grid-filtering.service';
9
import { IgxPivotGridComponent } from './pivot-grid.component';
10
import { PivotUtil } from './pivot-util';
11

12
@Injectable()
13
export class IgxPivotFilteringService extends IgxFilteringService {
2✔
14
    private filtersESFId;
15

16
    public override clearFilter(field: string): void {
UNCOV
17
        this.clear_filter(field);
×
18
    }
19

20
    public override clear_filter(fieldName: string) {
UNCOV
21
        super.clear_filter(fieldName);
×
UNCOV
22
        const grid = this.grid as IgxPivotGridComponent;
×
UNCOV
23
        const allDimensions = grid.allDimensions;
×
UNCOV
24
        const allDimensionsFlat = PivotUtil.flatten(allDimensions);
×
UNCOV
25
        const dim = allDimensionsFlat.find(x => x.memberName === fieldName);
×
UNCOV
26
        dim.filter = undefined;
×
UNCOV
27
        grid.filteringPipeTrigger++;
×
UNCOV
28
        if (allDimensions.indexOf(dim) !== -1) {
×
29
            // update columns
UNCOV
30
            (grid as any).setupColumns();
×
31
        }
32
    }
33
    protected override filter_internal(fieldName: string, term, conditionOrExpressionsTree: IFilteringOperation | IFilteringExpressionsTree,
34
        ignoreCase: boolean) {
UNCOV
35
        super.filter_internal(fieldName, term, conditionOrExpressionsTree, ignoreCase);
×
UNCOV
36
        const grid = this.grid as IgxPivotGridComponent;
×
UNCOV
37
        const config = grid.pivotConfiguration;
×
UNCOV
38
        const allDimensions = PivotUtil.flatten(config.rows.concat(config.columns).concat(config.filters).filter(x => x !== null && x !== undefined));
×
UNCOV
39
        const enabledDimensions = allDimensions.filter(x => x && x.enabled);
×
UNCOV
40
        const dim = enabledDimensions.find(x => x.memberName === fieldName || x.member === fieldName);
×
UNCOV
41
        const filteringTree = dim.filter || new FilteringExpressionsTree(FilteringLogic.And);
×
UNCOV
42
        const fieldFilterIndex = filteringTree.findIndex(fieldName);
×
UNCOV
43
        if (fieldFilterIndex > -1) {
×
44
            filteringTree.filteringOperands.splice(fieldFilterIndex, 1);
×
45
        }
46

UNCOV
47
        this.prepare_filtering_expression(filteringTree, fieldName, term, conditionOrExpressionsTree, ignoreCase, fieldFilterIndex);
×
UNCOV
48
        dim.filter = filteringTree;
×
UNCOV
49
        grid.filteringPipeTrigger++;
×
UNCOV
50
        grid.filterStrategy = grid.filterStrategy ?? new DimensionValuesFilteringStrategy();
×
UNCOV
51
        if (allDimensions.indexOf(dim) !== -1) {
×
52
            // update columns
UNCOV
53
            (grid as any).setupColumns();
×
54
        }
55
    }
56

57
    public toggleFiltersESF(dropdown: any, element: HTMLElement, column: ColumnType, shouldReattach: boolean) {
UNCOV
58
        const filterIcon = column.filteringExpressionsTree ? 'igx-excel-filter__icon--filtered' : 'igx-excel-filter__icon';
×
UNCOV
59
        const filterIconTarget = element.querySelector(`.${filterIcon}`) as HTMLElement || element;
×
60

UNCOV
61
        const { id, ref } = (this.grid as IgxPivotGridComponent).createFilterESF(dropdown, column, {
×
62
            ...this._filterMenuOverlaySettings,
63
            ...{ target: filterIconTarget }
64
        }, shouldReattach);
65

UNCOV
66
        this.filtersESFId = id;
×
67

UNCOV
68
        if (shouldReattach) {
×
UNCOV
69
            this._overlayService.opening
×
70
                .pipe(
UNCOV
71
                    first(overlay => overlay.id === id),
×
72
                    takeUntil(this.destroy$)
73
                )
UNCOV
74
                .subscribe(() => this.lastActiveNode = this.grid.navigation.activeNode);
×
75

UNCOV
76
            this._overlayService.closed
×
77
                .pipe(
UNCOV
78
                    first(overlay => overlay.id === id),
×
79
                    takeUntil(this.destroy$)
80
                )
81
                .subscribe(() => {
UNCOV
82
                    this._overlayService.detach(id);
×
UNCOV
83
                    ref?.destroy();
×
UNCOV
84
                    this.grid.navigation.activeNode = this.lastActiveNode;
×
UNCOV
85
                    this.grid.theadRow.nativeElement.focus();
×
86
                });
87

UNCOV
88
            this.grid.columnPinned.pipe(first()).subscribe(() => ref?.destroy());
×
UNCOV
89
            this._overlayService.show(id);
×
90
        }
91
    }
92

93
    public hideESF() {
UNCOV
94
        this._overlayService.hide(this.filtersESFId);
×
95
    }
96
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc