• 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

70.0
/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.pipes.ts
1
import { Inject, Pipe, PipeTransform } from '@angular/core';
2
import { cloneArray, resolveNestedPath } from '../../core/utils';
3
import { DataUtil } from '../../data-operations/data-util';
4
import { GridPagingMode } from '../common/enums';
5
import { GridType, IGX_GRID_BASE } from '../common/grid.interface';
6

7
/**
8
 * @hidden
9
 */
10
@Pipe({
11
    name: 'gridHierarchical',
12
    standalone: true
13
})
14
export class IgxGridHierarchicalPipe implements PipeTransform {
2✔
15

16
    constructor(@Inject(IGX_GRID_BASE) private grid: GridType) { }
1✔
17

18
    public transform(
19
        collection: any,
20
        state = new Map<any, boolean>(),
×
21
        id: string,
22
        primaryKey: any,
23
        childKeys: string[],
24
        _pipeTrigger: number
25
    ): any[] {
26
        if (childKeys.length === 0) {
1!
UNCOV
27
            return collection;
×
28
        }
29
        if (this.grid.verticalScrollContainer.isRemote) {
1!
30
            return collection;
×
31
        }
32
        const result = this.addHierarchy(this.grid, cloneArray(collection), state, primaryKey, childKeys);
1✔
33

34
        return result;
1✔
35
    }
36

37
    public addHierarchy<T>(grid, data: T[], state, primaryKey, childKeys: string[]): T[] {
38
        const result = [];
1✔
39

40
        data.forEach((v) => {
1✔
41
            result.push(v);
5✔
42
            const childGridsData = {};
5✔
43
            childKeys.forEach((childKey) => {
5✔
44
                if (!v[childKey]) {
5!
UNCOV
45
                    v[childKey] = [];
×
46
                }
47
                const hasNestedPath = childKey?.includes('.');
5✔
48
                const childData = !hasNestedPath ? v[childKey] : resolveNestedPath(v, childKey);
5!
49
                childGridsData[childKey] = childData;
5✔
50
            });
51
            if (grid.gridAPI.get_row_expansion_state(v)) {
5!
UNCOV
52
                result.push({ rowID: primaryKey ? v[primaryKey] : v, childGridsData });
×
53
            }
54
        });
55
        return result;
1✔
56
    }
57
}
58

59
/**
60
 * @hidden
61
 */
62
@Pipe({
63
    name: 'gridHierarchicalPaging',
64
    standalone: true
65
})
66
export class IgxGridHierarchicalPagingPipe implements PipeTransform {
2✔
67

68
    constructor(@Inject(IGX_GRID_BASE) private grid: GridType) { }
1✔
69

70
    public transform(collection: any[], enabled: boolean, page = 0, perPage = 15, _id: string, _pipeTrigger: number): any[] {
×
71
        if (!enabled || this.grid.pagingMode !== GridPagingMode.Local) {
1!
72
            return collection;
1✔
73
        }
74

UNCOV
75
        const state = {
×
76
            index: page,
77
            recordsPerPage: perPage
78
        };
79

UNCOV
80
        const total = this.grid._totalRecords >= 0 ? this.grid._totalRecords : collection.length;
×
UNCOV
81
        const result: any[] = DataUtil.page(cloneArray(collection), state, total);
×
UNCOV
82
        this.grid.pagingState = state;
×
UNCOV
83
        return result;
×
84

85
    }
86
}
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