Skip to content

Commit af945f8

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Remove some redundant code.
1 parent 207da60 commit af945f8

File tree

2 files changed

+22
-37
lines changed

2 files changed

+22
-37
lines changed

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

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
<div class='igx-grid__tr-pivot--filter-container'>
44
<div #pivotFilterContainer *ngIf="grid.showPivotConfigurationUI"
55
class="igx-grid__tr-pivot igx-grid__tr-pivot--filter" [style.min-width.px]="grid.pivotRowWidths - 1"
6-
[style.max-width.px]="grid.pivotRowWidths - 1" (igxDragEnter)="onAreaDragEnter($event, filterArea, 2)"
7-
(igxDragLeave)="onAreaDragLeave($event, filterArea)" igxDrop
8-
(dropped)="onDimDrop($event, filterArea, 2)" (pointerdown)="$event.preventDefault()">
6+
[style.max-width.px]="grid.pivotRowWidths - 1" (igxDragLeave)="onAreaDragLeave($event, filterArea)"
7+
igxDrop (dropped)="onDimDrop($event, filterArea, 2)" (pointerdown)="$event.preventDefault()">
98
<!-- Filter area -->
109
<igx-chips-area #filterArea droppable='true'>
1110
<span id='empty' igxDrop (dropped)="onDimDrop($event, filterArea, 2)"
12-
*ngIf="grid.filterDimensions.length === 0" class='igx-pivot__emptyChipArea'>{{grid.resourceStrings.igx_grid_pivot_empty_filter_drop_area}}</span>
11+
*ngIf="grid.filterDimensions.length === 0"
12+
class='igx-pivot__emptyChipArea'>{{grid.resourceStrings.igx_grid_pivot_empty_filter_drop_area}}</span>
1313
<ng-container *ngFor="let filter of grid.filterDimensions; let last = last;">
1414
<span [style.visibility]='"hidden"' class="igx-grid__tr-pivot--chip_drop_indicator"
1515
[style.height.px]='getAreaHeight(filterArea)'></span>
@@ -26,24 +26,25 @@
2626
[style.height.px]='getAreaHeight(filterArea)'></span>
2727
</ng-container>
2828
</ng-container>
29-
<igx-chip igxDrop (dragDrop)="onDimDrop($event, filterArea, 2)" #notifyChip [hidden]='true' [displayDensity]="grid.displayDensity">
29+
<igx-chip igxDrop (dragDrop)="onDimDrop($event, filterArea, 2)" #notifyChip [hidden]='true'
30+
[displayDensity]="grid.displayDensity">
3031
{{grid.resourceStrings.igx_grid_pivot_filter_drop_chip}}
3132
</igx-chip>
3233
</igx-chips-area>
3334
</div>
34-
<div class='igx-grid__tr-pivot--drop-row-area' (igxDragEnter)="onAreaDragEnter($event, rowArea, 0)"
35-
(igxDragLeave)="onAreaDragLeave($event, rowArea)" igxDrop (dropped)="onDimDrop($event, rowArea, 0)">
35+
<div class='igx-grid__tr-pivot--drop-row-area' (igxDragLeave)="onAreaDragLeave($event, rowArea)" igxDrop
36+
(dropped)="onDimDrop($event, rowArea, 0)">
3637
</div>
3738
</div>
3839

3940
<div class="igx-grid__tr-pivot-group">
4041
<div #pivotColumnContainer *ngIf="grid.showPivotConfigurationUI" class="igx-grid__tr-pivot"
41-
(dropped)="onDimDrop($event, colArea, 1)" igxDrop (igxDragEnter)="onAreaDragEnter($event, colArea, 1)"
42-
(igxDragLeave)="onAreaDragLeave($event, colArea)">
42+
(dropped)="onDimDrop($event, colArea, 1)" igxDrop (igxDragLeave)="onAreaDragLeave($event, colArea)">
4343
<!-- Columns area -->
4444
<igx-chips-area #colArea droppable='true'>
45-
<span id='empty' (dropped)="onDimDrop($event, colArea, 1)" igxDrop *ngIf="grid.columnDimensions.length === 0"
46-
class='igx-pivot__emptyChipArea'> {{grid.resourceStrings.igx_grid_pivot_empty_column_drop_area}}</span>
45+
<span id='empty' (dropped)="onDimDrop($event, colArea, 1)" igxDrop
46+
*ngIf="grid.columnDimensions.length === 0" class='igx-pivot__emptyChipArea'>
47+
{{grid.resourceStrings.igx_grid_pivot_empty_column_drop_area}}</span>
4748
<ng-container *ngFor="let col of grid.columnDimensions; let last = last;">
4849
<span [style.visibility]='"hidden"' class="igx-grid__tr-pivot--chip_drop_indicator"
4950
[style.height.px]='getAreaHeight(colArea)'></span>
@@ -64,22 +65,23 @@
6465
[style.height.px]='getAreaHeight(colArea)'></span>
6566
</ng-container>
6667
</ng-container>
67-
<igx-chip igxDrop (dragDrop)="onDimDrop($event, colArea, 1)" #notifyChip [hidden]='true' [displayDensity]="grid.displayDensity">
68+
<igx-chip igxDrop (dragDrop)="onDimDrop($event, colArea, 1)" #notifyChip [hidden]='true'
69+
[displayDensity]="grid.displayDensity">
6870
{{grid.resourceStrings.igx_grid_pivot_column_drop_chip}}
6971
</igx-chip>
7072
</igx-chips-area>
7173
</div>
7274

