Skip to content

Commit b8f7d1c

Browse files
authored
Merge branch '20.0.x' into rivanova/fix-15848-master
2 parents 125c675 + 906ac1f commit b8f7d1c

File tree

12 files changed

+161
-35
lines changed

12 files changed

+161
-35
lines changed

projects/igniteui-angular/src/lib/core/styles/components/date-picker/_date-picker-theme.scss

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
/// @see {mixin} css-vars
1414
/// @param {Map} $theme - The calendar theme used to style the component.
1515
@mixin date-picker($theme) {
16-
$variant: map.get($theme, '_meta', 'variant');
16+
$variant: map.get($theme, '_meta', 'theme');
17+
$theme-variant: map.get($theme, '_meta', 'variant');
1718
$bootstrap-theme: $variant == 'bootstrap';
1819
$border-shadow: 0 0 0 rem(1px) var-get($theme, 'border-color');
1920

@@ -26,11 +27,17 @@
2627

2728
%date-picker {
2829
// TODO move the shadow in the schemas
29-
box-shadow: $border-shadow, elevation(24),;
30+
box-shadow: $border-shadow, elevation(24);
3031
border-radius: var-get($theme, 'border-radius');
3132
background: var-get($theme, 'content-background');
3233
overflow: hidden;
3334

35+
@if $variant == 'indigo' and $theme-variant == 'light' {
36+
box-shadow: $border-shadow, elevation(5);
37+
} @else if $variant == 'indigo' and $theme-variant == 'dark' {
38+
box-shadow: $border-shadow, elevation(7);
39+
}
40+
3441
igx-calendar,
3542
%days-view,
3643
%months-view,

projects/igniteui-angular/src/lib/grids/cell.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,10 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy, CellT
930930
this.highlight.lastSearchInfo.caseSensitive = this.grid.lastSearchInfo.caseSensitive;
931931
this.highlight.lastSearchInfo.exactMatch = this.grid.lastSearchInfo.exactMatch;
932932
}
933+
const isInEdit = this.grid.rowEditable ? this.row.inEditMode : this.editMode;
934+
if (this.formControl && this.formControl.value !== changes.value.currentValue && !isInEdit) {
935+
this.formControl.setValue(changes.value.currentValue);
936+
}
933937
}
934938
}
935939

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5557,7 +5557,7 @@ export abstract class IgxGridBaseDirective implements GridType,
55575557
let sum = 0;
55585558
for (const col of fc) {
55595559
if (col.level === 0) {
5560-
sum += parseInt(col.calcWidth, 10);
5560+
sum += parseFloat(col.calcWidth);
55615561
}
55625562
}
55635563
if (this.isPinningToStart) {
@@ -6298,7 +6298,7 @@ export abstract class IgxGridBaseDirective implements GridType,
62986298
* @hidden @internal
62996299
*/
63006300
public hasHorizontalScroll() {
6301-
return this.totalWidth - this.unpinnedWidth > 0 && this.width !== null;
6301+
return Math.round(this.totalWidth - this.unpinnedWidth) > 0 && this.width !== null;
63026302
}
63036303

63046304
/**
@@ -6349,6 +6349,9 @@ export abstract class IgxGridBaseDirective implements GridType,
63496349
// TODO: do not remove this, as it is used in rowEditTemplate, but mark is as internal and hidden
63506350
/* blazorCSSuppress */
63516351
public endEdit(commit = true, event?: Event): boolean {
6352+
if (!this.crudService.cellInEditMode && !this.crudService.rowInEditMode) {
6353+
return;
6354+
}
63526355
const document = this.nativeElement?.getRootNode() as Document | ShadowRoot;
63536356
const focusWithin = this.nativeElement?.contains(document.activeElement);
63546357

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,27 @@ describe('IgxGrid - Cell Editing #grid', () => {
11651165
expect(cell.value).not.toEqual(cellValue);
11661166
expect(cell.value).toEqual(newValue);
11671167
});
1168+
1169+
it('should update editValue when externally changing grid data.', () => {
1170+
const cell = grid.getCellByColumn(0, 'fullName');
1171+
cell.editMode = true;
1172+
fixture.detectChanges();
1173+
1174+
expect(cell.editMode).toBeTruthy();
1175+
expect(cell.editValue).toBe('John Brown');
1176+
1177+
fixture.detectChanges();
1178+
cell.editMode = false;
1179+
fixture.detectChanges();
1180+
1181+
grid.data[0].fullName = "Test";
1182+
grid.cdr.detectChanges();
1183+
1184+
cell.editMode = true;
1185+
fixture.detectChanges();
1186+
expect(cell.editMode).toBeTruthy();
1187+
expect(cell.editValue).toBe('Test');
1188+
});
11681189
});
11691190

