Skip to content

Commit 33d7d9e

Browse files
authored
Merge pull request #12843 from IgniteUI/15.1.x
15.1.x to master mass merge
2 parents e4e1a91 + 0f01c63 commit 33d7d9e

27 files changed

+269
-131
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ All notable changes for each version of this project will be documented in this
6666
- **Breaking Changes** - ` $label-floated-background` and `$label-floated-disabled-background` properties of `IgxInputGroupComponent` theme has been removed.
6767
- `IgxInputGroupComponent` The input group has been refactored so that the floating label for the input of `type="border"` does not require a background to match the surface background under the input field. Also, suffixes and prefixes are refactored to take the full height of the input which makes it easy to add background to them.
6868
- **Breaking Changes** - `$size` property of `scrollbar-theme` theme has been renamed to `$scrollbar-size`.
69+
- `IgxSimpleCombo`
70+
- The `IgxSimpleCombo` will not open its drop-down on clear.
6971

7072
## 15.0.1
7173

projects/igniteui-angular/src/lib/chips/chip.component.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
Renderer2,
1212
TemplateRef,
1313
Inject,
14-
Optional
14+
Optional,
15+
OnDestroy
1516
} from '@angular/core';
1617
import { IDisplayDensityOptions, DisplayDensityToken, DisplayDensityBase } from '../core/displayDensity';
1718
import {
@@ -24,7 +25,7 @@ import {
2425
import { IBaseEventArgs } from '../core/utils';
2526
import { IChipResourceStrings } from '../core/i18n/chip-resources';
2627
import { CurrentResourceStrings } from '../core/i18n/resources';
27-
import { fromEvent } from 'rxjs';
28+
import { fromEvent, Subject } from 'rxjs';
2829
import { take, filter } from 'rxjs/operators';
2930

3031
export interface IBaseChipEventArgs extends IBaseEventArgs {
@@ -79,7 +80,7 @@ let CHIP_ID = 0;
7980
selector: 'igx-chip',
8081
templateUrl: 'chip.component.html'
8182
})
82-
export class IgxChipComponent extends DisplayDensityBase {
83+
export class IgxChipComponent extends DisplayDensityBase implements OnDestroy {
8384
/**
8485
* An @Input property that sets the value of `id` attribute. If not provided it will be automatically generated.
8586
*
@@ -536,6 +537,12 @@ export class IgxChipComponent extends DisplayDensityBase {
536537
*/
537538
public hideBaseElement = false;
538539

540+
/**
541+
* @hidden
542+
* @internal
543+
*/
544+
public destroy$ = new Subject();
545+
539546
protected _tabIndex = null;
540547
protected _selected = false;
541548
protected _selectedItemClass = 'igx-chip__item--selected';
@@ -854,4 +861,9 @@ export class IgxChipComponent extends DisplayDensityBase {
854861
}
855862
}
856863
}
864+
865+
public ngOnDestroy(): void {
866+
this.destroy$.next();
867+
this.destroy$.complete();
868+
}
857869
}

