Skip to content

fix(combo/select): remove suffix dynamically #15961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions projects/igniteui-angular/src/lib/combo/combo.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import {
Output,
QueryList,
TemplateRef,
ViewChild
ViewChild,
ViewChildren
} from '@angular/core';
import { AbstractControl, ControlValueAccessor, NgControl } from '@angular/forms';
import { caseSensitive } from '@igniteui/material-icons-extended';
Expand Down Expand Up @@ -748,6 +749,9 @@ export abstract class IgxComboBaseDirective implements IgxComboBase, AfterViewCh
@ContentChildren(IgxSuffixDirective, { descendants: true })
protected suffixes: QueryList<IgxSuffixDirective>;

@ViewChildren(IgxSuffixDirective)
protected internalSuffixes: QueryList<IgxSuffixDirective>;

/** @hidden @internal */
public get searchValue(): string {
return this._searchValue;
Expand Down Expand Up @@ -984,8 +988,15 @@ export abstract class IgxComboBaseDirective implements IgxComboBase, AfterViewCh
this.inputGroup.prefixes = this.prefixes;
}

if (this.inputGroup && this.suffixes?.length > 0) {
this.inputGroup.suffixes = this.suffixes;
if (this.inputGroup) {
const suffixesArray = this.suffixes?.toArray() ?? [];
const internalSuffixesArray = this.internalSuffixes?.toArray() ?? [];
const mergedSuffixes = new QueryList<IgxSuffixDirective>();
mergedSuffixes.reset([
...suffixesArray,
...internalSuffixesArray
]);
this.inputGroup.suffixes = mergedSuffixes;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export class IgxInputGroupComponent implements IgxInputGroupBase {
}

/** @hidden @internal */
public set suffixes(items: QueryList<IgxPrefixDirective>) {
public set suffixes(items: QueryList<IgxSuffixDirective>) {
this._suffixes = items;
}

Expand Down
15 changes: 13 additions & 2 deletions projects/igniteui-angular/src/lib/select/select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
QueryList,
TemplateRef,
ViewChild,
ViewChildren,
ViewEncapsulation
} from '@angular/core';
import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
Expand Down Expand Up @@ -120,6 +121,9 @@ export class IgxSelectComponent extends IgxDropDownComponent implements IgxSelec
@ContentChildren(IgxSuffixDirective, { descendants: true })
protected suffixes: QueryList<IgxSuffixDirective>;

@ViewChildren(IgxSuffixDirective)
protected internalSuffixes: QueryList<IgxSuffixDirective>;

/** @hidden @internal */
@ContentChild(forwardRef(() => IgxLabelDirective), { static: true }) public label: IgxLabelDirective;

Expand Down Expand Up @@ -542,8 +546,15 @@ export class IgxSelectComponent extends IgxDropDownComponent implements IgxSelec
this.inputGroup.prefixes = this.prefixes;
}

if (this.inputGroup && this.suffixes?.length > 0) {
this.inputGroup.suffixes = this.suffixes;
if (this.inputGroup) {
const suffixesArray = this.suffixes?.toArray() ?? [];
const internalSuffixesArray = this.internalSuffixes?.toArray() ?? [];
const mergedSuffixes = new QueryList<IgxSuffixDirective>();
mergedSuffixes.reset([
...suffixesArray,
...internalSuffixesArray
]);
this.inputGroup.suffixes = mergedSuffixes;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class InputGroupShowcaseSampleComponent {
}
},
hideSuffix: {
label: 'Hide Suffix using( [hidden] )',
label: 'Hide Suffix',
control: {
type: 'boolean',
defaultValue: false
Expand Down