• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IgniteUI / igniteui-angular / 26023601418

18 May 2026 08:57AM UTC coverage: 4.854% (-85.3%) from 90.174%
26023601418

Pull #17281

github

web-flow
Merge e7ce7a18e into 5a85df190
Pull Request #17281: feat: Added virtual scroll component and sample implementation

400 of 17347 branches covered (2.31%)

Branch coverage included in aggregate %.

63 of 222 new or added lines in 4 files covered. (28.38%)

27932 existing lines in 341 files now uncovered.

2022 of 32547 relevant lines covered (6.21%)

0.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.32
/projects/igniteui-angular/grids/pivot-grid/src/pivot-header-row.component.ts
1
import {
2
    ChangeDetectionStrategy,
3
    Component,
4
    OnChanges,
5
    QueryList,
6
    Renderer2,
7
    ViewChild,
8
    SimpleChanges,
9
    ViewChildren,
10
    HostBinding,
11
    inject
12
} from '@angular/core';
13
import { NgTemplateOutlet, NgClass, NgStyle } from '@angular/common';
14

15
import { AbsoluteScrollStrategy, AutoPositionStrategy, ColumnType, OverlaySettings, PositionSettings, SortingDirection, VerticalAlignment } from 'igniteui-angular/core';
16
import {
17
    DropPosition,
18
    IGX_GRID_BASE,
19
    IgxExcelStyleColumnOperationsTemplateDirective,
20
    IgxExcelStyleFilterOperationsTemplateDirective,
21
    IgxExcelStyleSearchComponent,
22
    IgxGridExcelStyleFilteringComponent,
23
    IgxGridHeaderGroupComponent,
24
    IgxGridHeaderRowComponent,
25
    IgxGridTopLevelColumns,
26
    IgxHeaderGroupStylePipe,
27
    IPivotAggregator,
28
    IPivotDimension,
29
    IPivotValue,
30
    PivotDimensionType,
31
    PivotGridType,
32
    PivotUtil
33
} from 'igniteui-angular/grids/core';
34
import { IgxPivotRowHeaderGroupComponent } from './pivot-row-header-group.component';
35
import { IgxDropDirective, IgxGridForOfDirective } from 'igniteui-angular/directives';
36
import { IBaseChipEventArgs, IgxChipComponent, IgxChipsAreaComponent } from 'igniteui-angular/chips';
37
import { IgxIconComponent } from 'igniteui-angular/icon';
38
import { IgxPrefixDirective, IgxSuffixDirective } from 'igniteui-angular/input-group';
39
import { IgxBadgeComponent } from 'igniteui-angular/badge';
40
import { IgxDropDownComponent, IgxDropDownItemComponent, IgxDropDownItemNavigationDirective, ISelectionEventArgs } from 'igniteui-angular/drop-down';
41

42
/**
43
 *
44
 * For all intents & purposes treat this component as what a <thead> usually is in the default <table> element.
45
 *
46
 * This container holds the pivot grid header elements and their behavior/interactions.
47
 *
48
 * @hidden @internal
49
 */
