Skip to content

Commit beac2be

Browse files
Merge pull request #7726 from IgniteUI/dmdimitrov/esf-templates
feat(esf): templating improvements
2 parents a56afb2 + fb62c62 commit beac2be

File tree

39 files changed

+1345
-899
lines changed

39 files changed

+1345
-899
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ All notable changes for each version of this project will be documented in this
1717
- **Breaking Changes** - The `igx-action-icon` has been renamed to `igx-navbar-action`. It should get renamed in your components via `ng update`;
1818
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
1919
- **Breaking Change** - The `selectedRows` method is now an `@Input` property. Setting it to an array of Row IDs will update the grid's selection state, any previous selection will be cleared. Setting it to an empty array will clear the selection entirely.
20+
- **Breaking Change** - Removed `IgxExcelStyleSortingTemplateDirective`, `IgxExcelStyleHidingTemplateDirective`, `IgxExcelStyleMovingTemplateDirective`, `IgxExcelStylePinningTemplateDirective` and `IgxExcelStyleSelectingTemplateDirective` directives for re-templating the Excel style filter menu. Added two new directives for re-templating the column operations and filter operations areas - `IgxExcelStyleColumnOperationsTemplateDirective` and `IgxExcelStyleFilterOperationsTemplateDirective`. Exposed all internal components of the Excel style filter menu in order to be used inside the templates.
2021
- **Breaking Change** - `IgxColumnHiding` and `IgxColumnPinning` components have been deprecated in favor of a component combining the their functionality - `IgxColumnActions` which is used with either of the new `IgxColumnPinning` and `IgxColumnHiding` directives that specify the action to be triggered through the UI.
2122
- `igxGrid`
2223
- **Behavioral Change** - For numeric columns, the onCellEdit arguments' newValue will now contain the numeric value that will be committed instead of the string input.

