Skip to content

Commit 460f075

Browse files
authored
Merge branch 'master' into bpenkov/igx-date-range
2 parents 0400daf + f68ceb8 commit 460f075

23 files changed

+500
-116
lines changed

projects/igniteui-angular/src/lib/grids/common/grid-pipes.module.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import {
1010
IgxGridPaginatorOptionsPipe,
1111
IgxHasVisibleColumnsPipe,
1212
IgxDatePipeComponent,
13-
IgxDecimalPipeComponent
13+
IgxDecimalPipeComponent,
14+
IgxGridRowPinningPipe
1415
} from './pipes';
1516

1617
@NgModule({
@@ -24,7 +25,8 @@ import {
2425
IgxGridCellStylesPipe,
2526
IgxGridCellStyleClassesPipe,
2627
IgxGridPaginatorOptionsPipe,
27-
IgxHasVisibleColumnsPipe
28+
IgxHasVisibleColumnsPipe,
29+
IgxGridRowPinningPipe
2830
],
2931
exports: [
3032
IgxDatePipeComponent,
@@ -36,7 +38,8 @@ import {
3638
IgxGridCellStylesPipe,
3739
IgxGridCellStyleClassesPipe,
3840
IgxGridPaginatorOptionsPipe,
39-
IgxHasVisibleColumnsPipe
41+
IgxHasVisibleColumnsPipe,
42+
IgxGridRowPinningPipe
4043
],
4144
imports: [
4245
CommonModule

projects/igniteui-angular/src/lib/grids/common/pipes.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,34 @@ export class IgxDecimalPipeComponent extends DecimalPipe implements PipeTransfor
212212
}
213213
}
214214
}
215+
216+
/**
217+
* @hidden
218+
*/
219+
@Pipe({
220+
name: 'gridRowPinning',
221+
pure: true
222+
})
223+
export class IgxGridRowPinningPipe implements PipeTransform {
224+
225+
constructor(private gridAPI: GridBaseAPIService<IgxGridBaseDirective & GridType>) {}
226+
227+
public transform(collection: any[] , id: string, isPinned = false, pipeTrigger: number) {
228+
const grid = this.gridAPI.grid;
229+
230+
if (!grid.hasPinnedRecords) {
231+
return isPinned ? [] : collection;
232+
}
233+
234+
if (grid.hasPinnedRecords && isPinned) {
235+
const result = collection.filter(rec => grid.isRecordPinned(rec));
236+
result.sort((rec1, rec2) => grid.pinRecordIndex(rec1) - grid.pinRecordIndex(rec2));
237+
return result;
238+
}
239+
240+
grid.unpinnedRecords = collection;
241+
return collection.map((rec) => {
242+
return grid.isRecordPinned(rec) ? { recordRef: rec, ghostRecord: true} : rec;
243+
});
244+
}
245+
}

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { IBaseChipEventArgs, IgxChipsAreaComponent, IgxChipComponent } from '../
2424
import { ExpressionUI } from '../grid-filtering.service';
2525
import { IgxDropDownItemComponent } from '../../../drop-down/drop-down-item.component';
2626
import { IgxFilteringService } from '../grid-filtering.service';
27-
import { KEYS, isEdge, isIE } from '../../../core/utils';
27+
import { KEYS, isEdge } from '../../../core/utils';
2828
import { AbsoluteScrollStrategy } from '../../../services/overlay/scroll';
2929

3030
/**
@@ -262,11 +262,8 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
262262
public onInput(eventArgs) {
263263
// The 'iskeyPressed' flag is needed for a case in IE, because the input event is fired on focus and for some reason,
264264
// when you have a japanese character as a placeholder, on init the value here is empty string .
265-
// There is no need to reset the value on every invalid number input.
266-
// The invalid value is converted to empty string input type="number"
267-
const target = eventArgs.target;
268-
if (isEdge() && target.type !== 'number' || this.isKeyPressed && isIE() || target.value) {
269-
this.value = target.value;
265+
if (isEdge() || this.isKeyPressed || eventArgs.target.value) {
266+
this.value = eventArgs.target.value;
270267
}
271268
}
272269

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
350350
}
351351
}
352352

353-
constructor(private cdr: ChangeDetectorRef) {}
353+
constructor(private cdr: ChangeDetectorRef, private element: ElementRef) {}
354354

355355
/**
356356
* @hidden @internal
@@ -519,7 +519,7 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
519519
this.customDialog.selectedOperator = eventArgs.newSelection.value;
520520
eventArgs.cancel = true;
521521
if (this.overlayComponentId) {
522-
this.mainDropdown.nativeElement.style.display = 'none';
522+
this.element.nativeElement.style.display = 'none';
523523
}
524524
this.subMenu.close();
525525
this.customDialog.open(this.mainDropdown.nativeElement);

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2930,8 +2930,9 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
29302930

29312931
public setFilterData(data, pinned: boolean) {
29322932
if (this.hasPinnedRecords && pinned) {
2933-
this._filteredPinnedData = data;
2934-
this.filteredData = [... this._filteredPinnedData, ... this._filteredUnpinnedData];
2933+
this._filteredPinnedData = data || [];
2934+
const filteredUnpinned = this._filteredUnpinnedData || [];
2935+
this.filteredData = [... this._filteredPinnedData, ... filteredUnpinned];
29352936
} else if (this.hasPinnedRecords && !pinned) {
29362937
this._filteredUnpinnedData = data;
29372938
} else {
@@ -2987,6 +2988,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
29872988
* @internal
29882989
*/
29892990
public setFilteredSortedData(data, pinned: boolean) {
2991+
data = data.map(rec => rec.ghostRecord !== undefined ? rec.recordRef : rec);
29902992
if (this._pinnedRecordIDs.length > 0 && pinned) {
29912993
this._filteredSortedPinnedData = data;
29922994
this.filteredSortedData = this.isRowPinningToTop ? [... this._filteredSortedPinnedData, ... this._filteredSortedUnpinnedData] :
@@ -5164,13 +5166,13 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
51645166
return this.unpinnedRecords ? this.unpinnedRecords : this.verticalScrollContainer.igxForOf;
51655167
}
51665168

5167-
/**
5168-
* Returns the currently transformed paged/filtered/sorted/grouped pinned data, displayed in the grid.
5169-
* @example
5170-
* ```typescript
5171-
* const pinnedDataView = this.grid.pinnedDataView;
5172-
* ```
5173-
*/
5169+
/**
5170+
* Returns the currently transformed paged/filtered/sorted/grouped pinned data, displayed in the grid.
5171+
* @example
5172+
* ```typescript
5173+
* const pinnedDataView = this.grid.pinnedDataView;
5174+
* ```
5175+
*/
51745176
get pinnedDataView(): any[] {
51755177
return this.pinnedRows.map(row => row.rowData);
51765178
}

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,6 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
229229

230230
expect(grid.rowList.length).toEqual(3);
231231
verifyFilterRowUI(input, close, reset, false);
232-
233-
// greater than or equal to with invalid value should not reset filter
234-
GridFunctions.openFilterDDAndSelectCondition(fix, 4);
235-
GridFunctions.typeValueInFilterRowInput('254..', fix, input);
236-
237-
expect(grid.rowList.length).toEqual(3);
238-
verifyFilterRowUI(input, close, reset, false);
239232
}));
240233

