Skip to content

Commit 15c6812

Browse files
Merge branch '18.1.x' into ganastasov/fix-14262-18.1.x
2 parents 58ddeeb + ca178ce commit 15c6812

File tree

13 files changed

+243
-58
lines changed

13 files changed

+243
-58
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3093,8 +3093,11 @@
30933093
max-height: 100%;
30943094
}
30953095
}
3096-
}
30973096

3097+
%igx-grid__tr-pivot--row-area {
3098+
padding-bottom: rem(4px);
3099+
}
3100+
}
30983101

30993102
%grid-thead--pivot {
31003103
display: flex;

projects/igniteui-angular/src/lib/core/styles/components/navdrawer/_navdrawer-theme.scss

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
}
203203

204204
%navdrawer-display-mini-pinned {
205-
flex-basis: var(--igx-mini-nav-drawer-size, #{$item-mini-size});
205+
flex-basis: calc(var(--igx-mini-nav-drawer-size, #{$item-mini-size}) + rem(1px));
206206
}
207207

208208
%aside {
@@ -213,11 +213,11 @@
213213
background: var-get($theme, 'background');
214214
top: 0;
215215
bottom: 0;
216-
min-width: var(--igx-nav-drawer-size);
216+
width: var(--igx-nav-drawer-size);
217217
inset-inline-start: 0;
218218
z-index: 999;
219219
transition: width, padding, transform;
220-
transition-timing-function: $in-out-quad, $in-out-quad;
220+
transition-timing-function: $in-out-quad;
221221
box-shadow: var-get($theme, 'shadow');
222222
padding: $aside-padding;
223223

@@ -279,11 +279,13 @@
279279
}
280280

281281
%aside--mini {
282-
transition-duration: .2s, .2s;
283-
min-width: var(--igx-nav-drawer-size--mini);
282+
transition-duration: .3s;
283+
width: var(--igx-nav-drawer-size--mini);
284+
min-width: fit-content;
284285

285286
%item {
286287
justify-content: center;
288+
min-width: fit-content;
287289

288290
@if $variant == 'bootstrap' {
289291
width: rem(56px);
@@ -303,15 +305,15 @@
303305
}
304306

305307
%aside--normal {
306-
transition-duration: .3s, .3s;
308+
transition-duration: .3s;
307309
width: var(--igx-nav-drawer-size);
308310
}
309311

310312
%overlay {
311313
opacity: 1;
312314
background: color(null, 'gray', 500, .54);
313315
transition: opacity, visibility;
314-
transition-duration: .25s, .25s;
316+
transition-duration: .3s, .3s;
315317
transition-timing-function: ease-in, step-start;
316318
transition-delay: 0s, 0s;
317319
position: absolute;

projects/igniteui-angular/src/lib/core/styles/components/query-builder/_query-builder-theme.scss

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -247,20 +247,10 @@
247247
%filter-tree__expression-actions {
248248
display: inline-flex;
249249
margin: 0 rem(8px);
250+
gap: rem(8px);
250251

251-
igx-icon {
252-
cursor: pointer;
253-
color: color(null, 'gray', 500);
254-
outline-style: none;
255-
256-
&:hover,
257-
&:focus {
258-
color: color(null, 'gray', 800);
259-
}
260-
}
261-
262-
igx-icon + igx-icon {
263-
margin-inline-start: rem(8px);
252+
%igx-icon-button-display {
253+
--size: #{sizable(rem(20px), rem(24px), rem(32px))};
264254
}
265255
}
266256

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3620,7 +3620,7 @@ export abstract class IgxGridBaseDirective implements GridType,
36203620
this.zone.run(() => {
36213621
// do not trigger reflow if element is detached.
36223622
if (this.nativeElement.isConnected) {
3623-
if (this._gridSize !== this.gridSize) {
3623+
if (this.shouldResize) {
36243624
// resizing occurs due to the change of --ig-size css var
36253625
this._gridSize = this.gridSize;
36263626
this.updateDefaultRowHeight();
@@ -5312,6 +5312,10 @@ export abstract class IgxGridBaseDirective implements GridType,
53125312
return this.width && this.width.indexOf('%') !== -1;
53135313
}
53145314

5315+
protected get shouldResize(): boolean {
5316+
return this._gridSize !== this.gridSize;
5317+
}
5318+
53155319
/**
53165320
* @hidden @internal
53175321
*/

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { IgxHierGridExternalAdvancedFilteringComponent } from '../../test-utils/
2424
import { IgxHierarchicalGridComponent } from '../hierarchical-grid/public_api';
2525
import { IFilteringEventArgs } from '../public_api';
2626
import { SampleTestData } from '../../test-utils/sample-test-data.spec';
27+
import { By } from '@angular/platform-browser';
2728

2829
const ADVANCED_FILTERING_OPERATOR_LINE_AND_CSS_CLASS = 'igx-filter-tree__line--and';
2930
const ADVANCED_FILTERING_OPERATOR_LINE_OR_CSS_CLASS = 'igx-filter-tree__line--or';
@@ -2999,6 +3000,40 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => {
29993000
verifyContextMenuVisibility(fix, false);
30003001
}));
30013002

3003+
it('Should navigate with Tab/Shift+Tab through chips" "edit", "cancel" and "adding" buttons, fields of a condition in edit mode.', fakeAsync(() => {
3004+
// Apply advanced filter through API.
3005+
const tree = new FilteringExpressionsTree(FilteringLogic.Or);
3006+
tree.filteringOperands.push({
3007+
fieldName: 'ProductName', searchVal: 'angular', condition: IgxStringFilteringOperand.instance().condition('contains'),
3008+
ignoreCase: true
3009+
});
3010+
tree.filteringOperands.push({
3011+
fieldName: 'ProductName', searchVal: 'script', condition: IgxStringFilteringOperand.instance().condition('contains'),
3012+
ignoreCase: true
3013+
});
3014+
grid.advancedFilteringExpressionsTree = tree;
3015+
fix.detectChanges();
3016+
3017+
// Open Advanced Filtering dialog.
3018+
grid.openAdvancedFilteringDialog();
3019+
fix.detectChanges();
3020+
3021+
// Press 'Enter' on the second chip and verify it is selected.
3022+
UIInteractions.triggerKeyDownEvtUponElem('Enter', GridFunctions.getAdvancedFilteringTreeExpressionChip(fix, [0]));
3023+
tick(200);
3024+
fix.detectChanges();
3025+
3026+
let chipActions = fix.debugElement.query(By.css('.igx-filter-tree'));
3027+
GridFunctions.verifyTabbableElements(chipActions);
3028+
3029+
// Press 'Enter' on the edit button.
3030+
UIInteractions.triggerKeyDownEvtUponElem('Enter', GridFunctions.getAdvancedFilteringTreeExpressionEditIcon(fix, [0]));
3031+
fix.detectChanges();
3032+
3033+
chipActions = fix.debugElement.query(By.css('.igx-filter-tree'));
3034+
GridFunctions.verifyInEditTabbableElements(chipActions);
3035+
}));
3036+
30023037
});
30033038

30043039
});

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

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2175,6 +2175,28 @@ describe('IgxGrid - GroupBy #grid', () => {
21752175
expect(fix.componentInstance.onGroupByRowClick).toHaveBeenCalledWith(fix.componentInstance.groupByRowClick, contextUnselect);
21762176
}));
21772177

2178+
it('should update chips state when columns are added/removed', fakeAsync(() => {
2179+
const fix = TestBed.createComponent(GroupByDataMoreColumnsComponent);
2180+
const cols = fix.componentInstance.columns;
2181+
fix.componentInstance.columns = [];
2182+
fix.componentInstance.instance.groupingExpressions = [
2183+
{
2184+
dir: SortingDirection.Asc,
2185+
fieldName: 'A',
2186+
ignoreCase: false,
2187+
strategy: DefaultSortingStrategy.instance()
2188+
}
2189+
];
2190+
fix.detectChanges();
2191+
const chips = fix.componentInstance.instance.groupArea.chips;
2192+
let chipContent = chips.first.nativeElement.querySelector('.igx-chip__content').textContent.trim();
2193+
expect(chipContent).toBe('A');
2194+
fix.componentInstance.columns = cols;
2195+
fix.detectChanges();
2196+
chipContent = chips.first.nativeElement.querySelector('.igx-chip__content').textContent.trim();
2197+
expect(chipContent).toBe('AA');
2198+
}));
2199+
21782200
// GroupBy Row Formatting
21792201
it('should properly apply formatters, both custom and default ones for the default row value template', fakeAsync(() => {
21802202
const fix = TestBed.createComponent(GroupableGridComponent);
@@ -4103,7 +4125,7 @@ export class CustomTemplateGridComponent extends DataParent {
41034125
[width]='width'
41044126
[height]='height'
41054127
[data]="testData">
4106-
<igx-column *ngFor="let c of columns" [groupable]="true" [field]="c.field" [header]="c.field" [width]="c.width + 'px'">
4128+
<igx-column *ngFor="let c of columns" [groupable]="true" [field]="c.field" [header]="c.header || c.field" [width]="c.width + 'px'">
41074129
</igx-column>
41084130
</igx-grid>
41094131
`,
@@ -4119,7 +4141,7 @@ export class GroupByDataMoreColumnsComponent extends DataParent {
41194141
public testData = [];
41204142

41214143
public columns = [
4122-
{ field: 'A', width: 100 },
4144+
{ field: 'A', header: 'AA', width: 100 },
41234145
{ field: 'B', width: 100 },
41244146
{ field: 'C', width: 100 },
41254147
{ field: 'D', width: 100 },

projects/igniteui-angular/src/lib/grids/grouping/group-by-area.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<ng-container *ngFor="let expression of chipExpressions; let last = last;">
33
<igx-chip
44
[id]="expression.fieldName"
5-
[title]="(expression.fieldName | igxGroupByMeta:grid).title"
5+
[title]="(expression.fieldName | igxGroupByMeta:grid:grid.groupablePipeTrigger).title"
66
[removable]="(expression.fieldName | igxGroupByMeta:grid:grid.groupablePipeTrigger).groupable"
77
[draggable]="(expression.fieldName | igxGroupByMeta:grid:grid.groupablePipeTrigger).groupable"
88
[disabled]="!(expression.fieldName | igxGroupByMeta:grid:grid.groupablePipeTrigger).groupable"
99
(keyDown)="handleKeyDown($event.owner.id, $event.originalEvent)"
1010
(remove)="clearGrouping($event.owner.id)"
1111
(chipClick)="handleClick(expression.fieldName)"
1212
>
13-
<span>{{ (expression.fieldName | igxGroupByMeta:grid).title }}</span>
13+
<span>{{ (expression.fieldName | igxGroupByMeta:grid:grid.groupablePipeTrigger).title }}</span>
1414
<igx-icon
1515
family="default"
1616
[name]="expression.dir === 1 ? 'sort_asc' : 'sort_desc'"

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
</ng-template>
5050
</ng-template>
5151
<ng-template #record_template let-rowIndex="index" let-rowData>
52-
<igx-pivot-row [style.height.px]="renderedRowHeight" [gridID]="id" [index]="rowIndex" [data]="rowData"
52+
<igx-pivot-row [gridID]="id" [index]="rowIndex" [data]="rowData"
5353
[ngClass]="rowClasses | igxGridRowClasses:row:row.inEditMode:row.selected:row.dirty:row.deleted:row.dragging:rowIndex:hasColumnLayouts:false:rowData:pipeTrigger"
5454
[ngStyle]="rowStyles | igxGridRowStyles:rowData:rowIndex:pipeTrigger" #row>
5555
</igx-pivot-row>

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.component.ts

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ import {
2525
createComponent,
2626
EnvironmentInjector,
2727
CUSTOM_ELEMENTS_SCHEMA,
28-
booleanAttribute
28+
booleanAttribute,
29+
OnChanges,
30+
SimpleChanges
2931
} from '@angular/core';
3032
import { DOCUMENT, NgTemplateOutlet, NgIf, NgClass, NgStyle, NgFor } from '@angular/common';
3133

32-
import { first} from 'rxjs/operators';
34+
import { first, take, takeUntil} from 'rxjs/operators';
3335
import { IgxGridBaseDirective } from '../grid-base.directive';
3436
import { IgxFilteringService } from '../filtering/grid-filtering.service';
3537
import { IgxGridSelectionService } from '../selection/selection.service';
@@ -67,7 +69,7 @@ import { IgxGridExcelStyleFilteringComponent, IgxExcelStyleColumnOperationsTempl
6769
import { IgxPivotGridNavigationService } from './pivot-grid-navigation.service';
6870
import { IgxPivotColumnResizingService } from '../resizing/pivot-grid/pivot-resizing.service';
6971
import { IgxFlatTransactionFactory, IgxOverlayService, State, Transaction, TransactionService } from '../../services/public_api';
70-
import { cloneArray, PlatformUtil } from '../../core/utils';
72+
import { cloneArray, PlatformUtil, resizeObservable } from '../../core/utils';
7173
import { IgxPivotFilteringService } from './pivot-filtering.service';
7274
import { DataUtil } from '../../data-operations/data-util';
7375
import { IFilteringExpressionsTree } from '../../data-operations/filtering-expressions-tree';
@@ -197,7 +199,7 @@ const MINIMUM_COLUMN_WIDTH_SUPER_COMPACT = 104;
197199
schemas: [CUSTOM_ELEMENTS_SCHEMA]
198200
})
199201
export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnInit, AfterContentInit,
200-
GridType, AfterViewInit {
202+
GridType, AfterViewInit, OnChanges {
201203

202204
/**
203205
* Emitted when the dimension collection is changed via the grid chip area.
@@ -695,6 +697,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
695697
};
696698
private _sortableColumns = true;
697699
private _visibleRowDimensions: IPivotDimension[] = [];
700+
private _shouldUpdateSizes = false;
698701

699702
/**
700703
* Gets/Sets the default expand state for all rows.
@@ -1086,6 +1089,16 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
10861089
});
10871090
}
10881091

1092+
/**
1093+
* @hidden @internal
1094+
*/
1095+
public ngOnChanges(changes: SimpleChanges) {
1096+
if (changes.superCompactMode && !changes.superCompactMode.isFirstChange()) {
1097+
this._shouldUpdateSizes = true;
1098+
resizeObservable(this.verticalScrollContainer.displayContainer).pipe(take(1), takeUntil(this.destroy$)).subscribe(() => this.resizeNotify.next());
1099+
}
1100+
}
1101+
10891102
/**
10901103
* Notifies for dimension change.
10911104
*/
@@ -1119,6 +1132,18 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
11191132
return rows.concat((config.columns || [])).concat(config.filters || []).filter(x => x !== null && x !== undefined);
11201133
}
11211134

1135+
protected override get shouldResize(): boolean {
1136+
if (!this.dataRowList.first?.cells || this.dataRowList.first.cells.length === 0) {
1137+
return false;
1138+
}
1139+
const isSizePropChanged = super.shouldResize;
1140+
if (isSizePropChanged || this._shouldUpdateSizes) {
1141+
this._shouldUpdateSizes = false;
1142+
return true;
1143+
}
1144+
return false;
1145+
}
1146+
11221147
/** @hidden @internal */
11231148
public createFilterESF(dropdown: any, column: ColumnType, options: OverlaySettings, shouldReatach: boolean) {
11241149
options.outlet = this.outlet;

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,42 @@ describe('IgxPivotGrid #pivotGrid', () => {
759759
expect(pivotGrid.columns.length).toBe(3);
760760
});
761761

762+
it('should calculate row headers according to grid size', async() => {
763+
const pivotGrid = fixture.componentInstance.pivotGrid;
764+
const rowHeightSmall = 32;
765+
const rowHeightMedium = 40;
766+
const rowHeightLarge = 50;
767+
768+
pivotGrid.superCompactMode = false;
769+
setElementSize(pivotGrid.nativeElement, Size.Large);
770+
771+
await wait(100);
772+
fixture.detectChanges();
773+
774+
expect(pivotGrid.gridSize).toBe(Size.Large);
775+
const dimensionContents = fixture.debugElement.queryAll(By.css('.igx-grid__tbody-pivot-dimension'));
776+
let rowHeaders = dimensionContents[0].queryAll(By.directive(IgxPivotRowDimensionHeaderGroupComponent));
777+
let rowHeader = rowHeaders[0].queryAll(By.directive(IgxPivotRowDimensionHeaderComponent));
778+
expect(rowHeader[0].nativeElement.offsetHeight).toBe(rowHeightLarge);
779+
780+
setElementSize(pivotGrid.nativeElement, Size.Small);
781+
await wait(100);
782+
fixture.detectChanges();
783+
784+
expect(pivotGrid.gridSize).toBe(Size.Small);
785+
rowHeaders = dimensionContents[0].queryAll(By.directive(IgxPivotRowDimensionHeaderGroupComponent));
786+
rowHeader = rowHeaders[0].queryAll(By.directive(IgxPivotRowDimensionHeaderComponent));
787+
expect(rowHeader[0].nativeElement.offsetHeight).toBe(rowHeightSmall);
788+
789+
setElementSize(pivotGrid.nativeElement, Size.Medium);
790+
await wait(100);
791+
fixture.detectChanges();
792+
793+
expect(pivotGrid.gridSize).toBe(Size.Medium);
794+
rowHeaders = dimensionContents[0].queryAll(By.directive(IgxPivotRowDimensionHeaderGroupComponent));
795+
rowHeader = rowHeaders[0].queryAll(By.directive(IgxPivotRowDimensionHeaderComponent));
796+
expect(rowHeader[0].nativeElement.offsetHeight).toBe(rowHeightMedium);
797+
});
762798

763799
describe('IgxPivotGrid Features #pivotGrid', () => {
764800
it('should show excel style filtering via dimension chip.', async () => {

0 commit comments

Comments
 (0)