Skip to content

Commit edad726

Browse files
MKirovaMKirova
authored andcommitted
Merge from base.
2 parents d996ffc + 5759012 commit edad726

16 files changed

+461
-62
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ All notable changes for each version of this project will be documented in this
2626
- Exposed new input `buttonText` which sets the text that is displayed inside the dropdown button in the toolbar.
2727
- `IgxCombo`
2828
- Added `groupSortingDirection` input, which allows you to set groups sorting order.
29+
- `igxChip`
30+
- Exposed drop directive related events for the chip when it's used as a drop target:
31+
- `dragLeave`
32+
- `dragDrop`
33+
- `dragOver`
2934

3035
### General
3136

@@ -53,13 +58,14 @@ All notable changes for each version of this project will be documented in this
5358
- **Breaking Change** - The following input has been removed
5459
- Input `columns`. Use `igxGrid` `columns` input instead.
5560
- `IgxCarousel`
56-
- **Breaking Changes** -The carousel animation type `CarouselAnimationType` is renamed to `HorizontalAnimationType`.
61+
- **Breaking Changes** -The carousel animation type `CarouselAnimationType` is renamed to `HorizontalAnimationType`.
5762

5863
## 12.2.3
5964

6065
### General
6166
- **Breaking Change** - `IgxPercentSummaryOperand` and `IgxCurrencySummaryOperand` have been removed and `IgxNumberSummaryOperand` should be used instead. If you have used the percent or currency summary operands to extend a custom summary operand from them, then change the custom operand to extend from the number summary operand.
62-
67+
- `IgxToastComponent`
68+
- **Deprecated** - The `position` input property has been deprecated. Use `positionSettings` input instead.
6369
## 12.2.1
6470

6571
### New Features

projects/igniteui-angular/src/lib/chips/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ The chips can be focused using the `Tab` key or by clicking on them. Chips can b
167167
| `selectedChanging` | `IChipSelectEventArgs` | Fired when the chip is being selected/deselected. Cancellable |
168168
| `keyDown ` | `IChipKeyDownEventArgs` | Fired when the chip keyboard navigation is being used. |
169169
| `dragEnter ` | `IChipEnterDragAreaEventArgs` | Fired when another chip has entered the current chip area. |
170+
| `dragLeave ` | `IChipEnterDragAreaEventArgs` | Fired when another chip has left the current chip area. |
171+
| `dragDrop ` | `IChipEnterDragAreaEventArgs` | Fired when another chip has been dropped in the current chip area. |
172+
| `dragOver ` | `IChipEnterDragAreaEventArgs` | Fired when another chip has moved over the current chip area. |
170173

171174
## IgxChipsAreaComponent
172175

projects/igniteui-angular/src/lib/chips/chip.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
(dragClick)="onChipDragClicked($event)"
1111
igxDrop
1212
(enter)="onChipDragEnterHandler($event)"
13+
(leave)= "onChipDragLeaveHandler($event)"
14+
(over)="onChipOverHandler($event)"
1315
(dropped)="onChipDrop($event)">
1416

1517
<div #selectContainer [ngClass]="selectClass(selected)">