241234
// UI tests boolean column

projects/igniteui-angular/src/lib/grids/grid/grid.module.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ import {
1313
IgxGridPagingPipe,
1414
IgxGridGroupingPipe,
1515
IgxGridSortingPipe,
16-
IgxGridFilteringPipe,
17-
IgxGridRowPinningPipe
16+
IgxGridFilteringPipe
1817
} from './grid.pipes';
1918
import { IgxGridGroupByRowComponent } from './groupby-row.component';
2019
import { IgxGridRowComponent } from './grid-row.component';
@@ -42,7 +41,6 @@ import { IgxGridExpandableCellComponent } from './expandable-cell.component';
4241
IgxGridPagingPipe,
4342
IgxGridSortingPipe,
4443
IgxGridFilteringPipe,
45-
IgxGridRowPinningPipe,
4644
IgxGridSummaryPipe,
4745
IgxGridDetailsPipe,
4846
IgxGridExpandableCellComponent
@@ -63,7 +61,6 @@ import { IgxGridExpandableCellComponent } from './expandable-cell.component';
6361
IgxGridPagingPipe,
6462
IgxGridSortingPipe,
6563
IgxGridFilteringPipe,
66-
IgxGridRowPinningPipe,
6764
IgxGridSummaryPipe,
6865
IgxGridDetailsPipe,
6966
IgxGridCommonModule