projects/igniteui-angular/src/lib/chips/chips-area.component.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,20 +223,20 @@ export class IgxChipsAreaComponent implements DoCheck, AfterViewInit, OnDestroy
223223
const changes = this._differ.diff(this.chipsList.toArray());
224224
if (changes) {
225225
changes.forEachAddedItem((addedChip) => {
226-
addedChip.item.moveStart.pipe(takeUntil(this.destroy$)).subscribe((args) => {
226+
addedChip.item.moveStart.pipe(takeUntil(addedChip.item.destroy$)).subscribe((args) => {
227227
this.onChipMoveStart(args);
228228
});
229-
addedChip.item.moveEnd.pipe(takeUntil(this.destroy$)).subscribe((args) => {
229+
addedChip.item.moveEnd.pipe(takeUntil(addedChip.item.destroy$)).subscribe((args) => {
230230
this.onChipMoveEnd(args);
231231
});
232-
addedChip.item.dragEnter.pipe(takeUntil(this.destroy$)).subscribe((args) => {
232+
addedChip.item.dragEnter.pipe(takeUntil(addedChip.item.destroy$)).subscribe((args) => {
233233
this.onChipDragEnter(args);
234234
});
235-
addedChip.item.keyDown.pipe(takeUntil(this.destroy$)).subscribe((args) => {
235+
addedChip.item.keyDown.pipe(takeUntil(addedChip.item.destroy$)).subscribe((args) => {
236236
this.onChipKeyDown(args);
237237
});
238238
if (addedChip.item.selectable) {
239-
addedChip.item.selectedChanging.pipe(takeUntil(this.destroy$)).subscribe((args) => {
239+
addedChip.item.selectedChanging.pipe(takeUntil(addedChip.item.destroy$)).subscribe((args) => {
240240
this.onChipSelectionChange(args);
241241
});
242242
}

projects/igniteui-angular/src/lib/core/styles/components/grid/_grid-theme.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2163,9 +2163,10 @@
21632163
}
21642164

21652165
%igx-group-label__count-badge {
2166-
> div {
2167-
background: var-get($theme, 'group-count-background');
2168-
color: var-get($theme, 'group-count-text-color');
2166+
--background-color: #{var-get($theme, 'group-count-background')};
2167+
--text-color: #{var-get($theme, 'group-count-text-color')};
2168+
2169+
> span {
21692170
font-size: $grid-head-fs;
21702171
}
21712172
}

projects/igniteui-angular/src/lib/core/styles/components/input/_input-group-theme.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@
534534
height: var(--size);
535535
position: relative;
536536
max-width: 100%;
537-
font-size: 1rem;
537+
font-size: rem(16px);
538538

539539
&::after {
540540
content: '';
@@ -1896,7 +1896,6 @@
18961896

18971897
%form-group-input {
18981898
@include type-style($input-text) {
1899-
font-size: 16px;
19001899
margin: 0;
19011900
}
19021901
}

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
AfterViewInit,
44
ChangeDetectorRef,
55
Component,
6-
ComponentFactoryResolver,
76
Directive,
87
Injectable,
98
IterableDiffers,
@@ -1336,7 +1335,6 @@ export class TestIgxForOfDirective<T> extends IgxForOfDirective<T> {
13361335
public viewContainer: ViewContainerRef,
13371336
public template: TemplateRef<NgForOfContext<T>>,
13381337
public differs: IterableDiffers,
1339-
public fResolver: ComponentFactoryResolver,
13401338
public changeDet: ChangeDetectorRef,
13411339
public zone: NgZone,
13421340
protected syncService: IgxForOfScrollSyncService,

projects/igniteui-angular/src/lib/grids/filtering/base/grid-filtering-row.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ export class IgxGridFilteringRowComponent implements AfterViewInit, OnDestroy {
6868
}
6969

7070
public set value(val) {
71-
if (!val && val !== 0) {
71+
if (!val && val !== 0 && this.expression.searchVal) {
7272
this.expression.searchVal = null;
7373
const index = this.expressionsList.findIndex(item => item.expression === this.expression);
7474
if (index === 0 && this.expressionsList.length === 1) {
7575
this.filteringService.clearFilter(this.column.field);
7676

7777
if (this.expression.condition.isUnary) {
78-
this.resetExpression();
78+
this.resetExpression(this.expression.condition.name);
7979
}
8080

8181
return;
@@ -767,7 +767,7 @@ export class IgxGridFilteringRowComponent implements AfterViewInit, OnDestroy {
767767
this.showHideArrowButtons();
768768
}
769769

770-
private resetExpression() {
770+
private resetExpression(condition?: string) {
771771
this.expression = {
772772
fieldName: this.column.field,
773773
condition: null,
@@ -776,7 +776,7 @@ export class IgxGridFilteringRowComponent implements AfterViewInit, OnDestroy {
776776
};
777777

778778
if (this.column.dataType !== GridColumnDataType.Boolean) {
779-
this.expression.condition = this.getCondition(this.conditions[0]);
779+
this.expression.condition = this.getCondition(condition ?? this.conditions[0]);
780780
}
781781

782782
if (this.column.dataType === GridColumnDataType.Date && this.input) {

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import {
44
AfterViewInit,
55
ApplicationRef,
66
ChangeDetectorRef,
7-
ComponentFactory,
8-
ComponentFactoryResolver,
97
ComponentRef,
108
ContentChild,
119
ContentChildren,
10+
createComponent,
1211
Directive,
1312
DoCheck,
1413
ElementRef,
14+
EnvironmentInjector,
1515
EventEmitter,
1616
HostBinding,
1717
HostListener,
@@ -21,7 +21,6 @@ import {
2121
IterableChangeRecord,
2222
IterableDiffers,
2323
LOCALE_ID,
24-
NgModuleRef,
2524
NgZone,
2625
OnDestroy,
2726
OnInit,
@@ -3351,12 +3350,11 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
33513350
protected zone: NgZone,
33523351
@Inject(DOCUMENT) public document: any,
33533352
public cdr: ChangeDetectorRef,
3354-
protected resolver: ComponentFactoryResolver,
33553353
protected differs: IterableDiffers,
33563354
protected viewRef: ViewContainerRef,
33573355
private appRef: ApplicationRef,
3358-
private moduleRef: NgModuleRef<any>,
3359-
private injector: Injector,
3356+
protected injector: Injector,
3357+
protected envInjector: EnvironmentInjector,
33603358
public navigation: IgxGridNavigationService,
33613359
public filteringService: IgxFilteringService,
33623360
@Inject(IgxOverlayService) protected overlayService: IgxOverlayService,
@@ -3835,26 +3833,8 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
38353833
}
38363834

38373835
private createComponentInstance(component: any) {
3838-
// TODO: create component instance view viewContainerRef.createComponent(Component, Settings) overload
3839-
let dynamicFactory: ComponentFactory<any>;
3840-
const factoryResolver = this.moduleRef
3841-
? this.moduleRef.componentFactoryResolver
3842-
: this.resolver;
3843-
try {
3844-
dynamicFactory = factoryResolver.resolveComponentFactory(component);
3845-
} catch (error) {
3846-
console.error(error);
3847-
return null;
3848-
}
3849-
3850-
const injector = this.moduleRef
3851-
? this.moduleRef.injector
3852-
: this.injector;
3853-
const dynamicComponent: ComponentRef<any> = dynamicFactory.create(
3854-
injector
3855-
);
3836+
const dynamicComponent: ComponentRef<any> = createComponent(component, { environmentInjector: this.envInjector, elementInjector: this.injector } );
38563837
this.appRef.attachView(dynamicComponent.hostView);
3857-
38583838
return dynamicComponent;
38593839
}
38603840

@@ -7156,12 +7136,11 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
71567136
*/
71577137
protected autogenerateColumns() {
71587138
const data = this.gridAPI.get_data();
7159-
const factory = this.resolver.resolveComponentFactory(IgxColumnComponent);
71607139
const fields = this.generateDataFields(data);
71617140
const columns = [];
71627141

71637142
fields.forEach((field) => {
7164-
const ref = factory.create(this.viewRef.injector);
7143+
const ref = createComponent(IgxColumnComponent, { environmentInjector: this.envInjector, elementInjector: this.injector});
71657144
ref.instance.field = field;
71667145
ref.instance.dataType = this.resolveDataTypes(data[0][field]);
71677146
ref.changeDetectorRef.detectChanges();

projects/igniteui-angular/src/lib/grids/grid/grid-filtering-advanced.spec.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,6 +2144,63 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => {
21442144
expect(GridFunctions.getAdvancedFilteringTreeChildItems(secondItem, false).length).toBe(1);
21452145
}));
21462146

2147+
it('Should respect the changes of the groups applied from the context menu.',
2148+
fakeAsync(() => {
2149+
// Apply advanced filter through API.
2150+
const tree = new FilteringExpressionsTree(FilteringLogic.And);
2151+
tree.filteringOperands.push({
2152+
fieldName: 'ProductName', searchVal: 'angular', condition: IgxStringFilteringOperand.instance().condition('contains'),
2153+
ignoreCase: true
2154+
});
2155+
tree.filteringOperands.push({
2156+
fieldName: 'ProductName', searchVal: 'script', condition: IgxStringFilteringOperand.instance().condition('contains'),
2157+
ignoreCase: true
2158+
});
2159+
grid.advancedFilteringExpressionsTree = tree;
2160+
fix.detectChanges();
2161+
2162+
// Verify the filter changes are applied.
2163+
expect(grid.filteredData.length).toEqual(0);
2164+
2165+
// Open Advanced Filtering dialog.
2166+
grid.openAdvancedFilteringDialog();
2167+
fix.detectChanges();
2168+
2169+
// Verify tree layout before the group change through context menu.
2170+
let rootGroup = GridFunctions.getAdvancedFilteringTreeRootGroup(fix);
2171+
expect(GridFunctions.getAdvancedFilteringTreeChildItems(rootGroup, true).length).toBe(2);
2172+
expect(GridFunctions.getAdvancedFilteringTreeChildItems(rootGroup, false).length).toBe(2);
2173+
2174+
// Select two chips.
2175+
GridFunctions.clickAdvancedFilteringTreeExpressionChip(fix, [0]);
2176+
GridFunctions.clickAdvancedFilteringTreeExpressionChip(fix, [1]);
2177+
tick(200);
2178+
2179+
// Click "Create Or Group" in context menu.
2180+
const buttons = GridFunctions.getAdvancedFilteringContextMenuButtons(fix);
2181+
buttons[2].click();
2182+
tick(100);
2183+
fix.detectChanges();
2184+
2185+
// Close dialog through API.
2186+
grid.closeAdvancedFilteringDialog(true);
2187+
tick(100);
2188+
fix.detectChanges();
2189+
2190+
// Open Advanced Filtering dialog.
2191+
grid.openAdvancedFilteringDialog();
2192+
fix.detectChanges();
2193+
2194+
// Verify tree layout after the group change through context menu.
2195+
rootGroup = GridFunctions.getAdvancedFilteringTreeRootGroup(fix);
2196+
expect(GridFunctions.getAdvancedFilteringTreeChildItems(rootGroup, true).length).toBe(1);
2197+
expect(GridFunctions.getAdvancedFilteringTreeChildItems(rootGroup, false).length).toBe(3);
2198+
2199+
// Verify the filter changes are applied.
2200+
expect(grid.filteredData.length).toEqual(3);
2201+
}));
2202+
2203+
21472204
it('Should delete all selected conditions when the \'delete filters\' option from context menu is clicked.',
21482205
fakeAsync(() => {
21492206
// Apply advanced filter through API.

projects/igniteui-angular/src/lib/grids/grid/grid-filtering-ui.spec.ts

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2084,14 +2084,51 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
20842084
// iterate over unary conditions
20852085
// empty
20862086
GridFunctions.openFilterDDAndSelectCondition(fix, 6);
2087+
expect(grid.filteringRow.expression.condition.name).toEqual('empty');
20872088

2088-
grid.filteringRow.onClearClick();
2089+
const filterUIRow = fix.debugElement.query(By.directive(IgxGridFilteringRowComponent));
2090+
const reset = filterUIRow.queryAll(By.css('button'))[0];
2091+
2092+
reset.triggerEventHandler('click', null);
20892093
tick(100);
20902094
fix.detectChanges();
20912095

20922096
expect(grid.filteringRow.expression.condition.name).toEqual('contains');
20932097
}));
20942098

2099+
it('should reset expression to selected unary condition', fakeAsync(() => {
2100+
GridFunctions.clickFilterCellChip(fix, 'ReleaseDate');
2101+
2102+
const filterUIRow = fix.debugElement.query(By.directive(IgxGridFilteringRowComponent));
2103+
const datePicker = filterUIRow.query(By.directive(IgxDatePickerComponent));
2104+
2105+
// Equals condition
2106+
datePicker.triggerEventHandler('click', null);
2107+
tick();
2108+
fix.detectChanges();
2109+
2110+
const currentDay = document.querySelector('.igx-calendar__date--current');
2111+
2112+
currentDay.dispatchEvent(new Event('click'));
2113+
tick();
2114+
fix.detectChanges();
2115+
2116+
expect(grid.filteringRow.expression.condition.name).toEqual('equals');
2117+
expect(grid.rowList.length).toEqual(1);
2118+
2119+
// This Month condition
2120+
const expectedResults = GridFunctions.createDateFilterConditions(grid, today);
2121+
GridFunctions.openFilterDDAndSelectCondition(fix, 6);
2122+
tick();
2123+
fix.detectChanges();
2124+
2125+
expect(grid.filteringRow.expression.condition.name).toEqual('thisMonth');
2126+
expect(grid.rowList.length).toEqual(expectedResults[5]);
2127+
2128+
const conditionChips = filterUIRow.queryAll(By.directive(IgxChipComponent));
2129+
expect(conditionChips.length).toBe(1);
2130+
}));
2131+
20952132
it('Should filter by cells formatted data when using FormattedValuesFilteringStrategy', fakeAsync(() => {
20962133
const formattedStrategy = new FormattedValuesFilteringStrategy(['Downloads']);
20972134
grid.filterStrategy = formattedStrategy;

0 commit comments

Comments
 (0)