projects/igniteui-angular/src/lib/core/styles/components/grid/_excel-filtering-theme.scss

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
%grid-excel-filter {
1919
display: block;
20-
width: 100%;
20+
width: rem(320px);
2121
height: 100%;
2222
flex-grow: 1;
2323
box-shadow: igx-elevation($elevations, 12);
@@ -27,10 +27,7 @@
2727

2828
%grid-excel-filter--inline {
2929
box-shadow: none;
30-
31-
%grid-excel-menu {
32-
width: 100%;
33-
}
30+
width: 100%;
3431
}
3532

3633
%igx-excel-filter__loading {
@@ -127,8 +124,7 @@
127124

128125
%grid-excel-sort {
129126
display: block;
130-
padding-top: rem(8px);
131-
padding-bottom: rem(8px);
127+
padding: rem(8px) rem(16px);
132128

133129
header {
134130
color: igx-color($palette, 'grays', 700);
@@ -175,7 +171,8 @@
175171
}
176172

177173
%grid-excel-move {
178-
margin-bottom: rem(8px);
174+
display: block;
175+
padding: rem(8px) rem(16px);
179176

180177
header {
181178
color: igx-color($palette, 'grays', 700);
@@ -223,7 +220,6 @@
223220
align-items: center;
224221
justify-content: space-between;
225222
padding: rem(8px) rem(16px);
226-
margin: 0 -#{rem(16px)};
227223
cursor: pointer;
228224
color: igx-color($palette, 'grays', 700);
229225
outline-style: none;
@@ -269,8 +265,11 @@
269265
}
270266

271267
%grid-excel-sort {
272-
padding-top: rem(8px);
273-
padding-bottom: rem(8px);
268+
padding: rem(8px);
269+
}
270+
271+
%grid-excel-move {
272+
padding: rem(8px);
274273
}
275274

276275
%grid-excel-actions {
@@ -279,7 +278,6 @@
279278

280279
%grid-excel-actions__action {
281280
padding: rem(8px);
282-
margin: 0 -#{rem(8px)};
283281
}
284282

285283
%grid-excel-main {
@@ -302,8 +300,7 @@
302300
}
303301

304302
%grid-excel-sort {
305-
padding-top: rem(4px);
306-
padding-bottom: rem(4px);
303+
padding: rem(4px);
307304

308305
@extend %grid-excel-action--compact;
309306

@@ -319,6 +316,7 @@
319316
%grid-excel-move {
320317
@extend %grid-excel-action--compact;
321318
margin-bottom: 0;
319+
padding: rem(4px);
322320
}
323321

324322
%grid-excel-actions {
@@ -327,7 +325,6 @@
327325

328326
%grid-excel-actions__action {
329327
padding: rem(4px);
330-
margin: 0 -#{rem(4px)};
331328
}
332329

333330
%grid-excel-main {
@@ -440,6 +437,14 @@
440437
margin-#{$right}: rem(8px);
441438
}
442439
}
440+
441+
igx-excel-style-filter-operations,
442+
[igxExcelStyleFilterOperations] {
443+
display: flex;
444+
flex-direction: column;
445+
flex-grow: 1;
446+
overflow: hidden;
447+
}
443448
}
444449

445450
/// Adds typography styles for the excel-style-filtering component.

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,17 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
12321232
return end;
12331233
}
12341234

1235+
/**
1236+
* @hidden
1237+
* Reset scroll position.
1238+
* Needed in case scrollbar is hidden/detached but we still need to reset it.
1239+
*/
1240+
public resetScrollPosition() {
1241+
this.scrollPosition = 0;
1242+
this.scrollComponent.scrollAmount = 0;
1243+
this.state.startIndex = 0;
1244+
}
1245+
12351246
protected _recalcScrollBarSize() {
12361247
const count = this.isRemote ? this.totalItemCount : (this.igxForOf ? this.igxForOf.length : 0);
12371248
this.dc.instance.notVirtual = !(this.igxForContainerSize && this.dc && this.state.chunkSize < count);
@@ -1241,20 +1252,14 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
12411252
this.scrollComponent.nativeElement.style.width = this.igxForContainerSize + 'px';
12421253
this.scrollComponent.size = totalWidth;
12431254
if (totalWidth <= parseInt(this.igxForContainerSize, 10)) {
1244-
this.scrollPosition = 0;
1245-
// Need to reset the scrollAmount value here, because horizontalScrollBar is hidden, therefore
1246-
// onScroll event handler for VirtualHelperBaseDirective will not be called
1247-
this.scrollComponent.scrollAmount = 0;
1255+
this.resetScrollPosition();
12481256
}
12491257
}
12501258
if (this.igxForScrollOrientation === 'vertical') {
12511259
this.scrollComponent.nativeElement.style.height = parseInt(this.igxForContainerSize, 10) + 'px';
12521260
this.scrollComponent.size = this._calcHeight();
12531261
if ( this.scrollComponent.size <= parseInt(this.igxForContainerSize, 10)) {
1254-
this.scrollPosition = 0;
1255-
// Need to reset the scrollAmount value here, because verticalScrollBar is hidden, therefore
1256-
// onScroll event handler for VirtualHelperBaseDirective will not be called
1257-
this.scrollComponent.scrollAmount = 0;
1262+
this.resetScrollPosition();
12581263
}
12591264
}
12601265
if (scrollable !== this.isScrollable()) {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<div *ngIf="esf.column"
2+
tabindex="0"
3+
[ngClass]="clearFilterClass()"
4+
(keydown)="onClearFilterKeyDown($event)"
5+
(click)="clearFilter()">
6+
<span>{{ esf.grid.resourceStrings.igx_grid_excel_filter_clear }}</span>
7+
<igx-icon>clear</igx-icon>
8+
</div>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { Component } from '@angular/core';
2+
import { KEYS } from '../../../core/utils';
3+
import { IgxGridExcelStyleFilteringComponent } from './grid.excel-style-filtering.component';
4+
5+
/**
6+
* A component used for presenting Excel style clear filters UI.
7+
*/
8+
@Component({
9+
preserveWhitespaces: false,
10+
selector: 'igx-excel-style-clear-filters',
11+
templateUrl: './excel-style-clear-filters.component.html'
12+
})
13+
export class IgxExcelStyleClearFiltersComponent {
14+
constructor(public esf: IgxGridExcelStyleFilteringComponent) { }
15+
16+
/**
17+
* @hidden @internal
18+
*/
19+
public clearFilterClass() {
20+
if (this.esf.column.filteringExpressionsTree) {
21+
return 'igx-excel-filter__actions-clear';
22+
}
23+
24+
return 'igx-excel-filter__actions-clear--disabled';
25+
}
26+
27+
/**
28+
* @hidden @internal
29+
*/
30+
public clearFilter() {
31+
this.esf.grid.filteringService.clearFilter(this.esf.column.field);
32+
this.selectAllFilterItems();
33+
}
34+
35+
/**
36+
* @hidden @internal
37+
*/
38+
public onClearFilterKeyDown(eventArgs) {
39+
if (eventArgs.key === KEYS.ENTER) {
40+
this.clearFilter();
41+
}
42+
}
43+
44+
private selectAllFilterItems() {
45+
this.esf.listData.forEach(filterListItem => {
46+
filterListItem.isSelected = true;
47+
filterListItem.indeterminate = false;
48+
});
49+
this.esf.detectChanges();
50+
}
51+
}

projects/igniteui-angular/src/lib/grids/filtering/excel-style/excel-style-column-moving.component.html

Lines changed: 0 additions & 27 deletions
This file was deleted.

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

Lines changed: 0 additions & 95 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<ng-container *ngIf="esf.column">
2+
<div tabindex="0"
3+
class="igx-excel-filter__actions-filter"
4+
(keydown)="onTextFilterKeyDown($event)"
5+
(click)="onTextFilterClick($event)"
6+
[igxDropDownItemNavigation]="subMenu">
7+
<span>{{ subMenuText }}</span>
8+
<igx-icon>keyboard_arrow_right</igx-icon>
9+
</div>
10+
11+
<igx-drop-down
12+
#subMenu
13+
[maxHeight]="'397px'"
14+
[displayDensity]="esf.grid.displayDensity"
15+
(onSelection)="onSubMenuSelection($event)"
16+
(onClosed)="onSubMenuClosed()">
17+
<div>
18+
<igx-drop-down-item
19+
*ngFor="let condition of conditions"
20+
[value]="condition">
21+
<igx-icon fontSet="filtering-icons" [name]="getCondition(condition).iconName"></igx-icon>
22+
<span style="margin-left: 16px">{{ translateCondition(condition) }}</span>
23+
</igx-drop-down-item>
24+
<igx-drop-down-item *ngIf="showCustomFilterItem()">
25+
<igx-icon>filter_list</igx-icon>
26+
<span style="margin-left: 16px">{{ esf.grid.resourceStrings.igx_grid_excel_custom_filter }}</span>
27+
</igx-drop-down-item>
28+
</div>
29+
</igx-drop-down>
30+
31+
<igx-excel-style-custom-dialog
32+
#customDialog
33+
[column]="esf.column"
34+
[filteringService]="esf.grid.filteringService"
35+
[overlayComponentId]="esf.overlayComponentId"
36+
[overlayService]="esf.overlayService"
37+
[displayDensity]="esf.grid.displayDensity">
38+
</igx-excel-style-custom-dialog>
39+
</ng-container>

0 commit comments

Comments
 (0)