11701191
describe('Integration tests', () => {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ describe('IgxGrid - Cell selection #grid', () => {
8484

8585
UIInteractions.simulatePointerOverElementEvent('pointerup', endCell.nativeElement);
8686
detect();
87+
// Invoke endEdit() to make sure if no editing is going on,
88+
// the cell activation shouldn't be lost (https://infragistics.visualstudio.com/Indigo_Platform/_workitems/edit/37933)
89+
grid.endEdit(true, null);
90+
fix.detectChanges();
8791

8892
expect(startCell.active).toBe(true);
8993
GridSelectionFunctions.verifyCellsRegionSelected(grid, 2, 3, 1, 0);

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { QueryBuilderFunctions } from '../../query-builder/query-builder-functio
2727
import { By } from '@angular/platform-browser';
2828
import { IgxDateTimeEditorDirective } from '../../directives/date-time-editor/date-time-editor.directive';
2929
import { QueryBuilderSelectors } from '../../query-builder/query-builder.common';
30-
import { IgxHGridRemoteOnDemandComponent } from '../hierarchical-grid/hierarchical-grid.spec';
30+
import { IgxHGridRemoteOnDemandComponent, IgxHierarchicalGridMissingChildDataComponent } from '../hierarchical-grid/hierarchical-grid.spec';
3131
import { IGridResourceStrings } from '../../core/i18n/grid-resources';
3232

3333
describe('IgxGrid - Advanced Filtering #grid - ', () => {
@@ -1898,6 +1898,19 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => {
18981898
expect(operatorSelect.querySelector('input').value).toBe('My In');
18991899
expect(Array.from(operatorSelect.querySelectorAll('igx-select-item')).pop().textContent).toBe('My Not In');
19001900
}));
1901+
1902+
it('Should not throw an error when some child data is missing.', fakeAsync(() => {
1903+
const fixture = TestBed.createComponent(IgxHierarchicalGridMissingChildDataComponent);
1904+
const hierarchicalGrid = fixture.componentInstance.hGrid;
1905+
hierarchicalGrid.allowAdvancedFiltering = true;
1906+
fixture.detectChanges();
1907+
1908+
// Open Advanced Filtering dialog.
1909+
expect(() => {
1910+
hierarchicalGrid.openAdvancedFilteringDialog();
1911+
fixture.detectChanges();
1912+
}).not.toThrow();
1913+
}));
19011914
});
19021915
});
19031916

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,7 +1256,9 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
12561256
];
12571257

12581258
entities[0].childEntities = this.childLayoutList.reduce((acc, rowIsland) => {
1259-
return acc.concat(this.generateChildEntity(rowIsland, this.data[0][rowIsland.key][0]));
1259+
const childFirstRowData = this.data?.length > 0 && this.data[0][rowIsland.key]?.length > 0 ?
1260+
this.data[0][rowIsland.key][0] : null;
1261+
return acc.concat(this.generateChildEntity(rowIsland, childFirstRowData));
12601262
}
12611263
, []);
12621264
}
@@ -1289,7 +1291,9 @@ export class IgxHierarchicalGridComponent extends IgxHierarchicalGridBaseDirecti
12891291
if (!firstRowData) {
12901292
return null;
12911293
}
1292-
return acc.concat(this.generateChildEntity(childRowIsland, firstRowData[childRowIsland.key][0]));
1294+
const childFirstRowData = firstRowData.length > 0 && firstRowData[childRowIsland.key]?.length > 0 ?
1295+
firstRowData[childRowIsland.key][0] : null;
1296+
return acc.concat(this.generateChildEntity(childRowIsland, childFirstRowData));
12931297
}, []);
12941298

