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

IgniteUI / igniteui-angular / 12072443768

28 Nov 2024 04:16PM UTC coverage: 91.621%. Remained the same
12072443768

Pull #15120

github

web-flow
fix(excel-style-filtering): reset filter value (#15090)

* fix(esf): show filters based on column name

* fix(esf-custom-dialog): filter expressionsList by column name

* chore(*): revert changes after branch retarget

---------

Co-authored-by: RadoMirchev <radoslav.p.mirchev@gmail.com>
Co-authored-by: Konstantin Dinev <kdinev@mail.bw.edu>
Co-authored-by: Galina Edinakova <gedinakova@infragistics.com>
Pull Request #15120: Mass Merge 19.0.x to master

12969 of 15202 branches covered (85.31%)

54 of 65 new or added lines in 14 files covered. (83.08%)

111 existing lines in 6 files now uncovered.

26309 of 28715 relevant lines covered (91.62%)

34021.05 hits per line

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

90.16
/projects/igniteui-angular/src/lib/input-group/input-group.component.ts
1
import { DOCUMENT, NgIf, NgTemplateOutlet, NgClass, NgSwitch, NgSwitchCase, NgSwitchDefault } from '@angular/common';
2
import {
3
    AfterViewChecked,
4
    ChangeDetectorRef,
5
    Component,
6
    ContentChild,
7
    ContentChildren,
8
    ElementRef,
9
    HostBinding,
10
    HostListener, Inject, Input,
11
    OnDestroy,
12
    Optional, QueryList, booleanAttribute
13
} from '@angular/core';
14
import { IInputResourceStrings, InputResourceStringsEN } from '../core/i18n/input-resources';
15
import { PlatformUtil } from '../core/utils';
16
import { IgxButtonDirective } from '../directives/button/button.directive';
17
import { IgxHintDirective } from '../directives/hint/hint.directive';
18
import {
19
    IgxInputDirective,
20
    IgxInputState
21
} from '../directives/input/input.directive';
22
import { IgxPrefixDirective } from '../directives/prefix/prefix.directive';
23
import { IgxSuffixDirective } from '../directives/suffix/suffix.directive';
24

25
import { IgxInputGroupBase } from './input-group.common';
26
import { IgxInputGroupType, IGX_INPUT_GROUP_TYPE } from './inputGroupType';
27
import { IgxIconComponent } from '../icon/icon.component';
28
import { getCurrentResourceStrings } from '../core/i18n/resources';
29
import { IgxTheme, ThemeService } from '../services/theme/theme.service';
30
import { Subject, Subscription } from 'rxjs';
31

32
@Component({
33
    selector: 'igx-input-group',
34
    templateUrl: 'input-group.component.html',
35
    providers: [{ provide: IgxInputGroupBase, useExisting: IgxInputGroupComponent }],
36
    imports: [NgIf, NgTemplateOutlet, IgxPrefixDirective, IgxButtonDirective, NgClass, IgxSuffixDirective, IgxIconComponent, NgSwitch, NgSwitchCase, NgSwitchDefault]
37
})
38
export class IgxInputGroupComponent implements IgxInputGroupBase, AfterViewChecked, OnDestroy {
2✔
39
    /**
40
     * Sets the resource strings.
41
     * By default it uses EN resources.
42
     */
43
    @Input()
44
    public set resourceStrings(value: IInputResourceStrings) {
45
        this._resourceStrings = Object.assign({}, this._resourceStrings, value);
×
46
    }
47

48
    /**
49
     * Returns the resource strings.
50
     */
51
    public get resourceStrings(): IInputResourceStrings {
52
        return this._resourceStrings;
57✔
53
    }
54

55
    /**
56
     * Property that enables/disables the auto-generated class of the `IgxInputGroupComponent`.
57
     * By default applied the class is applied.
58
     * ```typescript
59
     *  @ViewChild("MyInputGroup")
60
     *  public inputGroup: IgxInputGroupComponent;
61
     *  ngAfterViewInit(){
62
     *  this.inputGroup.defaultClass = false;
63
     * ```
64
     * }
65
     */
66
    @HostBinding('class.igx-input-group')
67
    public defaultClass = true;
2,492✔
68

69
    /** @hidden */
70
    @HostBinding('class.igx-input-group--placeholder')
71
    public hasPlaceholder = false;
2,492✔
72

73
    /** @hidden */
74
    @HostBinding('class.igx-input-group--required')
75
    public isRequired = false;
2,492✔
76

77
    /** @hidden */
78
    @HostBinding('class.igx-input-group--focused')
79
    public isFocused = false;
2,492✔
80

81
    /**
82
     * @hidden @internal
83
     * When truthy, disables the `IgxInputGroupComponent`.
84
     * Controlled by the underlying `IgxInputDirective`.
85
     * ```html
86
     * <igx-input-group [disabled]="true"></igx-input-group>
87
     * ```
88
     */
89
    @HostBinding('class.igx-input-group--disabled')
90
    public disabled = false;
2,492✔
91

92
    /**
93
     * Prevents automatically focusing the input when clicking on other elements in the input group (e.g. prefix or suffix).
94
     *
95
     * @remarks Automatic focus causes software keyboard to show on mobile devices.
96
     *
97
     * @example
98
     * ```html
99
     * <igx-input-group [suppressInputAutofocus]="true"></igx-input-group>
100
     * ```
101
     */
102
    @Input({ transform: booleanAttribute })
103
    public suppressInputAutofocus = false;
2,492✔
104

105
    /** @hidden */
106
    @HostBinding('class.igx-input-group--warning')
107
    public hasWarning = false;
2,492✔
108

109
    /** @hidden */
110
    @ContentChildren(IgxHintDirective, { read: IgxHintDirective })
111
    protected hints: QueryList<IgxHintDirective>;
112

113
    @ContentChildren(IgxPrefixDirective, { read: IgxPrefixDirective, descendants: true })
114
    protected _prefixes: QueryList<IgxPrefixDirective>;
115

116
    @ContentChildren(IgxSuffixDirective, { read: IgxSuffixDirective, descendants: true })
117
    protected _suffixes: QueryList<IgxSuffixDirective>;
118

119
    /** @hidden */
120
    @ContentChild(IgxInputDirective, { read: IgxInputDirective, static: true })
121
    protected input: IgxInputDirective;
122

123
    private _type: IgxInputGroupType = null;
2,492✔
124
    private _filled = false;
2,492✔
125
    private _theme: IgxTheme;
126
    private _theme$ = new Subject<IgxTheme>();
2,492✔
127
    private _subscription: Subscription;
128
    private _resourceStrings = getCurrentResourceStrings(InputResourceStringsEN);
2,492✔
129

130
    /** @hidden */
131
    @HostBinding('class.igx-input-group--valid')
132
    public get validClass(): boolean {
133
        return this.input.valid === IgxInputState.VALID;
26,805✔
134
    }
135

136
    /** @hidden */
137
    @HostBinding('class.igx-input-group--invalid')
138
    public get invalidClass(): boolean {
139
        return this.input.valid === IgxInputState.INVALID;
26,805✔
140
    }
141

142
    /** @hidden */
143
    @HostBinding('class.igx-input-group--filled')
144
    public get isFilled() {
145
        return this._filled || (this.input && this.input.value);
26,897✔
146
    }
147

148
    /** @hidden */
149
    @HostBinding('class.igx-input-group--textarea-group')
150
    public get textAreaClass(): boolean {
151
        return this.input.isTextArea;
26,805✔
152
    }
153

154
    /**
155
     * Sets how the input will be styled.
156
     * Allowed values of type IgxInputGroupType.
157
     * ```html
158
     * <igx-input-group [type]="'search'">
159
     * ```
160
     */
161
    @Input()
162
    public set type(value: IgxInputGroupType) {
163
        this._type = value;
1,671✔
164
    }
165

166
    /**
167
     * Returns the type of the `IgxInputGroupComponent`. How the input is styled.
168
     * The default is `line`.
169
     * ```typescript
170
     * @ViewChild("MyInputGroup")
171
     * public inputGroup: IgxInputGroupComponent;
172
     * ngAfterViewInit(){
173
     *    let inputType = this.inputGroup.type;
174
     * }
175
     * ```
176
     */
177
    public get type() {
178
        return this._type || this._inputGroupType || 'line';
207,560✔
179
    }
180

181
    /**
182
     * Sets the theme of the input.
183
     * Allowed values of type IgxInputGroupTheme.
184
     * ```typescript
185
     * @ViewChild("MyInputGroup")
186
     * public inputGroup: IgxInputGroupComponent;
187
     * ngAfterViewInit() {
188
     *  let inputTheme = 'fluent';
189
     * }
190
     */
191
    @Input()
192
    public set theme(value: IgxTheme) {
UNCOV
193
        this._theme = value;
×
194
    }
195

196
    /**
197
     * Returns the theme of the input.
198
     * The returned value is of type IgxInputGroupType.
199
     * ```typescript
200
     * @ViewChild("MyInputGroup")
201
     * public inputGroup: IgxInputGroupComponent;
202
     * ngAfterViewInit() {
203
     *  let inputTheme = this.inputGroup.theme;
204
     * }
205
     */
206
    public get theme(): IgxTheme {
207
        return this._theme;
47,336✔
208
    }
209

210
    constructor(
211
        public element: ElementRef<HTMLElement>,
2,492✔
212
        @Optional()
213
        @Inject(IGX_INPUT_GROUP_TYPE)
214
        private _inputGroupType: IgxInputGroupType,
2,492✔
215
        @Inject(DOCUMENT)
216
        private document: any,
2,492✔
217
        private platform: PlatformUtil,
2,492✔
218
        private cdr: ChangeDetectorRef,
2,492✔
219
        private themeService: ThemeService,
2,492✔
220
    ) {
221
        this._theme = this.themeService.globalTheme;
2,492✔
222

223
        this._subscription = this._theme$.asObservable().subscribe(value => {
2,492✔
224
            this._theme = value as IgxTheme;
20,531✔
225
            this.cdr.detectChanges();
20,531✔
226
        });
227
    }
228

229
    /** @hidden */
230
    @HostListener('click', ['$event'])
231
    public onClick(event: MouseEvent) {
232
        if (
150✔
233
            !this.isFocused &&
303✔
234
            event.target !== this.input.nativeElement &&
235
            !this.suppressInputAutofocus
236
        ) {
237
            this.input.focus();
66✔
238
        }
239
    }
240

241
    /** @hidden */
242
    @HostListener('pointerdown', ['$event'])
243
    public onPointerDown(event: PointerEvent) {
244
        if (this.isFocused && event.target !== this.input.nativeElement) {
11✔
245
            event.preventDefault();
3✔
246
        }
247
    }
248

249
    /** @hidden @internal */
250
    public hintClickHandler(event: MouseEvent) {
251
        event.stopPropagation();
2✔
252
    }
253

254
    /**
255
     * Returns whether the `IgxInputGroupComponent` has hints.
256
     * ```typescript
257
     * @ViewChild("MyInputGroup")
258
     * public inputGroup: IgxInputGroupComponent;
259
     * ngAfterViewInit(){
260
     *    let inputHints = this.inputGroup.hasHints;
261
     * }
262
     * ```
263
     */
264
    public get hasHints() {
UNCOV
265
        return this.hints.length > 0;
×
266
    }
267

268
    /** @hidden @internal */
269
    @HostBinding('class.igx-input-group--prefixed')
270
    public get hasPrefixes() {
271
        return this._prefixes.length > 0 || this.isFileType;
26,805✔
272
    }
273

274
    /** @hidden @internal */
275
    public set prefixes(items: QueryList<IgxPrefixDirective>) {
276
        this._prefixes = items;
448✔
277
    }
278

279
    /** @hidden @internal */
280
    @HostBinding('class.igx-input-group--suffixed')
281
    public get hasSuffixes() {
282
        return this._suffixes.length > 0 || this.isFileType && this.isFilled;
26,805✔
283
    }
284

285
    /** @hidden @internal */
286
    public set suffixes(items: QueryList<IgxPrefixDirective>) {
287
        this._suffixes = items;
35✔
288
    }
289

290
    /**
291
     * Returns whether the `IgxInputGroupComponent` has border.
292
     * ```typescript
293
     * @ViewChild("MyInputGroup")
294
     * public inputGroup: IgxInputGroupComponent;
295
     * ngAfterViewInit(){
296
     *    let inputBorder = this.inputGroup.hasBorder;
297
     * }
298
     * ```
299
     */
300
    public get hasBorder() {
301
        return (
47,336✔
302
            (this.type === 'line' || this.type === 'box') &&
122,421✔
303
            this._theme === 'material'
304
        );
305
    }
306

307
    /**
308
     * Returns whether the `IgxInputGroupComponent` type is line.
309
     * ```typescript
310
     * @ViewChild("MyInputGroup1")
311
     * public inputGroup: IgxInputGroupComponent;
312
     * ngAfterViewInit(){
313
     *    let isTypeLine = this.inputGroup.isTypeLine;
314
     * }
315
     * ```
316
     */
317
    public get isTypeLine(): boolean {
318
        return this.type === 'line' && this._theme === 'material';
67✔
319
    }
320

321
    /**
322
     * Returns whether the `IgxInputGroupComponent` type is box.
323
     * ```typescript
324
     * @ViewChild("MyInputGroup1")
325
     * public inputGroup: IgxInputGroupComponent;
326
     * ngAfterViewInit(){
327
     *    let isTypeBox = this.inputGroup.isTypeBox;
328
     * }
329
     * ```
330
     */
331
    @HostBinding('class.igx-input-group--box')
332
    public get isTypeBox() {
333
        return this.type === 'box' && this._theme === 'material';
74,151✔
334
    }
335

336
    /** @hidden @internal */
337
    public uploadButtonHandler() {
UNCOV
338
        this.input.nativeElement.click();
×
339
    }
340

341
    /** @hidden @internal */
342
    public clearValueHandler() {
343
        this.input.clear();
2✔
344
    }
345

346
    /** @hidden @internal */
347
    @HostBinding('class.igx-input-group--file')
348
    public get isFileType() {
349
        return this.input.type === 'file';
192,331✔
350
    }
351

352
    /** @hidden @internal */
353
    public get fileNames() {
354
        return this.input.fileNames || this._resourceStrings.igx_input_file_placeholder;
114✔
355
    }
356

357
    /**
358
     * Returns whether the `IgxInputGroupComponent` type is border.
359
     * ```typescript
360
     * @ViewChild("MyInputGroup1")
361
     * public inputGroup: IgxInputGroupComponent;
362
     * ngAfterViewInit(){
363
     *    let isTypeBorder = this.inputGroup.isTypeBorder;
364
     * }
365
     * ```
366
     */
367
    @HostBinding('class.igx-input-group--border')
368
    public get isTypeBorder() {
369
        return this.type === 'border' && this._theme === 'material';
26,815✔
370
    }
371

372
    /**
373
     * Returns true if the `IgxInputGroupComponent` theme is Fluent.
374
     * ```typescript
375
     * @ViewChild("MyInputGroup1")
376
     * public inputGroup: IgxInputGroupComponent;
377
     * ngAfterViewInit(){
378
     *    let isTypeFluent = this.inputGroup.isTypeFluent;
379
     * }
380
     * ```
381
     */
382
    @HostBinding('class.igx-input-group--fluent')
383
    public get isTypeFluent() {
384
        return this._theme === 'fluent';
26,805✔
385
    }
386

387
    /**
388
     * Returns true if the `IgxInputGroupComponent` theme is Bootstrap.
389
     * ```typescript
390
     * @ViewChild("MyInputGroup1")
391
     * public inputGroup: IgxInputGroupComponent;
392
     * ngAfterViewInit(){
393
     *    let isTypeBootstrap = this.inputGroup.isTypeBootstrap;
394
     * }
395
     * ```
396
     */
397
    @HostBinding('class.igx-input-group--bootstrap')
398
    public get isTypeBootstrap() {
399
        return this._theme === 'bootstrap';
26,805✔
400
    }
401

402
    /**
403
     * Returns true if the `IgxInputGroupComponent` theme is Indigo.
404
     * ```typescript
405
     * @ViewChild("MyInputGroup1")
406
     * public inputGroup: IgxInputGroupComponent;
407
     * ngAfterViewInit(){
408
     *    let isTypeIndigo = this.inputGroup.isTypeIndigo;
409
     * }
410
     * ```
411
     */
412
    @HostBinding('class.igx-input-group--indigo')
413
    public get isTypeIndigo() {
414
        return this._theme === 'indigo';
26,805✔
415
    }
416

417
    /**
418
     * Returns whether the `IgxInputGroupComponent` type is search.
419
     * ```typescript
420
     * @ViewChild("MyInputGroup1")
421
     * public inputGroup: IgxInputGroupComponent;
422
     * ngAfterViewInit(){
423
     *    let isTypeSearch = this.inputGroup.isTypeSearch;
424
     * }
425
     * ```
426
     */
427
    @HostBinding('class.igx-input-group--search')
428
    public get isTypeSearch() {
429
        return this.type === 'search';
26,815✔
430
    }
431

432
    /** @hidden */
433
    public get filled() {
UNCOV
434
        return this._filled;
×
435
    }
436

437
    /** @hidden */
438
    public set filled(val) {
UNCOV
439
        this._filled = val;
×
440
    }
441

442
    /** @hidden @internal */
443
    public ngAfterViewChecked() {
444
        const theme = this.themeService.getComponentTheme(this.element);
21,187✔
445

446
        if (theme) {
21,187✔
447
            this._theme$.next(theme);
20,531✔
448
            this.cdr.markForCheck();
20,531✔
449
        }
450
    }
451

452
    /** @hidden @internal */
453
    public ngOnDestroy() {
454
        this._subscription.unsubscribe();
2,470✔
455
    }
456
}
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

© 2026 Coveralls, Inc