• 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

29.03
/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid-api.service.ts
1
import { IgxRowIslandComponent } from './row-island.component';
2
import { Subject } from 'rxjs';
3
import { GridType, IPathSegment } from '../common/grid.interface';
4
import { Injectable } from '@angular/core';
5
import { GridBaseAPIService } from '../api.service';
6

7
@Injectable()
8
export class IgxHierarchicalGridAPIService extends GridBaseAPIService<GridType> {
2✔
9
    protected childRowIslands: Map<string, IgxRowIslandComponent> = new Map<string, IgxRowIslandComponent>();
1✔
10
    protected childGrids: Map<string, Map<any, GridType>> =
1✔
11
        new Map<string, Map<any, GridType>>();
12

13
    public registerChildRowIsland(rowIsland: IgxRowIslandComponent) {
14
        this.childRowIslands.set(rowIsland.key, rowIsland);
1✔
15
        this.destroyMap.set(rowIsland.key, new Subject<boolean>());
1✔
16
    }
17

18
    public unsetChildRowIsland(rowIsland: IgxRowIslandComponent) {
19
        this.childGrids.delete(rowIsland.key);
1✔
20
        this.childRowIslands.delete(rowIsland.key);
1✔
21
        this.destroyMap.delete(rowIsland.key);
1✔
22
    }
23

24
    public getChildRowIsland(key: string) {
UNCOV
25
        return this.childRowIslands.get(key);
×
26
    }
27

28
    public getChildGrid(path: Array<IPathSegment>) {
UNCOV
29
        const currPath = path;
×
30
        let grid;
UNCOV
31
        const pathElem = currPath.shift();
×
UNCOV
32
        const childrenForLayout = this.childGrids.get(pathElem.rowIslandKey);
×
UNCOV
33
        if (childrenForLayout) {
×
UNCOV
34
            const childGrid = childrenForLayout.get(pathElem.rowKey);
×
UNCOV
35
            if (currPath.length === 0) {
×
UNCOV
36
                grid = childGrid;
×
37
            } else {
UNCOV
38
                grid = childGrid.gridAPI.getChildGrid(currPath);
×
39
            }
40
        }
UNCOV
41
        return grid;
×
42
    }
43

44
    public getChildGrids(inDepth?: boolean) {
45
        let allChildren: GridType [] = [];
1✔
46
        this.childGrids.forEach((layoutMap) => {
1✔
UNCOV
47
            layoutMap.forEach((grid) => {
×
UNCOV
48
                allChildren.push(grid);
×
UNCOV
49
                if (inDepth) {
×
UNCOV
50
                    const children = grid.gridAPI.getChildGrids(inDepth);
×
UNCOV
51
                    allChildren = allChildren.concat(children);
×
52
                }
53
            });
54
        });
55

56
        return allChildren;
1✔
57
    }
58

59
    public getParentRowId(childGrid: GridType) {
60
        let rowID;
UNCOV
61
        this.childGrids.forEach((layoutMap) => {
×
UNCOV
62
            layoutMap.forEach((grid, key) => {
×
UNCOV
63
                if (grid === childGrid) {
×
UNCOV
64
                    rowID = key;
×
UNCOV
65
                    return;
×
66
                }
67
            });
68
        });
UNCOV
69
        return rowID;
×
70
    }
71

72
    public registerChildGrid(parentRowID: any, rowIslandKey: string, grid: GridType) {
UNCOV
73
        let childrenForLayout = this.childGrids.get(rowIslandKey);
×
UNCOV
74
        if (!childrenForLayout) {
×
UNCOV
75
            this.childGrids.set(rowIslandKey, new Map<any, GridType>());
×
UNCOV
76
            childrenForLayout = this.childGrids.get(rowIslandKey);
×
77
        }
UNCOV
78
        childrenForLayout.set(parentRowID, grid);
×
79
    }
80

81
    public getChildGridsForRowIsland(rowIslandKey: string): GridType[] {
82
        const childrenForLayout = this.childGrids.get(rowIslandKey);
1✔
83
        const children = [];
1✔
84
        if (childrenForLayout) {
1!
UNCOV
85
            childrenForLayout.forEach((child) => {
×
UNCOV
86
                children.push(child);
×
87
            });
88
        }
89
        return children;
1✔
90
    }
91

92
    public getChildGridByID(rowIslandKey, rowID) {
UNCOV
93
        const childrenForLayout = this.childGrids.get(rowIslandKey);
×
UNCOV
94
        return childrenForLayout.get(rowID);
×
95
    }
96

97
    public override get_row_expansion_state(record: any): boolean {
98
        let inState;
99
        if (record.childGridsData !== undefined) {
109!
100
            const ri = record.key;
×
101
            const states = this.grid.expansionStates;
×
102
            const expanded = states.get(ri);
×
103
            if (expanded !== undefined) {
×
104
                return expanded;
×
105
            } else {
106
                return this.grid.getDefaultExpandState(record);
×
107
            }
108
        } else {
109
            inState = !!super.get_row_expansion_state(record);
109✔
110
        }
111
        return inState && (this.grid as any).childLayoutList.length !== 0;
109!
112
    }
113

114
    public override allow_expansion_state_change(rowID, expanded): boolean {
UNCOV
115
        const rec = this.get_rec_by_id(rowID);
×
UNCOV
116
        const grid = (this.grid as any);
×
UNCOV
117
        if (grid.hasChildrenKey && !rec[grid.hasChildrenKey]) {
×
UNCOV
118
            return false;
×
119
        }
UNCOV
120
        return !!rec && this.grid.expansionStates.get(rowID) !== expanded;
×
121
    }
122

123
    public override get_rec_by_id(rowID): any {
UNCOV
124
        const data = this.get_all_data(false);
×
UNCOV
125
        const index = this.get_row_index_in_data(rowID, data);
×
UNCOV
126
        return data[index];
×
127
    }
128
}
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