7375
<div #pivotValueContainer *ngIf="grid.showPivotConfigurationUI" class="igx-grid__tr-pivot"
7476
(pointerdown)="$event.preventDefault()" (dropped)="onValueDrop($event, valueArea)" igxDrop
75-
(igxDragEnter)="onAreaDragEnter($event, valueArea)" (igxDragLeave)="onAreaDragLeave($event, valueArea)">
77+
(igxDragLeave)="onAreaDragLeave($event, valueArea)">
7678
<!-- Value area -->
7779
<igx-chips-area #valueArea droppable='true'>
7880
<span id='empty' (dropped)="onValueDrop($event, valueArea)" igxDrop *ngIf="grid.values.length === 0"
7981
class='igx-pivot__emptyChipArea'>{{grid.resourceStrings.igx_grid_pivot_empty_value_drop_area}}</span>
8082
<ng-container *ngFor="let value of grid.values; let last = last;">
8183
<span [style.visibility]='"hidden"' class="igx-grid__tr-pivot--chip_drop_indicator"
82-
[style.height.px]='getAreaHeight(valueArea)'></span>
84+
[style.height.px]='getAreaHeight(valueArea)'></span>
8385
<igx-chip #currChip [draggable]="true" [id]="value.displayName || value.member"
8486
[displayDensity]="grid.displayDensity" [removable]="true" (remove)="valueRemoved($event)"
8587
(dragLeave)="onDimDragLeave($event)" (dragOver)="onDimDragOver($event)"
@@ -97,7 +99,8 @@
9799
[style.height.px]='getAreaHeight(valueArea)'></span>
98100
</ng-container>
99101
</ng-container>
100-
<igx-chip igxDrop (dragDrop)="onValueDrop($event, valueArea)" #notifyValueChip [hidden]='true' [displayDensity]="grid.displayDensity">
102+
<igx-chip igxDrop (dragDrop)="onValueDrop($event, valueArea)" #notifyValueChip [hidden]='true'
103+
[displayDensity]="grid.displayDensity">
101104
{{grid.resourceStrings.igx_grid_pivot_value_drop_chip}}
102105
</igx-chip>
103106
</igx-chips-area>
@@ -112,9 +115,8 @@
112115
<!-- Column headers area -->
113116
<div class="igx-grid__tr" role="row" [style.width.px]="width">
114117
<div #pivotContainer class="igx-grid__tr-pivot igx-grid__tr-pivot--row-area"
115-
[style.min-width.px]="grid.pivotRowWidths - 1" (igxDragEnter)="onAreaDragEnter($event, rowArea, 0)"
116-
(igxDragLeave)="onAreaDragLeave($event, rowArea)" igxDrop (dropped)="onDimDrop($event, rowArea, 0)"
117-
(pointerdown)="$event.preventDefault()">
118+
[style.min-width.px]="grid.pivotRowWidths - 1" (igxDragLeave)="onAreaDragLeave($event, rowArea)" igxDrop
119+
(dropped)="onDimDrop($event, rowArea, 0)" (pointerdown)="$event.preventDefault()">
118120
<!-- Row area -->
119121
<igx-chips-area #rowArea droppable='true'>
120122
<ng-container *ngIf="grid.showPivotConfigurationUI">
@@ -141,7 +143,8 @@
141143
[style.height.px]='getAreaHeight(rowArea)'></span>
142144
</ng-container>
143145
</ng-container>
144-
<igx-chip igxDrop (dragDrop)="onDimDrop($event, rowArea, 0)" #notifyChip [hidden]='true' [displayDensity]="grid.displayDensity">
146+
<igx-chip igxDrop (dragDrop)="onDimDrop($event, rowArea, 0)" #notifyChip [hidden]='true'
147+
[displayDensity]="grid.displayDensity">
145148
{{grid.resourceStrings.igx_grid_pivot_row_drop_chip}}
146149
</igx-chip>
147150
</ng-container>

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-header-row.component.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -231,24 +231,6 @@ export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent {
231231
this._dropPos = DropPosition.AfterDropTarget;
232232
}
233233

234-
public onAreaDragEnter(event, area, dimension?: PivotDimensionType) {
235-
const dragId = event.detail.owner.element.nativeElement.parentElement.id;
236-
const typeMismatch = dimension !== undefined ? this.grid.pivotConfiguration.values.find(x => x.member === dragId || x.displayName === dragId) :
237-
!this.grid.pivotConfiguration.values.find(x => x.member === dragId || x.displayName === dragId);
238-
if (typeMismatch) {
239-
// cannot drag between dimensions and value
240-
return;
241-
}
242-
const lastChip = area.chipsList.last;
243-
if (lastChip && this.notificationChips.toArray().indexOf(lastChip) === -1) {
244-
const lastElem = area.chipsList.last?.nativeElement;
245-
const targetElem = event.detail.originalEvent.target;
246-
const targetOwner = event.detail.owner.element.nativeElement.parentElement;
247-
if (targetOwner !== lastElem && targetElem.getBoundingClientRect().x >= lastElem.getBoundingClientRect().x) {
248-
area.chipsList.last.nativeElement.nextElementSibling.style.visibility = '';
249-
}
250-
}
251-
}
252234
public onAreaDragLeave(event, area) {
253235
const dataChips = area.chipsList.toArray().filter(x => this.notificationChips.toArray().indexOf(x) === -1);
254236
dataChips.forEach(element => {

0 commit comments

Comments
 (0)