Skip to content

Commit 5978982

Browse files
Merge branch '19.2.x' into ganastasov/fix-15808-19.2
2 parents 5b3989f + b7d0fca commit 5978982

File tree

9 files changed

+107
-32
lines changed

9 files changed

+107
-32
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: 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: 2 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
/**

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/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(() => {

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -605,19 +605,25 @@ export class IgxSelectComponent extends IgxDropDownComponent implements IgxSelec
605605

606606
protected manageRequiredAsterisk(): void {
607607
const hasRequiredHTMLAttribute = this.elementRef.nativeElement.hasAttribute('required');
608+
let isRequired = false;
609+
608610
if (this.ngControl && this.ngControl.control.validator) {
609-
// Run the validation with empty object to check if required is enabled.
610611
const error = this.ngControl.control.validator({} as AbstractControl);
611-
this.inputGroup.isRequired = error && error.required;
612-
this.cdr.markForCheck();
612+
isRequired = !!(error && error.required);
613+
}
614+
615+
this.inputGroup.isRequired = isRequired;
613616

614-
// If validator is dynamically cleared and no required HTML attribute is set,
615-
// reset label's required class(asterisk) and IgxInputState #6896
616-
} else if (this.inputGroup.isRequired && this.ngControl && !this.ngControl.control.validator && !hasRequiredHTMLAttribute) {
617+
if (this.input?.nativeElement) {
618+
this.input.nativeElement.setAttribute('aria-required', isRequired.toString());
619+
}
620+
621+
// Handle validator removal case
622+
if (!isRequired && !hasRequiredHTMLAttribute) {
617623
this.input.valid = IgxInputState.INITIAL;
618-
this.inputGroup.isRequired = false;
619-
this.cdr.markForCheck();
620624
}
625+
626+
this.cdr.markForCheck();
621627
}
622628

623629
private setSelection(item: IgxDropDownItemBaseDirective) {

0 commit comments

Comments
 (0)