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

IgniteUI / igniteui-angular / 13493471953

24 Feb 2025 08:10AM CUT coverage: 91.623% (+0.004%) from 91.619%
13493471953

Pull #15376

github

web-flow
Merge b93db8e36 into 66906e39c
Pull Request #15376: feat(pivotGrid): Improve PivotGrid visually when there's no data or has empty area at the bottom.

12991 of 15223 branches covered (85.34%)

3 of 3 new or added lines in 1 file covered. (100.0%)

1 existing line in 1 file now uncovered.

26393 of 28806 relevant lines covered (91.62%)

34278.79 hits per line

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

99.42
/projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-header-row.component.ts
1
import {
2
    ChangeDetectionStrategy,
3
    ChangeDetectorRef,
4
    Component,
5
    ElementRef,
6
    Inject,
7
    OnChanges,
8
    QueryList,
9
    Renderer2,
10
    ViewChild,
11
    SimpleChanges,
12
    ViewChildren
13
} from '@angular/core';
14
import { IBaseChipEventArgs, IgxChipComponent } from '../../chips/chip.component';
15
import { IgxChipsAreaComponent } from '../../chips/chips-area.component';
16
import { SortingDirection } from '../../data-operations/sorting-strategy';
17
import { IgxGridForOfDirective } from '../../directives/for-of/for_of.directive';
18
import { ISelectionEventArgs } from '../../drop-down/drop-down.common';
19
import { IgxDropDownComponent } from '../../drop-down/drop-down.component';
20
import { AbsoluteScrollStrategy, AutoPositionStrategy, OverlaySettings, PositionSettings, VerticalAlignment } from '../../services/public_api';
21
import { ColumnType, IGX_GRID_BASE, PivotGridType } from '../common/grid.interface';
22
import { IgxGridHeaderGroupComponent } from '../headers/grid-header-group.component';
23
import { IgxGridHeaderRowComponent } from '../headers/grid-header-row.component';
24
import { DropPosition } from '../moving/moving.service';
25
import { IPivotAggregator, IPivotDimension, IPivotValue, PivotDimensionType } from './pivot-grid.interface';
26
import { PivotUtil } from './pivot-util';
27
import { IgxGridTopLevelColumns } from '../common/pipes';
28
import { IgxHeaderGroupWidthPipe, IgxHeaderGroupStylePipe } from '../headers/pipes';
29
import { IgxExcelStyleSearchComponent } from '../filtering/excel-style/excel-style-search.component';
30
import { IgxGridExcelStyleFilteringComponent, IgxExcelStyleColumnOperationsTemplateDirective, IgxExcelStyleFilterOperationsTemplateDirective } from '../filtering/excel-style/excel-style-filtering.component';
31
import { IgxDropDownItemComponent } from '../../drop-down/drop-down-item.component';
32
import { IgxDropDownItemNavigationDirective } from '../../drop-down/drop-down-navigation.directive';
33
import { IgxSuffixDirective } from '../../directives/suffix/suffix.directive';
34
import { IgxBadgeComponent } from '../../badge/badge.component';
35
import { IgxPrefixDirective } from '../../directives/prefix/prefix.directive';
36
import { IgxIconComponent } from '../../icon/icon.component';
37
import { IgxDropDirective } from '../../directives/drag-drop/drag-drop.directive';
38
import { NgIf, NgFor, NgTemplateOutlet, NgClass, NgStyle } from '@angular/common';
39
import { IgxPivotRowHeaderGroupComponent } from './pivot-row-header-group.component';
40
import { IgxPivotRowDimensionHeaderGroupComponent } from './pivot-row-dimension-header-group.component';
41
import { IgxColumnComponent } from '../columns/column.component';
42

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

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

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

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

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

96
    /**
97
     * @hidden @internal
98
     */
99
    @ViewChild('dropdownChips') public dropdownChips;
100

101
    /**
102
     * @hidden @internal
103
     */
104
    @ViewChild('pivotFilterContainer') public pivotFilterContainer;
105

106
    /**
107
     * @hidden @internal
108
     */
