Skip to content

Commit d96b094

Browse files
committed
Merge branch 'hanastasov/handle-dates-m' of https://github.com/IgniteUI/igniteui-angular into hanastasov/handle-dates-m
2 parents b629358 + 3db54e2 commit d96b094

14 files changed

+149
-25
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,7 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
795795
const dragMode = this.selectionService.pointerEnter(this.selectionNode, event);
796796
if (dragMode) {
797797
this.grid.cdr.detectChanges();
798+
if (isIE()) { this.grid.tbody.nativeElement.focus({ preventScroll: true }); }
798799
}
799800
}
800801

@@ -808,6 +809,7 @@ export class IgxGridCellComponent implements OnInit, OnChanges, OnDestroy {
808809
this.grid.navigation.activeNode.gridID !== this.gridID))) { return; }
809810
if (this.selectionService.pointerUp(this.selectionNode, this.grid.onRangeSelection)) {
810811
this.grid.cdr.detectChanges();
812+
if (isIE()) { this.grid.tbody.nativeElement.focus({ preventScroll: true }); }
811813
}
812814
}
813815

projects/igniteui-angular/src/lib/grids/filtering/excel-style/grid.excel-style-filtering.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
619619

620620
private addItems(shouldUpdateSelection: boolean) {
621621
this.selectAllSelected = true;
622+
this.containsNullOrEmpty = false;
622623
this.selectAllIndeterminate = false;
623624

624625
this.uniqueValues.forEach(element => {

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

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,6 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
173173
private _cdrRequests = false;
174174
protected _cdrRequestRepaint = false;
175175

176-
/**
177-
* @hidden @internal
178-
*/
179-
public snackbarDisplayTime = 2000;
180-
181176
/**
182177
* @hidden @internal
183178
*/
@@ -248,6 +243,14 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
248243
return this._resourceStrings;
249244
}
250245

246+
/**
247+
* Gets/Sets the display time for the row adding snackbar notification.
248+
* @remarks
249+
* By default it is 6000ms.
250+
*/
251+
@Input()
252+
public snackbarDisplayTime = 6000;
253+
251254
/**
252255
* Gets/Sets whether to autogenerate the columns.
253256
* @remarks
@@ -2984,6 +2987,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
29842987
_setupListeners() {
29852988
const destructor = takeUntil<any>(this.destroy$);
29862989
fromEvent(this.nativeElement, 'focusout').pipe(filter(() => !!this.navigation.activeNode), destructor).subscribe((event) => {
2990+
if (this.selectionService.dragMode && isIE()) { return; }
29872991
if (!this.crudService.cell &&
29882992
!!this.navigation.activeNode &&
29892993
((event.target === this.tbody.nativeElement && this.navigation.activeNode.row >= 0 &&
@@ -5902,21 +5906,12 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
59025906
}
59035907
}
59045908

5905-
/**
5906-
* @hidden @internal
5907-
*/
5908-
copyHandlerIE() {
5909-
if (isIE()) {
5910-
this.copyHandler(null, true);
5911-
}
5912-
}
5913-
59145909
/**
59155910
* @hidden
59165911
* @internal
59175912
*/
5918-
public copyHandler(event, ie11 = false) {
5919-
if (!this.clipboardOptions.enabled || this.crudService.cellInEditMode) {
5913+
public copyHandler(event) {
5914+
if (!this.clipboardOptions.enabled || this.crudService.cellInEditMode || (!isIE() && event.type === 'keydown')) {
59205915
return;
59215916
}
59225917

@@ -5935,7 +5930,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
59355930
result = result.substring(result.indexOf('\n') + 1);
59365931
}
59375932

5938-
if (ie11) {
5933+
if (isIE()) {
59395934
(window as any).clipboardData.setData('Text', result);
59405935
return;
59415936
}

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,27 @@ describe('IgxGrid - Row Adding #grid', () => {
288288
const cell = newRow.cells.find(c => c.column === column);
289289
expect(typeof(cell.value)).toBe(type);
290290
});
291+
292+
it('should allow setting a different display time for snackbar', async() => {
293+
grid.snackbarDisplayTime = 50;
294+
fixture.detectChanges();
295+
296+
const row = grid.getRowByIndex(0);
297+
row.beginAddRow();
298+
fixture.detectChanges();
299+
300+
endTransition();
301+
302+
grid.endEdit(true);
303+
fixture.detectChanges();
304+
305+
expect(grid.addRowSnackbar.isVisible).toBe(true);
306+
// should hide after 50ms
307+
await wait(51);
308+
fixture.detectChanges();
309+
310+
expect(grid.addRowSnackbar.isVisible).toBe(false);
311+
});
291312
});
292313

293314
describe('Add row events tests:', () => {

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5098,6 +5098,20 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
50985098
inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix);
50995099
expect(inputNativeElement.value).toBe('', 'input value didn\'t reset');
51005100
}));
5101+
5102+
it('Should reset blank items on column change.', fakeAsync(() => {
5103+
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'ProductName');
5104+
flush();
5105+
5106+
let listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix);
5107+
expect(listItems[1].innerText).toBe('(Blanks)');
5108+
5109+
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'AnotherField');
5110+
flush();
5111+
5112+
listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix);
5113+
expect(listItems[1].innerText).not.toBe('(Blanks)');
5114+
}));
51015115
});
51025116

51035117
describe('Load values on demand', () => {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
<div class="igx-grid__thead-thumb" [hidden]='!hasVerticalScroll()' [style.width.px]="scrollSize"></div>
9999
</div>
100100

101-
<div igxGridBody (keydown.control.c)="copyHandlerIE()" (copy)="copyHandler($event)" class="igx-grid__tbody">
101+
<div igxGridBody (keydown.control.c)="copyHandler($event)" (copy)="copyHandler($event)" class="igx-grid__tbody">
102102
<div class="igx-grid__tbody-content" tabindex="0" [attr.aria-activedescendant]="activeDescendant" (keydown)="navigation.handleNavigation($event)" (focus)="navigation.focusTbody($event)"
103103
role="rowgroup" (onDragStop)="selectionService.dragMode = $event" (scroll)='preventContainerScroll($event)'
104104
(onDragScroll)="dragScroll($event)" [igxGridDragSelect]="selectionService.dragMode"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
<div class="igx-grid__thead-thumb" [hidden]='!hasVerticalScroll()' [style.width.px]="scrollSize"></div>
8383
</div>
8484

85-
<div igxGridBody (keydown.control.c)="copyHandlerIE()" (copy)="copyHandler($event)" class="igx-grid__tbody">
85+
<div igxGridBody (keydown.control.c)="copyHandler($event)" (copy)="copyHandler($event)" class="igx-grid__tbody">
8686
<div class="igx-grid__tbody-content" tabindex="0" (focus)="navigation.focusTbody($event)" [attr.aria-activedescendant]="activeDescendant"
8787
(keydown)="navigation.handleNavigation($event)" (onDragStop)="selectionService.dragMode = $event"
8888
(onDragScroll)="dragScroll($event)" [igxGridDragSelect]="selectionService.dragMode" role="rowgroup"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
id="right" class="igx-grid__scroll-on-drag-right"></span>
6565
</div>
6666

67-
<div igxGridBody (keydown.control.c)="copyHandlerIE()" (copy)="copyHandler($event)" class="igx-grid__tbody">
67+
<div igxGridBody (keydown.control.c)="copyHandler($event)" (copy)="copyHandler($event)" class="igx-grid__tbody">
6868
<div class="igx-grid__tbody-content" tabindex="0" (focus)="navigation.focusTbody($event)" [attr.aria-activedescendant]="activeDescendant" (keydown)="navigation.handleNavigation($event)" role="rowgroup" (onDragStop)="selectionService.dragMode = $event"
6969
(onDragScroll)="dragScroll($event)" [igxGridDragSelect]="selectionService.dragMode"
7070
[style.height.px]='totalHeight' [style.width.px]='calcWidth' #tbody (scroll)='preventContainerScroll($event)'>

projects/igniteui-angular/src/lib/services/excel/excel-exporter-grid.spec.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { IgxExcelExporterService } from './excel-exporter';
99
import { IgxExcelExporterOptions } from './excel-exporter-options';
1010
import { JSZipWrapper } from './jszip-verification-wrapper.spec';
1111
import { FileContentData } from './test-data.service.spec';
12-
import { ReorderedColumnsComponent, GridIDNameJobTitleComponent, ProductsComponent } from '../../test-utils/grid-samples.spec';
12+
import { ReorderedColumnsComponent, GridIDNameJobTitleComponent, ProductsComponent, GridIDNameJobTitleHireDataPerformanceComponent } from '../../test-utils/grid-samples.spec';
1313
import { SampleTestData } from '../../test-utils/sample-test-data.spec';
1414
import { first } from 'rxjs/operators';
1515
import { DefaultSortingStrategy } from '../../data-operations/sorting-strategy';
@@ -37,7 +37,8 @@ describe('Excel Exporter', () => {
3737
GridIDNameJobTitleComponent,
3838
IgxTreeGridPrimaryForeignKeyComponent,
3939
ProductsComponent,
40-
GridWithEmtpyColumnsComponent
40+
GridWithEmtpyColumnsComponent,
41+
GridIDNameJobTitleHireDataPerformanceComponent
4142
],
4243
imports: [IgxGridModule, IgxTreeGridModule, NoopAnimationsModule]
4344
}).compileComponents();
@@ -511,6 +512,16 @@ describe('Excel Exporter', () => {
511512

512513
await setWorksheetNameAndExport(grid, options, fix, worksheetName);
513514
});
515+
516+
it('Should export arrays as strings.', async () => {
517+
const fix = TestBed.createComponent(GridIDNameJobTitleHireDataPerformanceComponent);
518+
fix.detectChanges();
519+
await wait();
520+
521+
const grid = fix.componentInstance.grid;
522+
523+
await exportAndVerify(grid, options, actualData.personJobHoursDataPerformance);
524+
});
514525
});
515526

516527
describe('', () => {

projects/igniteui-angular/src/lib/services/excel/test-data.service.spec.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,28 @@ export class ExportTestDataService {
122122
{ ID: 9, Name: 'Leslie Hansen', JobTitle: 'Associate Software Developer', HireDate: '2013-10-10T11:23:17.714Z' },
123123
{ ID: 10, Name: 'Eduardo Ramirez', JobTitle: 'Manager', HireDate: '2011-11-28T11:23:17.714Z' }
124124
];
125+
126+
private _personJobHoursDataPerformance = [
127+
{ ID: 1, Name: 'Casey Houston', JobTitle: 'Vice President', WorkingHours: 4, HireDate: '2017-06-19T11:43:07.714Z', Performance: [
128+
{Points: 3, Week: 1},
129+
{Points: 6, Week: 2},
130+
{Points: 1, Week: 3},
131+
{Points: 12, Week: 4},
132+
] },
133+
{ ID: 2, Name: 'Gilberto Todd', JobTitle: 'Director', WorkingHours: 6, HireDate: '2015-12-18T11:23:17.714Z', Performance: [
134+
{Points: 8, Week: 1},
135+
{Points: 7, Week: 2},
136+
{Points: 4, Week: 3},
137+
{Points: 9, Week: 4},
138+
] },
139+
{ ID: 3, Name: 'Tanya Bennett', JobTitle: 'Director', WorkingHours: 8, HireDate: '2005-11-18T11:23:17.714Z', Performance: [
140+
{Points: 1, Week: 1},
141+
{Points: 3, Week: 2},
142+
{Points: 14, Week: 3},
143+
{Points: 29, Week: 4},
144+
] }
145+
];
146+
125147
constructor() { }
126148

127149
get differentTypesData() {
@@ -163,6 +185,10 @@ export class ExportTestDataService {
163185
return this._simpleGridDataFull;
164186
}
165187

188+
get personJobHoursDataPerformance() {
189+
return this._personJobHoursDataPerformance;
190+
}
191+
166192
public getContactsFunkyData(delimiter) {
167193
return [{
168194
name: 'Terrance Mc\'Orta',
@@ -957,5 +983,21 @@ export class FileContentData {
957983

958984
return this.createData();
959985
}
986+
987+
get personJobHoursDataPerformance() {
988+
this._sharedStringsData =
989+
`count="18" uniqueCount="15"><si><t>ID</t></si><si><t>Name</t></si><si><t>JobTitle</t></si><si><t>WorkingHours</t></si><si><t>HireDate</t></si><si><t>Performance</t></si><si><t>Casey Houston</t></si><si><t>Vice President</t></si><si><t>2017-06-19T11:43:07.714Z</t></si><si><t>[object Object],[object Object],[object Object],[object Object]</t></si><si><t>Gilberto Todd</t></si><si><t>Director</t></si><si><t>2015-12-18T11:23:17.714Z</t></si><si><t>Tanya Bennett</t></si><si><t>2005-11-18T11:23:17.714Z</t></si>`;
990+
991+
this._tableData = `ref="A1:F4" totalsRowShown="0">
992+
<autoFilter ref="A1:F4"/><tableColumns count="6"><tableColumn id="1" name="ID"/><tableColumn id="2" name="Name"/><tableColumn id="3" name="JobTitle"/><tableColumn id="4" name="WorkingHours"/><tableColumn id="5" name="HireDate"/><tableColumn id="6" name="Performance"/></tableColumns>`;
993+
994+
this._worksheetData = `<dimension ref="A1:F4"/>
995+
<sheetViews><sheetView tabSelected="1" workbookViewId="0"></sheetView></sheetViews>
996+
<sheetFormatPr defaultRowHeight="15" x14ac:dyDescent="0.25"/>
997+
<cols><col min="1" max="1" width="50" customWidth="1"/><col min="2" max="2" width="50" customWidth="1"/><col min="3" max="3" width="50" customWidth="1"/><col min="4" max="4" width="50" customWidth="1"/><col min="5" max="5" width="50" customWidth="1"/><col min="6" max="6" width="50" customWidth="1"/></cols>
998+
<sheetData><row r="1"><c r="A1" t="s"><v>0</v></c><c r="B1" t="s"><v>1</v></c><c r="C1" t="s"><v>2</v></c><c r="D1" t="s"><v>3</v></c><c r="E1" t="s"><v>4</v></c><c r="F1" t="s"><v>5</v></c></row><row r="2"><c r="A2" s="1"><v>1</v></c><c r="B2" t="s"><v>6</v></c><c r="C2" t="s"><v>7</v></c><c r="D2" s="1"><v>4</v></c><c r="E2" t="s"><v>8</v></c><c r="F2" t="s"><v>9</v></c></row><row r="3"><c r="A3" s="1"><v>2</v></c><c r="B3" t="s"><v>10</v></c><c r="C3" t="s"><v>11</v></c><c r="D3" s="1"><v>6</v></c><c r="E3" t="s"><v>12</v></c><c r="F3" t="s"><v>9</v></c></row><row r="4"><c r="A4" s="1"><v>3</v></c><c r="B4" t="s"><v>13</v></c><c r="C4" t="s"><v>11</v></c><c r="D4" s="1"><v>8</v></c><c r="E4" t="s"><v>14</v></c><c r="F4" t="s"><v>9</v></c></row></sheetData>`;
999+
1000+
return this.createData();
1001+
}
9601002
/* tslint:enable max-line-length */
9611003
}

0 commit comments

Comments
 (0)