projects/igniteui-angular/src/lib/chips/chip.component.ts

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,12 +419,51 @@ export class IgxChipComponent extends DisplayDensityBase {
419419
*
420420
* @example
421421
* ```html
422-
* <igx-chip #myChip [id]="'igx-chip-1'" [draggable]="true" (onDragEnter)="chipEnter($event)">
422+
* <igx-chip #myChip [id]="'igx-chip-1'" [draggable]="true" (dragEnter)="chipEnter($event)">
423423
* ```
424424
*/
425425
@Output()
426426
public dragEnter = new EventEmitter<IChipEnterDragAreaEventArgs>();
427427

428+
/**
429+
* Emits an event when the `IgxChipComponent` has left the `IgxChipsAreaComponent`.
430+
* Returns the target `IgxChipComponent`, the drag `IgxChipComponent`, as well as
431+
* the original drop event arguments.
432+
*
433+
* @example
434+
* ```html
435+
* <igx-chip #myChip [id]="'igx-chip-1'" [draggable]="true" (dragLeave)="chipLeave($event)">
436+
* ```
437+
*/
438+
@Output()
439+
public dragLeave = new EventEmitter<IChipEnterDragAreaEventArgs>();
440+
441+
/**
442+
* Emits an event when the `IgxChipComponent` is over the `IgxChipsAreaComponent`.
443+
* Returns the target `IgxChipComponent`, the drag `IgxChipComponent`, as well as
444+
* the original drop event arguments.
445+
*
446+
* @example
447+
* ```html
448+
* <igx-chip #myChip [id]="'igx-chip-1'" [draggable]="true" (dragOver)="chipOver($event)">
449+
* ```
450+
*/
451+
@Output()
452+
public dragOver = new EventEmitter<IChipEnterDragAreaEventArgs>();
453+
454+
/**
455+
* Emits an event when the `IgxChipComponent` has been dropped in the `IgxChipsAreaComponent`.
456+
* Returns the target `IgxChipComponent`, the drag `IgxChipComponent`, as well as
457+
* the original drop event arguments.
458+
*
459+
* @example
460+
* ```html
461+
* <igx-chip #myChip [id]="'igx-chip-1'" [draggable]="true" (dragDrop)="chipLeave($event)">
462+
* ```
463+
*/
464+
@Output()
465+
public dragDrop = new EventEmitter<IChipEnterDragAreaEventArgs>();
466+
428467
/**
429468
* @hidden
430469
* @internal
@@ -743,14 +782,46 @@ export class IgxChipComponent extends DisplayDensityBase {
743782
this.dragEnter.emit(eventArgs);
744783
}
745784

785+
/**
786+
* @hidden
787+
* @internal
788+
*/
789+
public onChipDragLeaveHandler(event: IDropBaseEventArgs) {
790+
const eventArgs: IChipEnterDragAreaEventArgs = {
791+
owner: this,
792+
dragChip: event.drag.data.chip,
793+
originalEvent: event
794+
};
795+
this.dragLeave.emit(eventArgs);
796+
}
797+
746798
/**
747799
* @hidden
748800
* @internal
749801
*/
750802
public onChipDrop(event: IDropDroppedEventArgs) {
751803
// Cancel the default drop logic
752804
event.cancel = true;
805+
const eventArgs: IChipEnterDragAreaEventArgs = {
806+
owner: this,
807+
dragChip: event.drag.data.chip,
808+
originalEvent: event
809+
};
810+
this.dragDrop.emit(eventArgs);
753811
}
812+
813+
/**
814+
* @hidden
815+
* @internal
816+
*/
817+
public onChipOverHandler(event: IDropDroppedEventArgs) {
818+
const eventArgs: IChipEnterDragAreaEventArgs = {
819+
owner: this,
820+
dragChip: event.drag.data.chip,
821+
originalEvent: event
822+
};
823+
this.dragOver.emit(eventArgs);
824+
}
754825
// End chip igxDrop behavior
755826

756827
protected changeSelection(newValue: boolean, srcEvent = null) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ export class IgxGridHeaderRowComponent implements DoCheck {
184184
}
185185

186186
constructor(
187-
private ref: ElementRef<HTMLElement>,
188-
private cdr: ChangeDetectorRef
187+
protected ref: ElementRef<HTMLElement>,
188+
protected cdr: ChangeDetectorRef
189189
) { }
190190

191191
/**

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<ng-content select="igx-grid-toolbar"></ng-content>
33

44
<!-- Grid table head row area -->
5-
<igx-pivot-header-row class="igx-grid-thead" tabindex="0"
5+
<igx-pivot-header-row class="igx-grid-thead" tabindex="0" style='flex-direction: column;'
66
[grid]="this"
77
[hasMRL]="hasColumnLayouts"
88
[density]="displayDensity"
@@ -31,10 +31,10 @@
3131
[igxColumnMovingDrop]="headerContainer" [attr.droppable]="true" id="left"
3232
class="igx-grid__scroll-on-drag-pinned" [style.left.px]="pinnedWidth"></span>
3333
<ng-template igxGridFor let-rowData [igxGridForOf]="data
34-
| pivotGridFilter:pivotConfiguration.filters:filterStrategy:advancedFilteringExpressionsTree
35-
| pivotGridRow:pivotConfiguration:expansionStates
36-
| pivotGridRowExpansion:pivotConfiguration:expansionStates
37-
| pivotGridColumn:pivotConfiguration:expansionStates"
34+
| pivotGridFilter:pivotConfiguration:filterStrategy:advancedFilteringExpressionsTree
35+
| pivotGridRow:pivotConfiguration:expansionStates:pipeTrigger
36+
| pivotGridRowExpansion:pivotConfiguration:expansionStates:pipeTrigger
37+
| pivotGridColumn:pivotConfiguration:expansionStates:pipeTrigger"
3838
let-rowIndex="index" [igxForScrollOrientation]="'vertical'" [igxForScrollContainer]='verticalScroll'
3939
[igxForContainerSize]='calcHeight'
4040
[igxForItemSize]="hasColumnLayouts ? rowHeight * multiRowLayoutRowSize + 1 : renderedRowHeight"

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

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,24 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
210210
}
211211

212212
public get pivotRowWidths() {
213-
const rowDimCount = this.pivotConfiguration.rows.length;
214-
return MINIMUM_COLUMN_WIDTH * rowDimCount;
213+
const rowDimCount = this.rowDimensions.length;
214+
return MINIMUM_COLUMN_WIDTH * rowDimCount || MINIMUM_COLUMN_WIDTH;
215+
}
216+
217+
public get rowDimensions() {
218+
return this.pivotConfiguration.rows.filter(x => x.enabled) || [];
219+
}
220+
221+
public get columnDimensions() {
222+
return this.pivotConfiguration.columns.filter(x => x.enabled) || [];
223+
}
224+
225+
public get filterDimensions() {
226+
return this.pivotConfiguration.filters?.filter(x => x.enabled) || [];
227+
}
228+
229+
public get values() {
230+
return this.pivotConfiguration.values.filter(x => x.enabled);
215231
}
216232

217233
public toggleColumn(col: IgxColumnComponent) {
@@ -269,8 +285,16 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
269285
protected calcGridHeadRow() {
270286
}
271287

288+
/**
289+
* @hidden @internal
290+
*/
291+
protected getDataBasedBodyHeight(): number {
292+
const dvl = this.dataView?.length || 0;
293+
return dvl < this._defaultTargetRecordNumber ? 0 : this.defaultTargetBodyHeight;
294+
}
295+
272296
protected get hasMultipleValues() {
273-
return this.pivotConfiguration.values.length > 1;
297+
return this.values.length > 1;
274298
}
275299

276300
/**
@@ -289,10 +313,10 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
289313
fieldsMap = this.generateFromData(filteredFields);
290314
} else {
291315
fieldsMap = PivotUtil.getFieldsHierarchy(
292-
data,
293-
this.pivotConfiguration.columns,
294-
PivotDimensionType.Column,
295-
{ aggregations: 'aggregations', records: 'records', children: 'children', level: 'level' }
316+
data,
317+
this.columnDimensions,
318+
PivotDimensionType.Column,
319+
{aggregations: 'aggregations', records: 'records', children: 'children', level: 'level'}
296320
);
297321
}
298322
columns = this.generateColumnHierarchy(fieldsMap, data);
@@ -385,7 +409,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
385409

386410
protected getMeasureChildren(colFactory, data, parent, hidden) {
387411
const cols = [];
388-
this.pivotConfiguration.values.forEach(val => {
412+
this.values.forEach(val => {
389413
const ref = colFactory.create(this.viewRef.injector);
390414
ref.instance.header = val.displayName || val.member;
391415
ref.instance.field = parent.field + '-' + val.member;

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.interface.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export interface IPivotConfiguration {
1111
rows: IPivotDimension[] | null;
1212
columns: IPivotDimension[] | null;
1313
values: IPivotValue[] | null;
14-
// A predefined or defined via the `igxPivotSelector` filter expression tree to be applied in the filter pipe.
15-
filters: FilteringExpressionsTree | null;
14+
// dimensions to be displayed in the filter area.
15+
filters?: IPivotDimension[] | null;
1616
}
1717

1818
export interface IPivotDimension {
@@ -24,6 +24,8 @@ export interface IPivotDimension {
2424
memberFunction?: (data: any) => any;
2525
// Enables/Disables a particular dimension from pivot structure.
2626
enabled: boolean;
27+
// A predefined or defined via the `igxPivotSelector` filter expression tree for the current dimension to be applied in the filter pipe.
28+
filter?: FilteringExpressionsTree | null;
2729
}
2830

2931
export interface IPivotValue {
@@ -54,7 +56,8 @@ export interface IPivotKeys {
5456

5557
export enum PivotDimensionType {
5658
Row,
57-
Column
59+
Column,
60+
Filter
5861
}
5962

6063
export interface IPivotDimensionData {

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

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import { cloneArray } from '../../core/utils';
33
import { DataUtil } from '../../data-operations/data-util';
44
import { FilteringExpressionsTree, IFilteringExpressionsTree } from '../../data-operations/filtering-expressions-tree';
55
import { IFilteringStrategy } from '../../data-operations/filtering-strategy';
6-
import { IPivotConfiguration, IPivotKeys } from './pivot-grid.interface';
6+
import { IPivotConfiguration, IPivotDimension, IPivotKeys } from './pivot-grid.interface';
77
import { PivotColumnDimensionsStrategy, PivotRowDimensionsStrategy } from '../../data-operations/pivot-strategy';
88
import { PivotUtil } from './pivot-util';
9+
import { FilteringLogic } from '../../data-operations/filtering-expression.interface';
910
/**
1011
* @hidden
1112
*/
@@ -21,10 +22,12 @@ export class IgxPivotRowPipe implements PipeTransform {
2122
collection: any,
2223
config: IPivotConfiguration,
2324
_: Map<any, boolean>,
25+
_pipeTrigger?: number,
2426
pivotKeys: IPivotKeys = {aggregations: 'aggregations', records: 'records', children: 'children', level: 'level'}
2527
): any[] {
26-
const rowStrategy = config.rowStrategy || PivotRowDimensionsStrategy.instance();
27-
return rowStrategy.process(collection.slice(0), config.rows, config.values, pivotKeys);
28+
const enabledRows = config.rows.filter(x => x.enabled);
29+
const rowStrategy = config.rowStrategy || PivotRowDimensionsStrategy.instance();
30+
return rowStrategy.process(collection.slice(0), enabledRows, config.values, pivotKeys);
2831
}
2932
}
3033

