• 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

5.41
/projects/igniteui-angular/src/lib/grids/toolbar/grid-toolbar.base.ts
1
import { Directive, Input, EventEmitter, OnDestroy, Output, Inject, booleanAttribute } from '@angular/core';
2
import { Subject, Subscription } from 'rxjs';
3
import { first, takeUntil } from 'rxjs/operators';
4

5
import { AbsoluteScrollStrategy } from '../../services/overlay/scroll/absolute-scroll-strategy';
6
import { ColumnDisplayOrder } from '../common/enums';
7
import { IColumnToggledEventArgs } from '../common/events';
8
import { IgxColumnActionsComponent } from '../column-actions/column-actions.component';
9
import { IgxToggleDirective, ToggleViewCancelableEventArgs, ToggleViewEventArgs } from '../../directives/toggle/toggle.directive';
10
import { HorizontalAlignment, OverlaySettings, VerticalAlignment } from '../../services/overlay/utilities';
11
import { IgxToolbarToken } from './token';
12
import { ConnectedPositioningStrategy } from '../../services/overlay/position/connected-positioning-strategy';
13

14
/* blazorInclude */
15
/* blazorElement */
16
/* blazorIndirectRender */
17
/* blazorAlternateBaseType: GridToolbarBaseAction */
18
/**
19
 * Base class for the pinning/hiding column and exporter actions.
20
 *
21
 * @hidden @internal
22
 */