109
    @ViewChild('pivotRowContainer') public pivotRowContainer;
110

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

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

126
    /**
127
    * @hidden
128
    * @internal
129
    */
130
    @ViewChildren('rowDimensionHeaders')
131
    public rowDimensionHeaders: QueryList<IgxPivotRowDimensionHeaderGroupComponent>;
132

133
    public override get headerForOf() {
134
        return this.headerContainers?.last;
420✔
135
    }
136

137
    constructor(
138
        @Inject(IGX_GRID_BASE) public override grid: PivotGridType,
129✔
139
        ref: ElementRef<HTMLElement>,
140
        cdr: ChangeDetectorRef,
141
        protected renderer: Renderer2,
129✔
142
    ) {
143
        super(ref, cdr);
129✔
144
    }
145

146
    /**
147
    * @hidden
148
    * @internal
149
    * Default is a single empty level since default depth is 1
150
    */
151
    public columnDimensionsByLevel: any[] = [[]];
129✔
152

153
    /**
154
    * @hidden @internal
155
    */
156
    public get isFiltersButton(): boolean {
157
        let chipsWidth = 0;
2,138✔
158
        this.filterDropdownDimensions.clear();
2,138✔
159
        this.filterAreaDimensions.clear();
2,138✔
160
        if (this.filterArea?.chipsList && this.filterArea.chipsList.length !== 0) {
2,138✔
161
            const styles = getComputedStyle(this.pivotFilterContainer.nativeElement);
121✔
162
            const containerPaddings = parseFloat(styles.paddingLeft) + parseFloat(styles.paddingRight);
121✔
163
            chipsWidth += containerPaddings + (this.filtersButton && this.filterArea?.chipsList.length > 1 ? this.filtersButton.el.nativeElement.getBoundingClientRect().width : 0);
121✔
164
            this.filterArea.chipsList.forEach(chip => {
121✔
165
                const dim = this.grid.filterDimensions.find(x => x.memberName === chip.id);
241✔
166
                if (dim) {
179✔
167
                    // 8 px margin between chips
168
                    const currentChipWidth = chip.nativeElement.getBoundingClientRect().width + 8;
173✔
169
                    if (chipsWidth + currentChipWidth < this.grid.pivotRowWidths) {
173✔
170
                        this.filterAreaDimensions.add(dim);
75✔
171
                    } else {
172
                        this.filterDropdownDimensions.add(dim);
98✔
173
                    }
174
                    chipsWidth += currentChipWidth;
173✔
175
                }
176
            });
177
            return this.filterDropdownDimensions.size > 0;
121✔
178
        }
179
        return false;
2,017✔
180
    }
181

182
    /**
183
    * @hidden
184
    * @internal
185
    */
186
    public get totalDepth() {
187
        const columnDimensions = this.grid.columnDimensions;
59,068✔
188
        if (columnDimensions.length === 0) {
59,068✔
189
            return 1;
914✔
190
        }
191
        let totalDepth = columnDimensions.map(x => this.grid.data.length > 0 ? PivotUtil.getDimensionDepth(x) + 1 : 0).reduce((acc, val) => acc + val);
61,392✔
192
        if (this.grid.hasMultipleValues) {
58,154✔
193
            totalDepth += 1;
54,200✔
194
        }
195
        return totalDepth;
58,154✔
196
    }
197

198
    /**
199
    * @hidden
200
    * @internal
201
    */
202
    public get maxContainerHeight() {
203
        return this.totalDepth * this.grid.renderedRowHeight;
2,138✔
204
    }
205

206
    /**
207
    * @hidden
208
    * @internal
209
    * Use tracking function to fix ngFor not clearing old records from the DOM while updating it, causing incorrect header height during _calculateGridBodyHeight.
210
    */
211
    public trackColumnDimensionByLevel(_, item: IgxColumnComponent[]) {
212
        return item.map(col => col.field).join('-');
23,337✔
213
    }
214

215
    /**
216
    * @hidden
217
    * @internal
218
    */