12951299
if (rowIslandChildEntities?.length > 0) {

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2509,3 +2509,31 @@ export class IgxHierarchicalGridEmptyTemplateComponent extends IgxHierarchicalGr
25092509
this.childGridRef = grid;
25102510
}
25112511
}
2512+
2513+
@Component({
2514+
template: `
2515+
<igx-hierarchical-grid #hGrid [data]="data" [autoGenerate]="false"
2516+
[height]="'400px'" [width]="'500px'">
2517+
<igx-column field="root1" [dataType]="'number'"></igx-column>
2518+
<igx-column field="root2" [dataType]="'number'"></igx-column>
2519+
<igx-row-island [key]="'level1data'" [autoGenerate]="false">
2520+
<igx-column field="level1child1" [dataType]="'number'"></igx-column>
2521+
<igx-column field="level1child2" [dataType]="'number'"></igx-column>
2522+
<igx-row-island [key]="'level2data'" [autoGenerate]="false">
2523+
<igx-column field="level2child1" [dataType]="'number'"></igx-column>
2524+
<igx-column field="level2child2" [dataType]="'number'"></igx-column>
2525+
</igx-row-island>
2526+
</igx-row-island>
2527+
</igx-hierarchical-grid>`,
2528+
imports: [IgxHierarchicalGridComponent, IgxColumnComponent, IgxRowIslandComponent]
2529+
})
2530+
export class IgxHierarchicalGridMissingChildDataComponent {
2531+
@ViewChild('hGrid', { read: IgxHierarchicalGridComponent, static: true })
2532+
public hGrid: IgxHierarchicalGridComponent;
2533+
2534+
public data = [
2535+
{ root1: 1, root2: 1, level1data: [{ level1child1: 11, level1child2: 12 }] }, // missing level2data
2536+
{ root1: 2, root2: 2, level1data: [{ level1child1: 21, level1child2: 22, level2data: [{ level2child1: 31, level2child2: 32 }] }] },
2537+
{ root1: 3, root2: 3, level1data: [] }
2538+
];
2539+
}

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

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2222,6 +2222,54 @@ describe('IgxPivotGrid #pivotGrid', () => {
22222222
GridSelectionFunctions.verifyColumnSelected(amountOfSale, false);
22232223
GridSelectionFunctions.verifyColumnGroupSelected(fixture, group, false);
22242224
});
2225+
2226+
it('should provide value formatter column data for second value', () => {
2227+
let correctFirstColumnData = true;
2228+
let correctSecondColumnData = true;
2229+
const pivotGrid = fixture.componentInstance.pivotGrid;
2230+
pivotGrid.pivotConfiguration = {
2231+
columns: fixture.componentInstance.pivotConfigHierarchy.columns,
2232+
rows: fixture.componentInstance.pivotConfigHierarchy.rows,
2233+
values: [
2234+
{
2235+
member: 'UnitsSold',
2236+
aggregate: {
2237+
aggregator: IgxPivotNumericAggregate.sum,
2238+
key: 'SUM',
2239+
label: 'Sum'
2240+
},
2241+
enabled: true,
2242+
formatter: (value, row, column) => {
2243+
if (!column || !column.value || column.value.member !== 'UnitsSold') {
2244+
correctFirstColumnData = false;
2245+
}
2246+
return value;
2247+
}
2248+
},
2249+
{
2250+
member: 'AmountOfSale',
2251+
displayName: 'Amount of Sale',
2252+
aggregate: {
2253+
aggregator: IgxTotalSaleAggregate.totalSale,
2254+
key: 'TOTAL',
2255+
label: 'Total'
2256+
},
2257+
enabled: true,
2258+
formatter: (value, row, column) => {
2259+
if (!column || !column.value || column.value.member !== 'AmountOfSale') {
2260+
correctSecondColumnData = false;
2261+
}
2262+
return value;
2263+
}
2264+
}
2265+
]
2266+
};
2267+
2268+
pivotGrid.width = '1500px';
2269+
fixture.detectChanges();
2270+
expect(correctFirstColumnData).toBeTruthy();
2271+
expect(correctSecondColumnData).toBeTruthy();
2272+
});
22252273
});
22262274

22272275
describe('IgxPivotGrid Resizing #pivotGrid', () => {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ export class IgxPivotRowComponent extends IgxRowDirective {
189189
keyValueMap.set(dim.memberName, path.shift());
190190
}
191191
let pivotValue;
192-
if (this.grid.hasMultipleValues) {
193-
pivotValue = this.grid.values.find(x => x.member === path.shift());
192+
if (this.grid.hasMultipleValues && path.length) {
193+
pivotValue = this.grid.values.find(x => x.member === path[0]);
194194
} else {
195195
pivotValue = this.grid.values ? this.grid.values[0] : undefined;
196196
}

0 commit comments

Comments
 (0)