@@ -43,12 +46,14 @@ export class IgxPivotRowExpansionPipe implements PipeTransform {
4346
collection: any[],
4447
config: IPivotConfiguration,
4548
expansionStates: Map<any, boolean>,
49+
_pipeTrigger?: number,
4650
pivotKeys: IPivotKeys = {aggregations: 'aggregations', records: 'records', children: 'children', level: 'level'}
4751
): any[] {
48-
const data = collection.slice(0);
52+
const enabledRows = config.rows.filter(x => x.enabled);
53+
const data = collection ? collection.slice(0) : [];
4954
let totalLlv = 0;
5055
const prevDims = [];
51-
for (const row of config.rows) {
56+
for (const row of enabledRows) {
5257
const lvl = PivotUtil.getDimensionDepth(row);
5358
totalLlv += lvl;
5459
PivotUtil.flattenHierarchy(data, config, row, expansionStates, pivotKeys, totalLlv, prevDims, 0);
@@ -72,10 +77,14 @@ export class IgxPivotColumnPipe implements PipeTransform {
7277
collection: any,
7378
config: IPivotConfiguration,
7479
_: Map<any, boolean>,
80+
_pipeTrigger?: number,
7581
pivotKeys: IPivotKeys = {aggregations: 'aggregations', records: 'records', children: 'children', level: 'level'}
7682
): any[] {
77-
const colStrategy = config.columnStrategy || PivotColumnDimensionsStrategy.instance();
78-
return colStrategy.process(collection, config.columns, config.values, pivotKeys);
83+
const enabledColumns = config.columns.filter(x => x.enabled);
84+
const enabledValues = config.values.filter(x => x.enabled);
85+
86+
const colStrategy = config.columnStrategy || PivotColumnDimensionsStrategy.instance();
87+
return colStrategy.process(collection, enabledColumns, enabledValues, pivotKeys);
7988
}
8089
}
8190

@@ -89,10 +98,20 @@ export class IgxPivotColumnPipe implements PipeTransform {
8998
export class IgxPivotGridFilterPipe implements PipeTransform {
9099

91100
public transform(collection: any[],
92-
expressionsTree: IFilteringExpressionsTree,
101+
config: IPivotConfiguration,
93102
filterStrategy: IFilteringStrategy,
94103
advancedExpressionsTree: IFilteringExpressionsTree): any[] {
95104

105+
const allDimensions = config.rows.concat(config.columns).concat(config.filters);
106+
const enabledDimensions = allDimensions.filter(x => x && x.enabled);
107+
108+
const expressionsTree = new FilteringExpressionsTree(FilteringLogic.And);
109+
// add expression trees from all filters
110+
enabledDimensions.forEach(x => {
111+
if (x.filter) {
112+
expressionsTree.filteringOperands.push(x.filter);
113+
}
114+
});
96115
const state = {
97116
expressionsTree,
98117
strategy: filterStrategy,

0 commit comments

Comments
 (0)