219
    public calcHeight(col: ColumnType, index: number) {
220
        return !col.columnGroup && col.level < this.totalDepth && col.level === index ? (this.totalDepth - col.level) * this.grid.rowHeight : this.grid.rowHeight;
13,672✔
221
    }
222

223
    /**
224
    * @hidden
225
    * @internal
226
    */
227
    public isDuplicateOfExistingParent(col: ColumnType, lvl: number) {
228
        const parentCollection = lvl > 0 ? this.columnDimensionsByLevel[lvl - 1] : [];
14,934✔
229
        const duplicate = parentCollection.indexOf(col) !== -1;
14,934✔
230

231
        return duplicate;
14,934✔
232
    }
233

234
    /**
235
    * @hidden
236
    * @internal
237
    */
238
    public isMultiRow(col: ColumnType, lvl: number) {
239
        const isLeaf = !col.columnGroup;
14,934✔
240
        return isLeaf && lvl !== this.totalDepth - 1;
14,934✔
241
    }
242

243
    /**
244
    * @hidden
245
    * @internal
246
    */
247
    public populateColumnDimensionsByLevel() {
248
        const res = [];
1,144✔
249
        for (let i = 0; i < this.totalDepth; i++) {
1,144✔
250
            res[i] = [];
2,088✔
251
        }
252
        const cols = this.unpinnedColumnCollection;
1,144✔
253
        // populate column dimension matrix recursively
254
        this.populateDimensionRecursively(cols.filter(x => x.level === 0), 0, res);
11,856✔
255
        this.columnDimensionsByLevel = res;
1,144✔
256
    }
257

258
    protected populateDimensionRecursively(currentLevelColumns: ColumnType[], level = 0, res: any[]) {
×
259
        currentLevelColumns.forEach(col => {
4,981✔
260
            if (res[level]) {
11,844✔
261
                res[level].push(col);
11,799✔
262
                if (col.columnGroup && col.children.length > 0) {
11,799✔
263
                    const visibleColumns = col.children.toArray().filter(x => !x.hidden);
7,668✔
264
                    this.populateDimensionRecursively(visibleColumns, level + 1, res);
3,837✔
265
                } else if (level < this.totalDepth - 1) {
7,962✔
266
                    for (let i = level + 1; i <= this.totalDepth - 1; i++) {
137✔
267
                        res[i].push(col);
181✔
268
                    }
269
                }
270
            }
271
        });
272
    }
273

274
    /**
275
    * @hidden
276
    * @internal
277
    */
278
    public ngOnChanges(changes: SimpleChanges) {
279
        if (changes.unpinnedColumnCollection) {
2,141✔
280
            this.populateColumnDimensionsByLevel();
1,144✔
281
        }
282
    }
283

284
    /**
285
    * @hidden
286
    * @internal
287
    */
288
    public onDimDragStart(event, area) {
289
        this.cdr.detectChanges();
6✔
290
        for (const chip of this.notificationChips) {
6✔
291
            const parent = chip.nativeElement.parentElement;
18✔
292
            if (area.chipsList.toArray().indexOf(chip) === -1 &&
18✔
293
                parent.children.length > 0 &&
294
                parent.children.item(0).id !== 'empty') {
295
                chip.nativeElement.hidden = false;
7✔
296
                parent.parentElement.scrollTo({ left: chip.nativeElement.offsetLeft });
7✔
297
            }
298
        }
299
    }
300

301
    /**
302
    * @hidden
303
    * @internal
304
    */
305
    public onDimDragEnd() {
306
        for (const chip of this.notificationChips) {
5✔
307
            chip.nativeElement.hidden = true;
15✔
308
        }
309
    }
310

311
    /**
312
    * @hidden
313
    * @internal
314
    */
315
    public getAreaHeight(area: IgxChipsAreaComponent) {
316
        const chips = area.chipsList;
14,974✔
317
        return chips && chips.length > 0 ? chips.first.nativeElement.offsetHeight : 0;
14,974✔
318
    }
319

320
    /**
321
    * @hidden
322
    * @internal
323
    */