23
@Directive()
24
export abstract class BaseToolbarDirective implements OnDestroy {
2✔
25
    /**
26
     * Sets the height of the column list in the dropdown.
27
     */
28
    @Input()
29
    public columnListHeight: string;
30

31
    /**
32
     * Title text for the column action component
33
     */
34
    @Input()
35
    public title: string;
36

37
    /**
38
     * The placeholder text for the search input.
39
     */
40
    @Input()
41
    public prompt: string;
42

43
    /**
44
     * Sets overlay settings
45
     */
46
    @Input()
47
    public set overlaySettings(overlaySettings: OverlaySettings) {
UNCOV
48
        this._overlaySettings = overlaySettings;
×
49
    }
50

51
    /**
52
     * Returns overlay settings
53
     */
54
    public get overlaySettings(): OverlaySettings {
UNCOV
55
        return this._overlaySettings;
×
56
    }
57
    /**
58
     * Emits an event before the toggle container is opened.
59
     */
60
    @Output()
UNCOV
61
    public opening = new EventEmitter<ToggleViewCancelableEventArgs>();
×
62
    /**
63
     * Emits an event after the toggle container is opened.
64
     */
65

66
    @Output()
UNCOV
67
    public opened = new EventEmitter<ToggleViewEventArgs>();
×
68
    /**
69
     * Emits an event before the toggle container is closed.
70
     */
71

72
    @Output()
UNCOV
73
    public closing = new EventEmitter<ToggleViewEventArgs>();
×
74
    /**
75
     * Emits an event after the toggle container is closed.
76
     */
77

78
    @Output()
UNCOV
79
    public closed = new EventEmitter<ToggleViewEventArgs>();
×
80

81
    /**
82
     * Emits when after a column's checked state is changed
83
     */
84
    @Output()
UNCOV
85
    public columnToggle = new EventEmitter<IColumnToggledEventArgs>();
×
86

UNCOV
87
    private $destroy = new Subject<void>();
×
88
    private $sub: Subscription;
89

UNCOV
90
    private _overlaySettings: OverlaySettings = {
×
91
        positionStrategy: new ConnectedPositioningStrategy({
92
            horizontalDirection: HorizontalAlignment.Left,
93
            horizontalStartPoint: HorizontalAlignment.Right,
94
            verticalDirection: VerticalAlignment.Bottom,
95
            verticalStartPoint: VerticalAlignment.Bottom
96
        }),
97
        scrollStrategy: new AbsoluteScrollStrategy(),
98
        modal: false,
99
        closeOnEscape: true,
100
        closeOnOutsideClick: true
101
    };
102

103
    /**
104
     * Returns the grid containing this component.
105
     * @hidden @internal
106
     */
107
    public get grid() {
UNCOV
108
        return this.toolbar.grid;
×
109
    }
110

UNCOV
111
    constructor(@Inject(IgxToolbarToken) protected toolbar: IgxToolbarToken) { }
×
112

113
    /** @hidden @internal **/
114
    public ngOnDestroy() {
UNCOV
115
        this.$destroy.next();
×
UNCOV
116
        this.$destroy.complete();
×
117
    }
118

119
    /** @hidden @internal */
120
    public toggle(anchorElement: HTMLElement, toggleRef: IgxToggleDirective, actions?: IgxColumnActionsComponent): void {
UNCOV
121
        if (actions) {
×
UNCOV
122
            this._setupListeners(toggleRef, actions);
×
UNCOV
123
            const setHeight = () =>
×
UNCOV
124
                actions.columnsAreaMaxHeight = actions.columnsAreaMaxHeight !== '100%'
×
125
                    ? actions.columnsAreaMaxHeight :
126
                    this.columnListHeight ??
×
127
                    `${Math.max(this.grid.calcHeight * 0.5, 200)}px`;
UNCOV
128
            toggleRef.opening.pipe(first()).subscribe(setHeight);
×
129
        }
UNCOV
130
        toggleRef.toggle({
×
131
            ...this.overlaySettings, ...{
132
                target: anchorElement, outlet: this.grid.outlet,
133
                excludeFromOutsideClick: [anchorElement]
134
            }
135
        });
136

137
    }
138

139
    /** @hidden @internal */
140
    public focusSearch(columnActions: HTMLElement) {
UNCOV
141
        columnActions.querySelector('input')?.focus();
×
142
    }
143

144
    private _setupListeners(toggleRef: IgxToggleDirective, actions?: IgxColumnActionsComponent) {
UNCOV
145
        if (actions) {
×
UNCOV
146
            if (!this.$sub || this.$sub.closed) {
×
UNCOV
147
                this.$sub = actions.columnToggled.pipe(takeUntil(this.$destroy)).subscribe((event) => this.columnToggle.emit(event));
×
148
            }
149
        }
150
        /** The if statement prevents emitting open and close events twice  */
UNCOV
151
        if (toggleRef.collapsed) {
×
UNCOV
152
            toggleRef.opening.pipe(first(), takeUntil(this.$destroy)).subscribe((event) => this.opening.emit(event));
×
UNCOV
153
            toggleRef.opened.pipe(first(), takeUntil(this.$destroy)).subscribe((event) => this.opened.emit(event));
×
154
        } else {
UNCOV
155
            toggleRef.closing.pipe(first(), takeUntil(this.$destroy)).subscribe((event) => this.closing.emit(event));
×
UNCOV
156
            toggleRef.closed.pipe(first(), takeUntil(this.$destroy)).subscribe((event) => this.closed.emit(event));
×
157
        }
158
    }
159
}
160

161
/* blazorElement */
162
/* blazorIndirectRender */
163
/**
164
 * @hidden @internal
165
 * Base class for pinning/hiding column actions
166
 */
167
@Directive()
168
export abstract class BaseToolbarColumnActionsDirective extends BaseToolbarDirective {
2✔
169
    @Input({ transform: booleanAttribute })
UNCOV
170
    public hideFilter = false;
×
171

172
    @Input()
UNCOV
173
    public filterCriteria = '';
×
174

175
    @Input()
UNCOV
176
    public columnDisplayOrder: ColumnDisplayOrder = ColumnDisplayOrder.DisplayOrder;
×
177

178
    @Input()
UNCOV
179
    public columnsAreaMaxHeight = '100%';
×
180

181
    @Input()
182
    public uncheckAllText: string;
183

184
    @Input()
185
    public checkAllText: string;
186

187
    @Input()
UNCOV
188
    public indentetion = 30;
×
189

190
    @Input()
191
    public buttonText: string;
192

193
    protected columnActionsUI: IgxColumnActionsComponent;
194

195
    public checkAll() {
196
        this.columnActionsUI.checkAllColumns();
×
197
    }
198

199
    public uncheckAll() {
200
        this.columnActionsUI.uncheckAllColumns();
×
201
    }
202
}
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