Skip to content

Commit 0ef89e5

Browse files
authored
Merge branch '19.2.x' into ikitanov/fix#15913-19.2.x
2 parents dd1c66f + b7d0fca commit 0ef89e5

File tree

11 files changed

+133
-34
lines changed

11 files changed

+133
-34
lines changed

projects/igniteui-angular/src/lib/core/styles/components/calendar/_calendar-theme.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,8 @@
660660
inner-size: $inner-size,
661661
theme: map.get($schema, '_meta', 'theme'),
662662
_meta: map.merge(if($meta, $meta, ()), (
663-
variant: map.get($schema, '_meta', 'theme')
663+
variant: map.get($schema, '_meta', 'theme'),
664+
theme-variant: map.get($schema, '_meta', 'variant')
664665
)),
665666
));
666667
}

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/// @param {Map} $theme - The calendar theme used to style the component.
1515
@mixin date-picker($theme) {
1616
$variant: map.get($theme, '_meta', 'variant');
17+
$theme-variant: map.get($theme, '_meta', 'theme-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: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import {
1+
import { useAnimation } from '@angular/animations';
2+
import {
23
ChangeDetectionStrategy,
34
ChangeDetectorRef,
45
Component,
@@ -52,6 +53,7 @@ import { IgxFocusDirective } from '../directives/focus/focus.directive';
5253
import { IgxInputDirective } from '../directives/input/input.directive';
5354
import { IgxInputGroupComponent } from '../input-group/input-group.component';
5455
import { IgxChipComponent } from '../chips/chip.component';
56+
import { fadeOut, scaleInCenter } from 'igniteui-angular/animations';
5557

5658
/**
5759
* Providing reference to `IgxGridCellComponent`:
@@ -883,7 +885,9 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy, CellT
883885
modal: false,
884886
positionStrategy: new AutoPositionStrategy({
885887
horizontalStartPoint: HorizontalAlignment.Center,
886-
horizontalDirection: HorizontalAlignment.Center
888+
horizontalDirection: HorizontalAlignment.Center,
889+
openAnimation: useAnimation(scaleInCenter, { params: { duration: '150ms' } }),
890+
closeAnimation: useAnimation(fadeOut, { params: { duration: '75ms' } })
887891
})
888892
}
889893
);
@@ -926,6 +930,10 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy, CellT
926930
this.highlight.lastSearchInfo.caseSensitive = this.grid.lastSearchInfo.caseSensitive;
927931
this.highlight.lastSearchInfo.exactMatch = this.grid.lastSearchInfo.exactMatch;
928932
}
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+
}
929937
}
930938
}
931939

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5524,7 +5524,7 @@ export abstract class IgxGridBaseDirective implements GridType,
55245524
let sum = 0;
55255525
for (const col of fc) {
55265526
if (col.level === 0) {
5527-
sum += parseInt(col.calcWidth, 10);
5527+
sum += parseFloat(col.calcWidth);
55285528
}
55295529
}
55305530
if (this.isPinningToStart) {
@@ -6265,7 +6265,7 @@ export abstract class IgxGridBaseDirective implements GridType,
62656265
* @hidden @internal
62666266
*/
62676267
public hasHorizontalScroll() {
6268-
return this.totalWidth - this.unpinnedWidth > 0 && this.width !== null;
6268+
return Math.round(this.totalWidth - this.unpinnedWidth) > 0 && this.width !== null;
62696269
}
62706270

62716271
/**
@@ -6316,6 +6316,9 @@ export abstract class IgxGridBaseDirective implements GridType,
63166316
// TODO: do not remove this, as it is used in rowEditTemplate, but mark is as internal and hidden
63176317
/* blazorCSSuppress */
63186318
public endEdit(commit = true, event?: Event): boolean {
6319+
if (!this.crudService.cellInEditMode && !this.crudService.rowInEditMode) {
6320+
return;
6321+
}
63196322
const document = this.nativeElement?.getRootNode() as Document | ShadowRoot;
63206323
const focusWithin = this.nativeElement?.contains(document.activeElement);
63216324

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-validation.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { UIInteractions } from '../../test-utils/ui-interactions.spec';
1717
import { IGridFormGroupCreatedEventArgs } from '../common/grid.interface';
1818
import { IgxTreeGridComponent } from '../tree-grid/tree-grid.component';
1919
import { IgxGridComponent } from './grid.component';
20+
import { AutoPositionStrategy, HorizontalAlignment, IgxOverlayService, VerticalAlignment } from '../../services/public_api';
2021

2122
describe('IgxGrid - Validation #grid', () => {
2223

@@ -187,6 +188,18 @@ describe('IgxGrid - Validation #grid', () => {
187188
const erorrMessage = cell.errorTooltip.first.elementRef.nativeElement.children[0].textContent;
188189
expect(erorrMessage).toEqual(' Entry should be at least 4 character(s) long ');
189190

191+
const overlayService = TestBed.inject(IgxOverlayService);
192+
const info = overlayService.getOverlayById(cell.errorTooltip.first.overlayId);
193+
const positionSettings = info.settings.positionStrategy.settings;
194+
195+
expect(info.settings.positionStrategy instanceof AutoPositionStrategy).toBe(true);
196+
expect(positionSettings.horizontalStartPoint).toEqual(HorizontalAlignment.Center);
197+
expect(positionSettings.horizontalDirection).toEqual(HorizontalAlignment.Center);
198+
expect(positionSettings.verticalStartPoint).toEqual(VerticalAlignment.Bottom);
199+
expect(positionSettings.verticalDirection).toEqual(VerticalAlignment.Bottom);
200+
expect(positionSettings.openAnimation.options.params).toEqual({ duration: '150ms' });
201+
expect(positionSettings.closeAnimation.options.params).toEqual({ duration: '75ms' });
202+
190203
cell.errorTooltip.first.close();
191204
tick();
192205
fixture.detectChanges();

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
}

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

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ describe('igxSelect', () => {
424424
expect(inputElement.nativeElement.getAttribute('aria-haspopup')).toEqual('listbox');
425425
expect(inputElement.nativeElement.getAttribute('aria-labelledby')).toEqual(labelID);
426426
expect(dropdownListElement.nativeElement.getAttribute('aria-labelledby')).toEqual(labelID);
427+
expect(inputElement.nativeElement.getAttribute('aria-required')).toEqual('false');
427428
expect(inputElement.nativeElement.getAttribute('aria-owns')).toEqual(select.listId);
428429
expect(inputElement.nativeElement.getAttribute('aria-expanded')).toEqual('false');
429430
expect(toggleBtn.nativeElement.getAttribute('aria-hidden')).toEqual('true');
@@ -574,6 +575,7 @@ describe('igxSelect', () => {
574575
const dom = fix.debugElement;
575576
const selectComp = fix.componentInstance.select;
576577
const formGroup: UntypedFormGroup = fix.componentInstance.reactiveForm;
578+
inputElement = dom.query(By.css('.' + CSS_CLASS_INPUT));
577579
let inputGroupIsRequiredClass = dom.query(By.css('.' + CSS_CLASS_INPUT_GROUP_REQUIRED));
578580
let inputGroupInvalidClass = dom.query(By.css('.' + CSS_CLASS_INPUT_GROUP_INVALID));
579581
// interaction test - expect actual asterisk
@@ -583,6 +585,7 @@ describe('igxSelect', () => {
583585
expect(asterisk).toBe('"*"');
584586
expect(inputGroupIsRequiredClass).toBeDefined();
585587
expect(inputGroupIsRequiredClass).not.toBeNull();
588+
expect(inputElement.nativeElement.getAttribute('aria-required')).toEqual('true');
586589

587590
// 2) check that input group's --invalid class is NOT applied
588591
expect(inputGroupInvalidClass).toBeNull();
@@ -604,11 +607,13 @@ describe('igxSelect', () => {
604607
inputGroupIsRequiredClass = dom.query(By.css('.' + CSS_CLASS_INPUT_GROUP_REQUIRED));
605608
expect(inputGroupIsRequiredClass).not.toBeNull();
606609
expect(inputGroupIsRequiredClass).not.toBeUndefined();
610+
expect(inputElement.nativeElement.getAttribute('aria-required')).toEqual('true');
607611

608612
// 3) Check if the input group's --invalid and --required classes are removed when validator is dynamically cleared
609613
fix.componentInstance.removeValidators(formGroup);
610614
fix.detectChanges();
611615
tick();
616+
expect(inputElement.nativeElement.getAttribute('aria-required')).toEqual('false');
612617

613618
inputGroupIsRequiredClass = dom.query(By.css('.' + CSS_CLASS_INPUT_GROUP_REQUIRED));
614619
const selectFormReference = fix.componentInstance.reactiveForm.controls.optionsSelect;
@@ -642,6 +647,7 @@ describe('igxSelect', () => {
642647
// Re-add all Validators
643648
fix.componentInstance.addValidators(formGroup);
644649
fix.detectChanges();
650+
expect(inputElement.nativeElement.getAttribute('aria-required')).toEqual('true');
645651

646652
inputGroupIsRequiredClass = dom.query(By.css('.' + CSS_CLASS_INPUT_GROUP_REQUIRED));
647653
expect(inputGroupIsRequiredClass).toBeDefined();
@@ -650,24 +656,6 @@ describe('igxSelect', () => {
650656
// interaction test - expect actual asterisk
651657
asterisk = window.getComputedStyle(dom.query(By.css('.' + CSS_CLASS_INPUT_GROUP_LABEL)).nativeElement, ':after').content;
652658
expect(asterisk).toBe('"*"');
653-
654-
// 4) Should NOT remove asterisk, when remove validators on igxSelect with required HTML attribute set(edge case)
655-
// set required HTML attribute
656-
inputGroup.parent.nativeElement.setAttribute('required', '');
657-
// Re-add all Validators
658-
fix.componentInstance.addValidators(formGroup);
659-
fix.detectChanges();
660-
// update and clear validators
661-
fix.componentInstance.removeValidators(formGroup);
662-
fix.detectChanges();
663-
tick();
664-
// expect asterisk
665-
asterisk = window.getComputedStyle(dom.query(By.css('.' + CSS_CLASS_INPUT_GROUP_LABEL)).nativeElement, ':after').content;
666-
expect(asterisk).toBe('"*"');
667-
inputGroupIsRequiredClass = dom.query(By.css('.' + CSS_CLASS_INPUT_GROUP_REQUIRED));
668-
expect(inputGroupIsRequiredClass).toBeDefined();
669-
expect(inputGroupIsRequiredClass).not.toBeNull();
670-
expect(inputGroupIsRequiredClass).not.toBeUndefined();
671659
}));
672660

673661
it('should update validity state when programmatically setting errors on reactive form controls', fakeAsync(() => {

0 commit comments

Comments
 (0)