324
    public rowRemoved(event: IBaseChipEventArgs) {
325
        const row = this.grid.pivotConfiguration.rows.find(x => x.memberName === event.owner.id);
2✔
326
        this.grid.toggleDimension(row);
1✔
327
    }
328

329
    /**
330
    * @hidden
331
    * @internal
332
    */
333
    public columnRemoved(event: IBaseChipEventArgs) {
334
        const col = this.grid.pivotConfiguration.columns.find(x => x.memberName === event.owner.id);
2✔
335
        this.grid.toggleDimension(col);
1✔
336
    }
337

338
    /**
339
    * @hidden
340
    * @internal
341
    */
342
    public valueRemoved(event: IBaseChipEventArgs) {
343
        const value = this.grid.pivotConfiguration.values.find(x => x.member === event.owner.id || x.displayName === event.owner.id);
3✔
344
        this.grid.toggleValue(value);
2✔
345
    }
346

347
    /**
348
    * @hidden
349
    * @internal
350
    */
351
    public filterRemoved(event: IBaseChipEventArgs) {
352
        const filter = this.grid.pivotConfiguration.filters.find(x => x.memberName === event.owner.id);
3✔
353
        this.grid.toggleDimension(filter);
2✔
354
        if (this.filterDropdownDimensions.size > 0) {
2✔
355
            this.onFiltersAreaDropdownClick({ target: this.filtersButton.el.nativeElement }, undefined, false);
1✔
356
        } else {
357
            this.grid.filteringService.hideESF();
1✔
358
        }
359
    }
360

361
    public onFiltersSelectionChanged(event?: IBaseChipEventArgs) {
362
        this.dropdownChips.chipsList.forEach(chip => {
1✔
363
            if (chip.id !== event.owner.id) {
2✔
364
                chip.selected = false
1✔
365
            }
366
        });
367
        this.onFiltersAreaDropdownClick({ target: this.filtersButton.el.nativeElement }, this.grid.filterDimensions.find(dim => dim.memberName === event.owner.id), false);
2✔
368
    }
369

370
    /**
371
    * @hidden
372
    * @internal
373
    */
374
    public onFilteringIconPointerDown(event) {
375
        event.stopPropagation();
1✔
376
        event.preventDefault();
1✔
377
    }
378

379
    /**
380
    * @hidden
381
    * @internal
382
    */
383
    public onFilteringIconClick(event, dimension) {
384
        event.stopPropagation();
5✔
385
        event.preventDefault();
5✔
386
        const dim = dimension;
5✔
387
        const col = this.grid.dimensionDataColumns.find(x => x.field === dim.memberName || x.field === dim.member);
8✔
388
        this.grid.filteringService.toggleFilterDropdown(event.target, col);
5✔
389
    }
390

391
    /**
392
    * @hidden
393
    * @internal
394
    */
395
    public onSummaryClick(eventArgs, value: IPivotValue, dropdown: IgxDropDownComponent, chip: IgxChipComponent) {
396
        this._subMenuOverlaySettings.target = eventArgs.currentTarget;
4✔
397
        this.updateDropDown(value, dropdown, chip);
4✔
398
    }
399

400
    /**
401
     * @hidden @internal
402
     */
403
    public onFiltersAreaDropdownClick(event, dimension?, shouldReattach = true) {
3✔
404
        const dim = dimension || this.filterDropdownDimensions.values().next().value;
5✔
405
        const col = this.grid.dimensionDataColumns.find(x => x.field === dim.memberName || x.field === dim.member);
17✔
406
        if (shouldReattach) {
5✔
407
            this.dropdownChips.chipsList.forEach(chip => {
3✔
408
                chip.selected = false
6✔
409
            });
410
            this.dropdownChips.chipsList.first.selected = true;
3✔
411
        }
412
        this.grid.filteringService.toggleFiltersESF(this.esf, event.target, col, shouldReattach);
5✔
413
    }
414

415
    /**
416
    * @hidden
417
    * @internal
418
    */