projects/igniteui-angular/src/lib/grids/grid/grid.pipes.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -152,33 +152,3 @@ export class IgxGridFilteringPipe implements PipeTransform {
152152
}
153153
}
154154

155-
/**
156-
* @hidden
157-
*/
158-
@Pipe({
159-
name: 'gridRowPinning',
160-
pure: true
161-
})
162-
export class IgxGridRowPinningPipe implements PipeTransform {
163-
164-
constructor(private gridAPI: GridBaseAPIService<IgxGridBaseDirective & GridType>) {}
165-
166-
public transform(collection: any[] , id: string, isPinned = false, pipeTrigger: number) {
167-
const grid = this.gridAPI.grid;
168-
169-
if (!grid.hasPinnedRecords) {
170-
return isPinned ? [] : collection;
171-
}
172-
173-
if (grid.hasPinnedRecords && isPinned) {
174-
const result = collection.filter(rec => grid.isRecordPinned(rec));
175-
result.sort((rec1, rec2) => grid.pinRecordIndex(rec1) - grid.pinRecordIndex(rec2));
176-
return result;
177-
}
178-
179-
grid.unpinnedRecords = collection;
180-
return collection.map((rec) => {
181-
return grid.isRecordPinned(rec) ? { recordRef: rec, ghostRecord: true} : rec;
182-
});
183-
}
184-
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ describe('IgxGrid - search API #grid - ', () => {
696696
setupGridScrollDetection(fix, grid);
697697
fix.detectChanges();
698698

699-
grid.data[29] = { ID: 30, Name: 'Eduardo Ramirez', JobTitle: 'Manager', HireDate: '1887-11-28T11:23:17.714Z' };
699+
grid.data[29].HireDate = '1887-11-28T11:23:17.714Z';
700700
grid.width = '500px';
701701
grid.height = '600px';
702702
fixNativeElement = fix.debugElement.nativeElement;

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
<ng-template #defaultPinnedIndicator>
2+
<igx-chip *ngIf="displayPinnedChip" class="igx-grid__td--pinned-chip" [disabled]="true" [displayDensity]="'compact'">{{ grid.resourceStrings.igx_grid_pinned_row_indicator }}</igx-chip>
3+
</ng-template>
14
<ng-template #defaultCell>
25
<div igxTextHighlight style="pointer-events: none" [cssClass]="highlightClass" [activeCssClass]="activeHighlightClass" [groupName]="gridID"
36
[value]="formatter ? formatter(value) : column.dataType === 'number' ? (value | igxdecimal: grid.locale) : column.dataType === 'date' ? (value | igxdate: grid.locale) : value"
@@ -36,6 +39,8 @@
3639
(click)="toggle($event)" (focus)="onIndicatorFocus()" tabindex="-1">
3740
<ng-container *ngTemplateOutlet="iconTemplate; context: { $implicit: this }">
3841
</ng-container>
42+
<ng-container *ngTemplateOutlet="pinnedIndicatorTemplate; context: context">
43+
</ng-container>
3944
</div>
4045
<div *ngIf="isLoading"
4146
(dblclick)="onLoadingDblClick($event)"

0 commit comments

Comments
 (0)