• 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.08
/projects/igniteui-angular/src/lib/grids/columns/column-layout.component.ts
1
import {
2
    AfterContentInit,
3
    Component,
4
    ChangeDetectionStrategy,
5
    forwardRef,
6
    Input,
7
    booleanAttribute
8
} from '@angular/core';
9
import { IgxColumnComponent } from './column.component';
10
import { IgxColumnGroupComponent } from './column-group.component';
11

12
/* blazorIndirectRender */
13
/* blazorElement */
14
/* omitModule */
15
/* wcElementTag: igc-column-layout */
16
/* additionalIdentifier: Children.Field */
17
/* jsonAPIManageCollectionInMarkup */
18
/**
19
 * Column layout for declaration of Multi-row Layout
20
 *
21
 * @igxParent IgxGridComponent
22
 */
23
@Component({
24
    changeDetection: ChangeDetectionStrategy.OnPush,
UNCOV
25
    providers: [{ provide: IgxColumnComponent, useExisting: forwardRef(() => IgxColumnLayoutComponent) }],
×
26
    selector: 'igx-column-layout',
27
    template: `@if (platform.isElements) {
28
        <div #sink style="display: none;">
29
            <ng-content select="igx-column,igc-column"></ng-content>
30
        </div>
31
    }`,
32
    standalone: true
33
})
34
export class IgxColumnLayoutComponent extends IgxColumnGroupComponent implements AfterContentInit {
2✔
35
    /** @hidden @internal **/
UNCOV
36
    public childrenVisibleIndexes = [];
×
37
    /**
38
     * Gets the width of the column layout.
39
     * ```typescript
40
     * let columnGroupWidth = this.columnGroup.width;
41
     * ```
42
     *
43
     * @memberof IgxColumnGroupComponent
44
     */
45
    public override get width(): any {
UNCOV
46
        const width = this.getFilledChildColumnSizes(this.children).reduce((acc, val) => acc + parseFloat(val), 0);
×
UNCOV
47
        return width;
×
48
    }
49

50
    /* blazorSuppress */
51
    public override set width(val: any) { }
52

53
    public override get columnLayout() {
UNCOV
54
        return true;
×
55
    }
56

57
    /**
58
     * @hidden
59
     */
60
    public override getCalcWidth(): any {
UNCOV
61
        let borderWidth = 0;
×
62

UNCOV
63
        if (this.headerGroup && this.headerGroup.hasLastPinnedChildColumn) {
×
UNCOV
64
            const headerStyles = this.grid.document.defaultView.getComputedStyle(this.headerGroup.nativeElement.children[0]);
×
UNCOV
65
            borderWidth = parseFloat(headerStyles.borderRightWidth);
×
66
        }
67

UNCOV
68
        return super.getCalcWidth() + borderWidth;
×
69
    }
70

71
    /**
72
     * Gets the column visible index.
73
     * If the column is not visible, returns `-1`.
74
     * ```typescript
75
     * let visibleColumnIndex =  this.column.visibleIndex;
76
     * ```
77
     *
78
     * @memberof IgxColumnComponent
79
     */
80
    public override get visibleIndex(): number {
UNCOV
81
        if (!isNaN(this._vIndex)) {
×
UNCOV
82
            return this._vIndex;
×
83
        }
84

UNCOV
85
        const unpinnedColumns = this.grid.unpinnedColumns.filter(c => c.columnLayout && !c.hidden);
×
UNCOV
86
        const pinnedColumns = this.grid.pinnedColumns.filter(c => c.columnLayout && !c.hidden);
×
UNCOV
87
        let vIndex = -1;
×
88

UNCOV
89
        if (!this.pinned) {
×
UNCOV
90
            const indexInCollection = unpinnedColumns.indexOf(this);
×
UNCOV
91
            vIndex = indexInCollection === -1 ? -1 : pinnedColumns.length + indexInCollection;
×
92
        } else {
UNCOV
93
            vIndex = pinnedColumns.indexOf(this);
×
94
        }
UNCOV
95
        this._vIndex = vIndex;
×
UNCOV
96
        return vIndex;
×
97
    }
98

99
    /*
100
     * Gets whether the column layout is hidden.
101
     * ```typescript
102
     * let isHidden = this.columnGroup.hidden;
103
     * ```
104
     * @memberof IgxColumnGroupComponent
105
     */
106
    @Input({ transform: booleanAttribute })
107
    public override get hidden() {
UNCOV
108
        return this._hidden;
×
109
    }
110

111
     /* blazorSuppress */
112
    /**
113
     * Sets the column layout hidden property.
114
     * ```typescript
115
     * <igx-column-layout [hidden] = "true"></igx-column->
116
     * ```
117
     *
118
     * @memberof IgxColumnGroupComponent
119
     */
120
    public override set hidden(value: boolean) {
UNCOV
121
        this._hidden = value;
×
UNCOV
122
        this.children.forEach(child => child.hidden = value);
×
UNCOV
123
        if (this.grid && this.grid.columns && this.grid.columns.length > 0) {
×
124
            // reset indexes in case columns are hidden/shown runtime
UNCOV
125
            const columns = this.grid && this.grid.pinnedColumns && this.grid.unpinnedColumns ?
×
126
                this.grid.pinnedColumns.concat(this.grid.unpinnedColumns) : [];
UNCOV
127
            if (!this._hidden && !columns.find(c => c.field === this.field)) {
×
UNCOV
128
                this.grid.resetColumnCollections();
×
129
            }
UNCOV
130
            this.grid.columns.filter(x => x.columnLayout).forEach(x => x.populateVisibleIndexes());
×
131
        }
132
    }
133

134
    /**
135
     * @hidden
136
     */
137
    public override ngAfterContentInit() {
UNCOV
138
        super.ngAfterContentInit();
×
UNCOV
139
        if (!this.hidden) {
×
UNCOV
140
            this.hidden = this.allChildren.some(x => x.hidden);
×
141
        } else {
UNCOV
142
            this.children.forEach(child => child.hidden = this.hidden);
×
143
        }
144
    }
145

146
    /** @hidden @internal **/
147
    public get hasLastPinnedChildColumn() {
UNCOV
148
        return this.children.some(child => child.isLastPinned);
×
149
    }
150

151
    /** @hidden @internal **/
152
    public get hasFirstPinnedChildColumn() {
UNCOV
153
        return this.children.some(child => child.isFirstPinned);
×
154
    }
155

156
    /**
157
     * @hidden
158
     */
159
    public override populateVisibleIndexes() {
UNCOV
160
        this.childrenVisibleIndexes = [];
×
UNCOV
161
        const columns = this.grid?.pinnedColumns && this.grid?.unpinnedColumns
×
162
            ? this.grid.pinnedColumns.concat(this.grid.unpinnedColumns)
163
            : [];
UNCOV
164
        const orderedCols = columns
×
UNCOV
165
            .filter(x => !x.columnGroup && !x.hidden)
×
UNCOV
166
            .sort((a, b) => a.rowStart - b.rowStart || columns.indexOf(a.parent) - columns.indexOf(b.parent) || a.colStart - b.colStart);
×
UNCOV
167
        this.children.forEach(child => {
×
UNCOV
168
            const rs = child.rowStart || 1;
×
UNCOV
169
            let vIndex = 0;
×
170
            // filter out all cols with larger rowStart
UNCOV
171
            const cols = orderedCols.filter(c =>
×
UNCOV
172
                !c.columnGroup && (c.rowStart || 1) <= rs);
×
UNCOV
173
            vIndex = cols.indexOf(child);
×
UNCOV
174
            this.childrenVisibleIndexes.push({ column: child, index: vIndex });
×
175
        });
176
    }
177
}
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