419
    public onAggregationChange(event: ISelectionEventArgs) {
420
        if (!this.isSelected(event.newSelection.value)) {
2✔
421
            this.value.aggregate = event.newSelection.value;
2✔
422
            this.grid.pipeTrigger++;
2✔
423
        }
424
    }
425

426
    /**
427
    * @hidden
428
    * @internal
429
    */
430
    public isSelected(val: IPivotAggregator) {
431
        return this.value.aggregate.key === val.key;
46✔
432
    }
433

434
    /**
435
    * @hidden
436
    * @internal
437
    */
438
    public onChipSort(_event, dimension: IPivotDimension) {
439
        if (dimension.sortable === undefined || dimension.sortable) {
12!
440
            const startDirection = dimension.sortDirection || SortingDirection.None;
12✔
441
            const direction = startDirection + 1 > SortingDirection.Desc ?
12✔
442
                SortingDirection.None : startDirection + 1;
443
            this.grid.sortDimension(dimension, direction);
12✔
444
        }
445
    }
446

447
    /**
448
    * @hidden
449
    * @internal
450
    */
451
    public onDimDragOver(event, dimension?: PivotDimensionType) {
452
        if (!event.dragChip || !event.dragChip.data?.pivotArea) return;
7!
453
        const typeMismatch = dimension !== undefined ? this.grid.pivotConfiguration.values.find(x => x.member === event.dragChip.id
9✔
454
            || x.displayName === event.dragChip.id) :
455
            !this.grid.pivotConfiguration.values.find(x => x.member === event.dragChip.id || x.displayName === event.dragChip.id);
3✔
456
        if (typeMismatch) {
7✔
457
            // cannot drag between dimensions and value
458
            return;
1✔
459
        }
460
        // if we are in the left half of the chip, drop on the left
461
        // else drop on the right of the chip
462
        const clientRect = event.owner.nativeElement.getBoundingClientRect();
6✔
463
        const pos = clientRect.width / 2;
6✔
464

465
        this._dropPos = event.originalEvent.offsetX > pos ? DropPosition.AfterDropTarget : DropPosition.BeforeDropTarget;
6✔
466
        if (this._dropPos === DropPosition.AfterDropTarget) {
6✔
467
            event.owner.nativeElement.previousElementSibling.style.visibility = 'hidden';
3✔
468
            event.owner.nativeElement.nextElementSibling.style.visibility = '';
3✔
469
        } else {
470
            event.owner.nativeElement.nextElementSibling.style.visibility = 'hidden';
3✔
471
            event.owner.nativeElement.previousElementSibling.style.visibility = '';
3✔
472
        }
473
    }
474

475
    /**
476
    * @hidden
477
    * @internal
478
    */
479
    public onDimDragLeave(event) {
480
        event.owner.nativeElement.previousElementSibling.style.visibility = 'hidden';
1✔
481
        event.owner.nativeElement.nextElementSibling.style.visibility = 'hidden';
1✔
482
        this._dropPos = DropPosition.AfterDropTarget;
1✔
483
    }
484

485
    /**
486
    * @hidden
487
    * @internal
488
    */
489
    public onAreaDragLeave(event, area) {
490
        const dataChips = area.chipsList.toArray().filter(x => this.notificationChips.toArray().indexOf(x) === -1);
15✔
491
        dataChips.forEach(element => {
6✔
492
            if (element.nativeElement.previousElementSibling) {
9✔
493
                element.nativeElement.previousElementSibling.style.visibility = 'hidden';
9✔
494
            }
495
            if (element.nativeElement.nextElementSibling) {
9✔
496
                element.nativeElement.nextElementSibling.style.visibility = 'hidden';
9✔
497
            }
498
        });
499
    }
500

501
    /**
502
    * @hidden
503
    * @internal
504
    */