50
@Component({
51
    changeDetection: ChangeDetectionStrategy.OnPush,
52
    selector: 'igx-pivot-header-row',
53
    templateUrl: './pivot-header-row.component.html',
54
    imports: [IgxDropDirective, IgxChipsAreaComponent, IgxChipComponent, IgxIconComponent,
55
        IgxPrefixDirective, IgxBadgeComponent, IgxSuffixDirective, IgxDropDownItemNavigationDirective,
56
        NgTemplateOutlet, IgxGridHeaderGroupComponent, NgClass, NgStyle, IgxGridForOfDirective,
57
        IgxDropDownComponent, IgxDropDownItemComponent, IgxGridExcelStyleFilteringComponent,
58
        IgxExcelStyleColumnOperationsTemplateDirective, IgxExcelStyleFilterOperationsTemplateDirective,
59
        IgxExcelStyleSearchComponent, IgxHeaderGroupStylePipe, IgxGridTopLevelColumns,
60
        IgxPivotRowHeaderGroupComponent]
61
})
62
export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent implements OnChanges {
3✔
UNCOV
63
    public override grid = inject<PivotGridType>(IGX_GRID_BASE);
×
UNCOV
64
    protected renderer = inject(Renderer2);
×
65

UNCOV
66
    public aggregateList: IPivotAggregator[] = [];
×
67

68
    public value: IPivotValue;
UNCOV
69
    public filterDropdownDimensions: Set<any> = new Set<any>();
×
UNCOV
70
    public filterAreaDimensions: Set<any> = new Set<any>();
×
UNCOV
71
    private _dropPos = DropPosition.AfterDropTarget;
×
UNCOV
72
    private _subMenuPositionSettings: PositionSettings = {
×
73
        verticalStartPoint: VerticalAlignment.Bottom,
74
        closeAnimation: undefined
75
    };
UNCOV
76
    private _subMenuOverlaySettings: OverlaySettings = {
×
77
        closeOnOutsideClick: true,
78
        modal: false,
79
        positionStrategy: new AutoPositionStrategy(this._subMenuPositionSettings),
80
        scrollStrategy: new AbsoluteScrollStrategy()
81
    };
82

83
    /**
84
     * @hidden @internal
85
     */
86
    @ViewChild('esf') public esf: any;
87

88
    /**
89
     * @hidden @internal
90
     */
91
    @ViewChild('filterAreaHidden', { static: false }) public filterArea;
92

93
    /**
94
     * @hidden @internal
95
     */
96
    @ViewChild('filterIcon') public filtersButton;
97

98
    /**
99
     * @hidden @internal
100
     */
101
    @ViewChild('dropdownChips') public dropdownChips;
102

103
    /**
104
     * @hidden @internal
105
     */
106
    @ViewChild('pivotFilterContainer') public pivotFilterContainer;
107

108
    /**
109
     * @hidden @internal
110
     */
111
    @ViewChild('pivotRowContainer') public pivotRowContainer;
112

113
    /**
114
    * @hidden
115
    * @internal
116
    */
117
    @ViewChildren('notifyChip')
118
    public notificationChips: QueryList<IgxChipComponent>;
119

120
    /**
121
    * @hidden
122
    * @internal
123
    * The virtualized part of the header row containing the unpinned header groups.
124
    */
125
    @ViewChildren('headerVirtualContainer', { read: IgxGridForOfDirective })
126
    public headerContainers: QueryList<IgxGridForOfDirective<ColumnType, ColumnType[]>>;
127

128
    /**
129
    * @hidden
130
    * @internal
131
    */
132
    @ViewChildren('rowDimensionHeaders')
133
    public rowDimensionHeaders: QueryList<IgxPivotRowHeaderGroupComponent>;
134

135
    public override get headerForOf() {
UNCOV
136
        return this.headerContainers?.last;
×
137
    }
138

139
    @HostBinding('attr.aria-activedescendant')
140
    public override get activeDescendant(): string {
UNCOV
141
        const activeElem = this.navigation.activeNode;
×
UNCOV
142
        if (!activeElem || !Object.keys(activeElem).length || this.grid.navigation.headerRowActiveDescendant) {
×
UNCOV
143
            return null;
×
144
        }
145

UNCOV
146
        if (this.navigation.isRowDimensionHeaderActive) {
×
UNCOV
147
            const activeHeader = this.grid.theadRow.rowDimensionHeaders.find(h => h.active);
×
UNCOV
148
            if (activeHeader) {
×
UNCOV
149
                const key = activeHeader.title ?? activeHeader.rootDimension?.memberName;
×
UNCOV
150
                return key ? `${this.grid.id}_${key}` : null;
×
151
            }
152
            return null;
×
153
        }
154

UNCOV
155
        return super.activeDescendant;
×
156
    }
157

158
    /**
159
    * @hidden
160
    * @internal
161
    * Default is a single empty level since default depth is 1
162
    */
UNCOV
163
    public columnDimensionsByLevel: any[] = [[]];
×
164

165
    /**
166
    * @hidden @internal
167
    */
168
    public get isFiltersButton(): boolean {
UNCOV
169
        let chipsWidth = 0;
×
UNCOV
170
        this.filterDropdownDimensions.clear();
×
UNCOV
171
        this.filterAreaDimensions.clear();
×
UNCOV
172
        if (this.filterArea?.chipsList && this.filterArea.chipsList.length !== 0) {
×
UNCOV
173
            const styles = getComputedStyle(this.pivotFilterContainer.nativeElement);
×
UNCOV
174
            const containerPaddings = parseFloat(styles.paddingLeft) + parseFloat(styles.paddingRight);
×
UNCOV
175
            chipsWidth += containerPaddings + (this.filtersButton && this.filterArea?.chipsList.length > 1 ? this.filtersButton.el.nativeElement.getBoundingClientRect().width : 0);
×
UNCOV
176
            this.filterArea.chipsList.forEach(chip => {
×
UNCOV
177
                const dim = this.grid.filterDimensions.find(x => x.memberName === chip.id);
×
UNCOV
178
                if (dim) {
×
179
                    // 8 px margin between chips
UNCOV
180
                    const currentChipWidth = chip.nativeElement.getBoundingClientRect().width + 8;
×
UNCOV
181
                    if (chipsWidth + currentChipWidth < this.grid.pivotRowWidths) {
×
UNCOV
182
                        this.filterAreaDimensions.add(dim);
×
183
                    } else {
UNCOV
184
                        this.filterDropdownDimensions.add(dim);
×
185
                    }
UNCOV
186
                    chipsWidth += currentChipWidth;
×
187
                }
188
            });
UNCOV
189
            return this.filterDropdownDimensions.size > 0;
×
190
        }
UNCOV
191
        return false;
×
192
    }
193

194
    /**
195
    * @hidden
196
    * @internal
197
    */
198
    public get totalDepth() {
UNCOV
199
        const columnDimensions = this.grid.columnDimensions;
×
UNCOV
200
        if (columnDimensions.length === 0) {
×
UNCOV
201
            return 1;
×
202
        }
UNCOV
203
        let totalDepth = columnDimensions.map(x => this.grid.data?.length > 0 ? PivotUtil.getDimensionDepth(x) + 1 : 0).reduce((acc, val) => acc + val);
×
UNCOV
204
        if (this.grid.hasMultipleValues) {
×
UNCOV
205
            totalDepth += 1;
×
206
        }
UNCOV
207
        return totalDepth;
×
208
    }
209

210
    /**
211
    * @hidden
212
    * @internal
213
    */
214
    public get maxContainerHeight() {
UNCOV
215
        return this.totalDepth * this.grid.renderedRowHeight;
×
216
    }
217

218
    /**
219
    * @hidden
220
    * @internal
221
    */
222
    public override get isLeafHeaderAriaHidden(): boolean {
UNCOV
223
        return super.isLeafHeaderAriaHidden || this.grid.navigation.isRowHeaderActive || this.grid.navigation.isRowDimensionHeaderActive;
×
224
    }
225

226
    /**
227
    * @hidden
228
    * @internal
229
    */
230
    public calcHeight(col: ColumnType, index: number) {
UNCOV
231
        return !col.columnGroup && col.level < this.totalDepth && col.level === index ? (this.totalDepth - col.level) * this.grid.rowHeight : this.grid.rowHeight;
×
232
    }
233

234
    /**
235
    * @hidden
236
    * @internal
237
    */
238
    public isDuplicateOfExistingParent(col: ColumnType, lvl: number) {
UNCOV
239
        const parentCollection = lvl > 0 ? this.columnDimensionsByLevel[lvl - 1] : [];
×
UNCOV
240
        const duplicate = parentCollection.indexOf(col) !== -1;
×
241

UNCOV
242
        return duplicate;
×
243
    }
244

245
    /**
246
    * @hidden
247
    * @internal
248
    */
249
    public isMultiRow(col: ColumnType, lvl: number) {
UNCOV
250
        const isLeaf = !col.columnGroup;
×
UNCOV
251
        return isLeaf && lvl !== this.totalDepth - 1;
×
252
    }
253

254
    /**
255
    * @hidden
256
    * @internal
257
    */
258
    public populateColumnDimensionsByLevel() {
UNCOV
259
        const res = [];
×
UNCOV
260
        for (let i = 0; i < this.totalDepth; i++) {
×
UNCOV
261
            res[i] = [];
×
262
        }
UNCOV
263
        const cols = this.unpinnedColumnCollection;
×
264
        // populate column dimension matrix recursively
UNCOV
265
        this.populateDimensionRecursively(cols.filter(x => x.level === 0), 0, res);
×
UNCOV
266
        this.columnDimensionsByLevel = res;
×
267
    }
268

269
    protected populateDimensionRecursively(currentLevelColumns: ColumnType[], level = 0, res: any[]) {
×
UNCOV
270
        currentLevelColumns.forEach(col => {
×
UNCOV
271
            if (res[level]) {
×
UNCOV
272
                res[level].push(col);
×
UNCOV
273
                if (col.columnGroup && col.children.length > 0) {
×
UNCOV
274
                    const visibleColumns = col.children.toArray().filter(x => !x.hidden);
×
UNCOV
275
                    this.populateDimensionRecursively(visibleColumns, level + 1, res);
×
UNCOV
276
                } else if (level < this.totalDepth - 1) {
×
UNCOV
277
                    for (let i = level + 1; i <= this.totalDepth - 1; i++) {
×
UNCOV
278
                        res[i].push(col);
×
279
                    }
280
                }
281
            }
282
        });
283
    }
284

285
    /**
286
    * @hidden
287
    * @internal
288
    */
289
    public ngOnChanges(changes: SimpleChanges) {
UNCOV
290
        if (changes.unpinnedColumnCollection) {
×
UNCOV
291
            this.populateColumnDimensionsByLevel();
×
292
        }
293
    }
294

295
    /**
296
    * @hidden
297
    * @internal
298
    */
299
    public onDimDragStart(event, area) {
UNCOV
300
        this.cdr.detectChanges();
×
UNCOV
301
        for (const chip of this.notificationChips) {
×
UNCOV
302
            const parent = chip.nativeElement.parentElement;
×
UNCOV
303
            if (area.chipsList.toArray().indexOf(chip) === -1 &&
×
304
                parent.children.length > 0 &&
305
                parent.children.item(0).id !== 'empty') {
UNCOV
306
                chip.nativeElement.hidden = false;
×
UNCOV
307
                parent.parentElement.scrollTo({ left: chip.nativeElement.offsetLeft });
×
308
            }
309
        }
310
    }
311

312
    /**
313
    * @hidden
314
    * @internal
315
    */
316
    public onDimDragEnd() {
UNCOV
317
        for (const chip of this.notificationChips) {
×
UNCOV
318
            chip.nativeElement.hidden = true;
×
319
        }
320
    }
321

322
    /**
323
    * @hidden
324
    * @internal
325
    */
326
    public getAreaHeight(area: IgxChipsAreaComponent) {
UNCOV
327
        const chips = area.chipsList;
×
UNCOV
328
        return chips && chips.length > 0 ? chips.first.nativeElement.offsetHeight : 0;
×
329
    }
330

331
    /**
332
    * @hidden
333
    * @internal
334
    */
335
    public rowRemoved(event: IBaseChipEventArgs) {
UNCOV
336
        const row = this.grid.pivotConfiguration.rows.find(x => x.memberName === event.owner.id);
×
UNCOV
337
        this.grid.toggleDimension(row);
×
338
    }
339

340
    /**
341
    * @hidden
342
    * @internal
343
    */
344
    public columnRemoved(event: IBaseChipEventArgs) {
UNCOV
345
        const col = this.grid.pivotConfiguration.columns.find(x => x.memberName === event.owner.id);
×
UNCOV
346
        this.grid.toggleDimension(col);
×
347
    }
348

349
    /**
350
    * @hidden
351
    * @internal
352
    */
353
    public valueRemoved(event: IBaseChipEventArgs) {
UNCOV
354
        const value = this.grid.pivotConfiguration.values.find(x => x.member === event.owner.id || x.displayName === event.owner.id);
×
UNCOV
355
        this.grid.toggleValue(value);
×
356
    }
357

358
    /**
359
    * @hidden
360
    * @internal
361
    */
362
    public filterRemoved(event: IBaseChipEventArgs) {
UNCOV
363
        const filter = this.grid.pivotConfiguration.filters.find(x => x.memberName === event.owner.id);
×
UNCOV
364
        this.grid.toggleDimension(filter);
×
UNCOV
365
        if (this.filterDropdownDimensions.size > 0) {
×
UNCOV
366
            this.onFiltersAreaDropdownClick({ target: this.filtersButton.el.nativeElement }, undefined, false);
×
367
        } else {
UNCOV
368
            this.grid.filteringService.hideESF();
×
369
        }
370
    }
371

372
    public onFiltersSelectionChanged(event?: IBaseChipEventArgs) {
UNCOV
373
        this.dropdownChips.chipsList.forEach(chip => {
×
UNCOV
374
            if (chip.id !== event.owner.id) {
×
UNCOV
375
                chip.selected = false
×
376
            }
377
        });
UNCOV
378
        this.onFiltersAreaDropdownClick({ target: this.filtersButton.el.nativeElement }, this.grid.filterDimensions.find(dim => dim.memberName === event.owner.id), false);
×
379
    }
380

381
    /**
382
    * @hidden
383
    * @internal
384
    */
385
    public onFilteringIconPointerDown(event) {
UNCOV
386
        event.stopPropagation();
×
UNCOV
387
        event.preventDefault();
×
388
    }
389

390
    /**
391
    * @hidden
392
    * @internal
393
    */
394
    public onFilteringIconClick(event, dimension) {
UNCOV
395
        event.stopPropagation();
×
UNCOV
396
        event.preventDefault();
×
UNCOV
397
        const dim = dimension;
×
UNCOV
398
        const col = this.grid.dimensionDataColumns.find(x => x.field === dim.memberName || x.field === dim.member);
×
UNCOV
399
        this.grid.filteringService.toggleFilterDropdown(event.target, col);
×
400
    }
401

402
    /**
403
    * @hidden
404
    * @internal
405
    */
406
    public onSummaryClick(eventArgs, value: IPivotValue, dropdown: IgxDropDownComponent, chip: IgxChipComponent) {
UNCOV
407
        this._subMenuOverlaySettings.target = eventArgs.currentTarget;
×
UNCOV
408
        this.updateDropDown(value, dropdown, chip);
×
409
    }
410

411
    /**
412
     * @hidden @internal
413
     */
414
    public onFiltersAreaDropdownClick(event, dimension?, shouldReattach = true) {
×
UNCOV
415
        const dim = dimension || this.filterDropdownDimensions.values().next().value;
×
UNCOV
416
        const col = this.grid.dimensionDataColumns.find(x => x.field === dim.memberName || x.field === dim.member);
×
UNCOV
417
        if (shouldReattach) {
×
UNCOV
418
            this.dropdownChips.chipsList.forEach(chip => {
×
UNCOV
419
                chip.selected = false
×
420
            });
UNCOV
421
            this.dropdownChips.chipsList.first.selected = true;
×
422
        }
UNCOV
423
        this.grid.filteringService.toggleFiltersESF(this.esf, event.target, col, shouldReattach);
×
424
    }
425

426
    /**
427
    * @hidden
428
    * @internal
429
    */
430
    public onAggregationChange(event: ISelectionEventArgs) {
431

UNCOV
432
        if (!this.isSelected(event.newSelection.value)) {
×
UNCOV
433
            this.value.aggregate = event.newSelection.value;
×
UNCOV
434
            const isSingleValue = this.grid.values.length === 1;
×
435

UNCOV
436
            PivotUtil.updateColumnTypeByAggregator(this.grid.columns, this.value, isSingleValue);
×
437

UNCOV
438
            this.grid.pipeTrigger++;
×
439
        }
440
    }
441

442
    /**
443
    * @hidden
444
    * @internal
445
    */
446
    public isSelected(val: IPivotAggregator) {
UNCOV
447
        return this.value.aggregate.key === val.key;
×
448
    }
449

450
    /**
451
    * @hidden
452
    * @internal
453
    */
454
    public onChipSort(_event, dimension: IPivotDimension) {
UNCOV
455
        if (dimension.sortable === undefined || dimension.sortable) {
×
UNCOV
456
            const startDirection = dimension.sortDirection || SortingDirection.None;
×
UNCOV
457
            const direction = startDirection + 1 > SortingDirection.Desc ?
×
458
                SortingDirection.None : startDirection + 1;
UNCOV
459
            this.grid.sortDimension(dimension, direction);
×
460
        }
461
    }
462

463
    /**
464
    * @hidden
465
    * @internal
466
    */
467
    public onDimDragOver(event, dimension?: PivotDimensionType) {
UNCOV
468
        if (!event.dragChip || !event.dragChip.data?.pivotArea) return;
×
UNCOV
469
        const typeMismatch = dimension !== undefined ? this.grid.pivotConfiguration.values.find(x => x.member === event.dragChip.id
×
470
            || x.displayName === event.dragChip.id) :
UNCOV
471
            !this.grid.pivotConfiguration.values.find(x => x.member === event.dragChip.id || x.displayName === event.dragChip.id);
×
UNCOV
472
        if (typeMismatch) {
×
473
            // cannot drag between dimensions and value
UNCOV
474
            return;
×
475
        }
476
        // if we are in the left half of the chip, drop on the left
477
        // else drop on the right of the chip
UNCOV
478
        const clientRect = event.owner.nativeElement.getBoundingClientRect();
×
UNCOV
479
        const pos = clientRect.width / 2;
×
480

UNCOV
481
        this._dropPos = event.originalEvent.offsetX > pos ? DropPosition.AfterDropTarget : DropPosition.BeforeDropTarget;
×
UNCOV
482
        if (this._dropPos === DropPosition.AfterDropTarget) {
×
UNCOV
483
            event.owner.nativeElement.previousElementSibling.style.visibility = 'hidden';
×
UNCOV
484
            event.owner.nativeElement.nextElementSibling.style.visibility = '';
×
485
        } else {
UNCOV
486
            event.owner.nativeElement.nextElementSibling.style.visibility = 'hidden';
×
UNCOV
487
            event.owner.nativeElement.previousElementSibling.style.visibility = '';
×
488
        }
489
    }
490

491
    /**
492
    * @hidden
493
    * @internal
494
    */
495
    public onDimDragLeave(event) {
UNCOV
496
        event.owner.nativeElement.previousElementSibling.style.visibility = 'hidden';
×
UNCOV
497
        event.owner.nativeElement.nextElementSibling.style.visibility = 'hidden';
×
UNCOV
498
        this._dropPos = DropPosition.AfterDropTarget;
×
499
    }
500

501
    /**
502
    * @hidden
503
    * @internal
504
    */
505
    public onAreaDragLeave(event, area) {
UNCOV
506
        const dataChips = area.chipsList.toArray().filter(x => this.notificationChips.toArray().indexOf(x) === -1);
×
UNCOV
507
        dataChips.forEach(element => {
×
UNCOV
508
            if (element.nativeElement.previousElementSibling) {
×
UNCOV
509
                element.nativeElement.previousElementSibling.style.visibility = 'hidden';
×
510
            }
UNCOV
511
            if (element.nativeElement.nextElementSibling) {
×
UNCOV
512
                element.nativeElement.nextElementSibling.style.visibility = 'hidden';
×
513
            }
514
        });
515
    }
516

517
    /**
518
    * @hidden
519
    * @internal
520
    */
521
    public onValueDrop(event, area) {
UNCOV
522
        if (!(event.dragChip && event.dragChip.data?.pivotArea) && !(event.dragData?.chip && !!event.dragData.chip.data.pivotArea)) return;
×
523
        //values can only be reordered
UNCOV
524
        const values = this.grid.pivotConfiguration.values;
×
UNCOV
525
        const dragId = event.dragChip?.id || event.dragData?.chip.id;
×
UNCOV
526
        const chipsArray = area.chipsList.toArray();
×
UNCOV
527
        let chipIndex = chipsArray.indexOf(event.owner) !== -1 ? chipsArray.indexOf(event.owner) : chipsArray.length;
×
UNCOV
528
        chipIndex = this._dropPos === DropPosition.AfterDropTarget ? chipIndex + 1 : chipIndex;
×
UNCOV
529
        const value = values.find(x => x.member === dragId || x.displayName === dragId);
×
UNCOV
530
        if (value) {
×
UNCOV
531
            const dragChipIndex = chipsArray.indexOf(event.dragChip || event.dragData.chip);
×
UNCOV
532
            this.grid.moveValue(value, dragChipIndex >= chipIndex ? chipIndex : chipIndex - 1);
×
533
        }
534
    }
535

536
    /**
537
    * @hidden
538
    * @internal
539
    */
540
    public onDimDrop(event, area, dimensionType: PivotDimensionType) {
UNCOV
541
        if (!(event.dragChip && event.dragChip.data?.pivotArea) && !(event.dragData?.chip && !!event.dragData.chip.data.pivotArea)) return;
×
UNCOV
542
        const dragId = event.dragChip?.id || event.dragData?.chip.id;
×
UNCOV
543
        const currentDim = this.grid.getDimensionsByType(dimensionType);
×
UNCOV
544
        const chipsArray = area.chipsList.toArray();
×
UNCOV
545
        const chip = chipsArray.find(x => x.id === dragId);
×
UNCOV
546
        const isNewChip = chip === undefined;
×
UNCOV
547
        const isReorder = event.owner.id !== undefined;
×
548
        //const chipIndex = chipsArray.indexOf(event.owner) !== -1 ? chipsArray.indexOf(event.owner) : chipsArray.length;
UNCOV
549
        const chipIndex = currentDim.findIndex(x => x.memberName === event.owner.id) !== -1 ?
×
UNCOV
550
            currentDim.findIndex(x => x.memberName === event.owner.id) : currentDim.length;
×
UNCOV
551
        const targetIndex = this._dropPos === DropPosition.AfterDropTarget ? chipIndex + 1 : chipIndex;
×
UNCOV
552
        if (isNewChip) {
×
553
            // chip moved from an external collection
UNCOV
554
            const dim = this.grid.allDimensions.find(x => x && x.memberName === dragId);
×
UNCOV
555
            if (!dim) {
×
556
                // you have dragged something that is not a dimension
557
                return;
×
558
            }
UNCOV
559
            this.grid.moveDimension(dim, dimensionType, targetIndex);
×
UNCOV
560
        } else if (isReorder) {
×
561
            // chip from same collection, reordered.
UNCOV
562
            const newDim = currentDim.find(x => x.memberName === dragId);
×
UNCOV
563
            const dragChipIndex = currentDim.findIndex(x => x.memberName === dragId);
×
UNCOV
564
            this.grid.moveDimension(newDim, dimensionType, dragChipIndex > chipIndex ? targetIndex : targetIndex - 1);
×
565
        }
UNCOV
566
        this.grid.pipeTrigger++;
×
UNCOV
567
        this.grid.dimensionsChange.emit({ dimensions: currentDim, dimensionCollectionType: dimensionType });
×
568
        // clean states
UNCOV
569
        this.onDimDragEnd();
×
UNCOV
570
        this.onAreaDragLeave(event, area);
×
571
    }
572

573
    protected updateDropDown(value: IPivotValue, dropdown: IgxDropDownComponent, chip: IgxChipComponent) {
UNCOV
574
        this.value = value;
×
UNCOV
575
        dropdown.width = chip.nativeElement.clientWidth + 'px';
×
UNCOV
576
        this.aggregateList = PivotUtil.getAggregateList(value, this.grid);
×
UNCOV
577
        this.cdr.detectChanges();
×
UNCOV
578
        dropdown.open(this._subMenuOverlaySettings);
×
579
    }
580

581
    protected getRowDimensionColumn(dim: IPivotDimension): ColumnType {
UNCOV
582
        return this.grid.dimensionDataColumns ? this.grid.dimensionDataColumns.find((col) => col.field === dim.memberName) : null;
×
583
    }
584
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc