Skip to content

Commit 70cf3e8

Browse files
authored
Merge branch 'master' into bpachilova/feat-14928-primaryKey-warning
2 parents d582093 + d5df92a commit 70cf3e8

File tree

4 files changed

+46
-10
lines changed

4 files changed

+46
-10
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ All notable changes for each version of this project will be documented in this
4343
- When possible the state directive nows reuses the column that already exists on the grid when restoring the state, instead of creating new column instances every time. This removes the need to set any complex objects manually back on the column on `columnInit`. The only instance where this is still necessary is when the column (or its children in case of column groups) have no `field` property so there's no way to uniquely identify the matching column.
4444
- Added support for persisting Multi-Row Layout.
4545
### Themes
46-
- `Palettes`
46+
- **Breaking Change** `Palettes`
4747
- All palette colors have been migrated to the [CSS relative colors syntax](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_colors/Relative_colors). This means that color consumed as CSS variables no longer need to be wrapped in an `hsl` function.
4848

4949
Example:
5050
```css
5151
/* 18.1.x and before: */
52-
background: hsl(var(--igx-primary-600));
52+
background: hsl(var(--ig-primary-600));
5353

5454
/* 18.2.0+: */
55-
background: var(--igx-primary-600);
55+
background: var(--ig-primary-600);
5656
```
5757

5858
This change also opens up the door for declaring the base (500) variants of each color in CSS from any color, including other CSS variables, whereas before the Sass `palette` function was needed to generate color shades from a base color.

projects/igniteui-angular/src/lib/combo/combo.common.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,9 @@ export abstract class IgxComboBaseDirective implements IgxComboBase, AfterViewCh
12141214
/** @hidden @internal */
12151215
public handleClosed() {
12161216
this.closed.emit({ owner: this });
1217+
if(this.comboInput.nativeElement !== this.document.activeElement){
1218+
this.validateComboState();
1219+
}
12171220
}
12181221

12191222
/** @hidden @internal */
@@ -1253,14 +1256,15 @@ export abstract class IgxComboBaseDirective implements IgxComboBase, AfterViewCh
12531256
public onBlur() {
12541257
if (this.collapsed) {
12551258
this._onTouchedCallback();
1256-
if (this.ngControl && this.ngControl.invalid) {
1257-
this.valid = IgxInputState.INVALID;
1258-
} else {
1259-
this.valid = IgxInputState.INITIAL;
1260-
}
1259+
this.validateComboState();
12611260
}
12621261
}
12631262

1263+
/** @hidden @internal */
1264+
public onFocus(): void {
1265+
this._onTouchedCallback();
1266+
}
1267+
12641268
/** @hidden @internal */
12651269
public setActiveDescendant(): void {
12661270
this.activeDescendant = this.dropdown.focusedItem?.id || '';
@@ -1285,6 +1289,14 @@ export abstract class IgxComboBaseDirective implements IgxComboBase, AfterViewCh
12851289
this.manageRequiredAsterisk();
12861290
};
12871291

1292+
private validateComboState() {
1293+
if (this.ngControl && this.ngControl.invalid) {
1294+
this.valid = IgxInputState.INVALID;
1295+
} else {
1296+
this.valid = IgxInputState.INITIAL;
1297+
}
1298+
}
1299+
12881300
private get isTouchedOrDirty(): boolean {
12891301
return (this.ngControl.control.touched || this.ngControl.control.dirty);
12901302
}

projects/igniteui-angular/src/lib/combo/combo.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
role="combobox" aria-haspopup="listbox"
1414
[attr.aria-expanded]="!dropdown.collapsed" [attr.aria-controls]="dropdown.listId"
1515
[attr.aria-labelledby]="ariaLabelledBy || label?.id || placeholder"
16-
(blur)="onBlur()" />
16+
(blur)="onBlur()"
17+
(focus)="onFocus()" />
1718
<ng-container ngProjectAs="igx-suffix">
1819
<ng-content select="igx-suffix"></ng-content>
1920
</ng-container>

projects/igniteui-angular/src/lib/combo/combo.component.spec.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3606,6 +3606,29 @@ describe('igxCombo', () => {
36063606
expect(combo.valid).toEqual(IgxInputState.INITIAL);
36073607
expect(combo.comboInput.valid).toEqual(IgxInputState.INITIAL);
36083608
}));
3609+
it('should mark as touched and invalid when combo is focused, dropdown appears, and user clicks away without selection', fakeAsync(() => {
3610+
const ngModel = fixture.debugElement.query(By.directive(NgModel)).injector.get(NgModel);
3611+
expect(combo.valid).toEqual(IgxInputState.INITIAL);
3612+
expect(combo.comboInput.valid).toEqual(IgxInputState.INITIAL);
3613+
expect(ngModel.touched).toBeFalse();
3614+
3615+
combo.open();
3616+
input.triggerEventHandler('focus', {});
3617+
fixture.detectChanges();
3618+
expect(ngModel.touched).toBeTrue();
3619+
combo.searchInput.nativeElement.focus();
3620+
fixture.detectChanges();
3621+
const documentClickEvent = new MouseEvent('click', { bubbles: true });
3622+
document.body.dispatchEvent(documentClickEvent);
3623+
fixture.detectChanges();
3624+
tick();
3625+
document.body.focus();
3626+
fixture.detectChanges();
3627+
tick();
3628+
expect(combo.valid).toEqual(IgxInputState.INVALID);
3629+
expect(combo.comboInput.valid).toEqual(IgxInputState.INVALID);
3630+
expect(ngModel.touched).toBeTrue();
3631+
}));
36093632
});
36103633
});
36113634
describe('Display density', () => {
@@ -3787,7 +3810,7 @@ class IgxComboFormComponent {
37873810
@Component({
37883811
template: `
37893812
<form #form="ngForm">
3790-
<igx-combo #testCombo class="input-container" [placeholder]="'Locations'"
3813+
<igx-combo #testCombo #testComboNgModel="ngModel" class="input-container" [placeholder]="'Locations'"
37913814
name="anyName" required [(ngModel)]="values"
37923815
[data]="items" [disableFiltering]="disableFilteringFlag"
37933816
[displayKey]="'field'" [valueKey]="'field'"

0 commit comments

Comments
 (0)