505
    public onValueDrop(event, area) {
506
        if (!(event.dragChip && event.dragChip.data?.pivotArea) && !(event.dragData?.chip && !!event.dragData.chip.data.pivotArea)) return;
2!
507
        //values can only be reordered
508
        const values = this.grid.pivotConfiguration.values;
2✔
509
        const dragId = event.dragChip?.id || event.dragData?.chip.id;
2!
510
        const chipsArray = area.chipsList.toArray();
2✔
511
        let chipIndex = chipsArray.indexOf(event.owner) !== -1 ? chipsArray.indexOf(event.owner) : chipsArray.length;
2!
512
        chipIndex = this._dropPos === DropPosition.AfterDropTarget ? chipIndex + 1 : chipIndex;
2✔
513
        const value = values.find(x => x.member === dragId || x.displayName === dragId);
3✔
514
        if (value) {
2✔
515
            const dragChipIndex = chipsArray.indexOf(event.dragChip || event.dragData.chip);
2!
516
            this.grid.moveValue(value, dragChipIndex >= chipIndex ? chipIndex : chipIndex - 1);
2✔
517
        }
518
    }
519

520
    /**
521
    * @hidden
522
    * @internal
523
    */
524
    public onDimDrop(event, area, dimensionType: PivotDimensionType) {
525
        if (!(event.dragChip && event.dragChip.data?.pivotArea) && !(event.dragData?.chip && !!event.dragData.chip.data.pivotArea)) return;
5!
526
        const dragId = event.dragChip?.id || event.dragData?.chip.id;
5!
527
        const currentDim = this.grid.getDimensionsByType(dimensionType);
5✔
528
        const chipsArray = area.chipsList.toArray();
5✔
529
        const chip = chipsArray.find(x => x.id === dragId);
7✔
530
        const isNewChip = chip === undefined;
5✔
531
        const isReorder = event.owner.id !== undefined;
5✔
532
        //const chipIndex = chipsArray.indexOf(event.owner) !== -1 ? chipsArray.indexOf(event.owner) : chipsArray.length;
533
        const chipIndex = currentDim.findIndex(x => x.memberName === event.owner.id) !== -1 ?
6✔
534
            currentDim.findIndex(x => x.memberName === event.owner.id) : currentDim.length;
5✔
535
        const targetIndex = this._dropPos === DropPosition.AfterDropTarget ? chipIndex + 1 : chipIndex;
5✔
536
        if (isNewChip) {
5✔
537
            // chip moved from an external collection
538
            const dim = this.grid.allDimensions.find(x => x && x.memberName === dragId);
7✔
539
            if (!dim) {
3!
540
                // you have dragged something that is not a dimension
UNCOV
541
                return;
×
542
            }
543
            this.grid.moveDimension(dim, dimensionType, targetIndex);
3✔
544
        } else if (isReorder) {
2✔
545
            // chip from same collection, reordered.
546
            const newDim = currentDim.find(x => x.memberName === dragId);
2✔
547
            const dragChipIndex = currentDim.findIndex(x => x.memberName === dragId);
2✔
548
            this.grid.moveDimension(newDim, dimensionType, dragChipIndex > chipIndex ? targetIndex : targetIndex - 1);
2!
549
        }
550
        this.grid.pipeTrigger++;
5✔
551
        this.grid.dimensionsChange.emit({ dimensions: currentDim, dimensionCollectionType: dimensionType });
5✔
552
        // clean states
553
        this.onDimDragEnd();
5✔
554
        this.onAreaDragLeave(event, area);
5✔
555
    }
556

557
    protected updateDropDown(value: IPivotValue, dropdown: IgxDropDownComponent, chip: IgxChipComponent) {
558
        this.value = value;
4✔
559
        dropdown.width = chip.nativeElement.clientWidth + 'px';
4✔
560
        this.aggregateList = PivotUtil.getAggregateList(value, this.grid);
4✔
561
        this.cdr.detectChanges();
4✔
562
        dropdown.open(this._subMenuOverlaySettings);
4✔
563
    }
564

565
    protected getRowDimensionColumn(dim: IPivotDimension): ColumnType {
566
        return this.grid.dimensionDataColumns ? this.grid.dimensionDataColumns.find((col) => col.field === dim.memberName) : null;
1,487!
567
    }
568
}
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

© 2025 Coveralls, Inc