Skip to content

Commit fa9face

Browse files
committed
chore(*): merge from origin/master
2 parents ba57d4f + fd40ed4 commit fa9face

File tree

97 files changed

+3640
-1070
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+3640
-1070
lines changed

CHANGELOG.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Ignite UI for Angular Change Log
1+
# Ignite UI for Angular Change Log
22

33
All notable changes for each version of this project will be documented in this file.
44

@@ -8,15 +8,70 @@ All notable changes for each version of this project will be documented in this
88
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
99
- `uniqueColumnValuesStrategy` input is added. This property provides a callback for loading unique column values on demand. If this property is provided, the unique values it generates will be used by the Excel Style Filtering (instead of using the unique values from the data that is bound to the grid).
1010
- `igxExcelStyleLoading` directive is added, which can be used to provide a custom loading template for the Excel Style Filtering. If this property is not provided, a default loading template will be used instead.
11+
- `IgxHierarchicalGrid`
12+
- Row Islands now emit child grid events with an additional argument - `owner`, which holds reference to the related child grid component instance.
13+
- `IgxDrag`
14+
- Dragging without ghost. Now it is possible to drag the base element `igxDrag` is instanced on by setting the new input `ghost` to false.
15+
- Ghost template. A custom ghost template reference can be provided on the new `ghostTemplate` input.
16+
- Dragging using a single or multiple handles. New `igxDragHandle` directive is exposed to specify a handle by which and element can be interacted with instead of the whole element `igxDrag` is instanced on.
17+
- Linking of drag and drop elements. This can be achieved by using the new provided `dragChannel` input, specifying each element to which channel it corresponds.
18+
- Drag animation improvements. Three new methods have been exposed in place of the old `animateToOrigin` input in order to provide more flexibility when wanting to have transition animation to specific position when dropping. `setLocation`, `transitionToOrigin` and `transitionTo` are all methods that provide a various way to animate a transition to a specific location for the dragged element.
19+
- New getters - `location` and `originLocation` to aid in applying transition animations.
20+
- New outputs - `dragMove`, `ghostCreate` and `ghostDestroy`
21+
- `IgxDrop`
22+
- Linking of drag and drop elements. This can be achieved by using the new provided `dropChannel` input, specifying each drop area to which channel it corresponds.
23+
- Drop strategies. Three new drop strategies have been provided - Append, Prepend and Insert. Also an input `dropStrategy` to the `igxDrop` which specify which strategy should be used when dropping an element inside the drop area. Custom one can be specified as well.
24+
1125
### General
1226
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
1327
- **Breaking Change** `igxExcelStyleSortingTemplate` directive is renamed to `igxExcelStyleSorting`.
1428
- **Breaking Change** `igxExcelStyleMovingTemplate` directive is renamed to `igxExcelStyleMoving`.
1529
- **Breaking Change** `igxExcelStyleHidingTemplate` directive is renamed to `igxExcelStyleHiding`.
1630
- **Breaking Change** `igxExcelStylePinningTemplate` directive is renamed to `igxExcelStylePinning`.
31+
- **Breaking Change** `onRowDragEnd` and `onRowDragStart` event arguments are changed - `owner` now holds reference to the grid component instance, while `dragDirective` hold reference to the drag directive.
32+
- `IgxCombo`
33+
- Combo selection is now consistent when `valueKey` is defined. When `valueKey` is specified, selection is based on the value keys of the items. For example:
34+
```html
35+
<igx-combo [data]="myCustomData" valueKey="id" displayKey="text"></igx-combo>
36+
```
37+
```typescript
38+
export class MyCombo {
39+
...
40+
public combo: IgxComboComponent;
41+
public myCustomData: { id: number, text: string } = [{ id: 0, name: "One" }, ...];
42+
...
43+
ngOnInit() {
44+
// Selection is done only by valueKey property value
45+
this.combo.selectItems([0, 1]);
46+
}
47+
}
48+
```
49+
- **Breaking Change** When using `[valueKey]`, combo methods, events and outputs **cannot** be handled with *data item references*.
50+
- For more information, visit the component's [readme](https://github.com/IgniteUI/igniteui-angular/tree/master/projects/igniteui-angular/src/lib/combo/README.md)
51+
1752
## 8.1.4
1853
- `IgxDialog` new @Input `positionSettings` is now available. It provides the ability to get/set both position and animation settings of the Dialog component.
1954

55+
- `IgxDrag`
56+
- Deprecated inputs - `hideBaseOnDrag`, `animateOnRelease`, `visible`.
57+
- Deprecated methods - `dropFinished`.
58+
- **Breaking Change** `ghostImageClass` input is renamed to `ghostClass`.
59+
- **Breaking Change** `dragGhostHost` input is renamed to `ghostHost`.
60+
- **Breaking Change** `returnMoveEnd` input is renamed to `transitioned`.
61+
- **Breaking Change** `onDragStart` output is renamed to `dragStart`.
62+
- **Breaking Change** `onDragEnd` output is renamed to `dragEnd`.
63+
64+
- `IgxDrop`
65+
- **Breaking Change** Default drop strategy is now changed to not perform any actions.
66+
- **Breaking Change** `onEnter` output is renamed to `enter`.
67+
- **Breaking Change** `onOver` output is renamed to `over`.
68+
- **Breaking Change** `onLeave` output is renamed to `leave`.
69+
- **Breaking Change** `onDrop` output is renamed to `dropped`.
70+
- **Breaking Change** Interfaces `IgxDropEnterEventArgs`, `IgxDropLeaveEventArgs` are both now called `IDragBaseEventArgs`.
71+
- **Breaking Change** Interfaces `IgxDropEventArgs` is renamed to `IDropDroppedEventArgs`.
72+
- **Breaking Change** Outputs `enter`, `over`, `leave`(former `onEnter`, `onOver`, `onLeave`) now have arguments of type `IDropBaseEventArgs`
73+
- **Breaking Change** Output `dropped` (former `onDrop`) now have arguments of type `IDropDroppedEventArgs`
74+
2075
## 8.1.3
2176
- `IgxCombo`
2277
- Combo `onSelectionChange` events now emits the item(s) that were added to or removed from the collection:
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"$schema": "../../common/schema/binding.schema.json",
3+
"changes": [
4+
{
5+
"name": "renderGhost",
6+
"replaceWith": "ghost",
7+
"owner": {
8+
"selector": "igxDrag",
9+
"type": "directive"
10+
}
11+
},
12+
{
13+
"name": "ghostImageClass",
14+
"replaceWith": "ghostClass",
15+
"owner": {
16+
"selector": "igxDrag",
17+
"type": "directive"
18+
}
19+
},
20+
{
21+
"name": "dragGhostHost",
22+
"replaceWith": "ghostHost",
23+
"owner": {
24+
"selector": "igxDrag",
25+
"type": "directive"
26+
}
27+
}
28+
]
29+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"$schema": "../../common/schema/binding.schema.json",
3+
"changes": [
4+
{
5+
"name": "onGhostCreate",
6+
"replaceWith": "ghostCreate",
7+
"owner": {
8+
"selector": "igxDrag",
9+
"type": "directive"
10+
}
11+
},
12+
{
13+
"name": "onGhostDestroy",
14+
"replaceWith": "ghostDestroy",
15+
"owner": {
16+
"selector": "igxDrag",
17+
"type": "directive"
18+
}
19+
},
20+
{
21+
"name": "returnMoveEnd",
22+
"replaceWith": "transitioned",
23+
"owner": {
24+
"selector": "igxDrag",
25+
"type": "directive"
26+
}
27+
},
28+
{
29+
"name": "dragClicked",
30+
"replaceWith": "click",
31+
"owner": {
32+
"selector": "igxDrag",
33+
"type": "directive"
34+
}
35+
},
36+
{
37+
"name": "onEnter",
38+
"replaceWith": "enter",
39+
"owner": {
40+
"selector": "igxDrop",
41+
"type": "directive"
42+
}
43+
},
44+
{
45+
"name": "onLeave",
46+
"replaceWith": "leave",
47+
"owner": {
48+
"selector": "igxDrop",
49+
"type": "directive"
50+
}
51+
},
52+
{
53+
"name": "onDrop",
54+
"replaceWith": "dropped",
55+
"owner": {
56+
"selector": "igxDrop",
57+
"type": "directive"
58+
}
59+
}
60+
]
61+
}

projects/igniteui-angular/migrations/update-8_2_0/index.spec.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,32 @@ describe('Update 8.2.0', () => {
5050

5151
done();
5252
});
53+
54+
it('should update igxDrag input bindings', done => {
55+
appTree.create(
56+
'/testSrc/appPrefix/component/custom.component.html',
57+
`<div igxDrag [renderGhost]="true" [ghostImageClass]="'casper'" [dragGhostHost]="host">Drag me</div>`);
58+
const tree = schematicRunner.runSchematic('migration-10', {}, appTree);
59+
60+
expect(tree.readContent('/testSrc/appPrefix/component/custom.component.html'))
61+
.toEqual(
62+
`<div igxDrag [ghost]="true" [ghostClass]="'casper'" [ghostHost]="host">Drag me</div>`);
63+
done();
64+
});
65+
66+
it('should update igxDrag and igxDrop outputs bindings', done => {
67+
appTree.create(
68+
'/testSrc/appPrefix/component/custom.component.html',
69+
`<div igxDrag (onGhostCreate)="ghostCreateHandler($event)" (onGhostDestroy)="ghostDestroyHandler($event)" (returnMoveEnd)="moveEndHandler($event)" (dragClicked)="clickHandler($event)">Drag me</div>
70+
<div igxDrop (onEnter)="enterHandler($event)" (onLeave)="leaveHandler($event)" (onDrop)="dropHandler($event)">drop area</div>
71+
`);
72+
const tree = schematicRunner.runSchematic('migration-10', {}, appTree);
73+
74+
expect(tree.readContent('/testSrc/appPrefix/component/custom.component.html'))
75+
.toEqual(
76+
`<div igxDrag (ghostCreate)="ghostCreateHandler($event)" (ghostDestroy)="ghostDestroyHandler($event)" (transitioned)="moveEndHandler($event)" (click)="clickHandler($event)">Drag me</div>
77+
<div igxDrop (enter)="enterHandler($event)" (leave)="leaveHandler($event)" (dropped)="dropHandler($event)">drop area</div>
78+
`);
79+
done();
80+
});
5381
});

projects/igniteui-angular/src/lib/banner/banner.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import { IgxButtonModule } from '../directives/button/button.directive';
99
import { IgxRippleModule } from '../directives/ripple/ripple.directive';
1010
import { IgxBannerActionsDirective } from './banner.directives';
1111
import { CommonModule } from '@angular/common';
12-
import { CancelableEventArgs } from '../core/utils';
12+
import { CancelableEventArgs, IBaseEventArgs } from '../core/utils';
1313

14-
export interface BannerEventArgs {
14+
export interface BannerEventArgs extends IBaseEventArgs {
1515
banner: IgxBannerComponent;
1616
event?: Event;
1717
}

projects/igniteui-angular/src/lib/buttonGroup/buttonGroup.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { IgxRippleModule } from '../directives/ripple/ripple.directive';
2323
import { IgxIconModule } from '../icon/index';
2424
import { takeUntil } from 'rxjs/operators';
2525
import { DisplayDensityBase, DisplayDensityToken, IDisplayDensityOptions, DisplayDensity } from '../core/density';
26+
import { IBaseEventArgs } from '../core/utils';
2627

2728
export enum ButtonGroupAlignment { horizontal, vertical }
2829
let NEXT_ID = 0;
@@ -424,7 +425,7 @@ export class IgxButtonGroupComponent extends DisplayDensityBase implements After
424425
}
425426
}
426427

427-
export interface IButtonGroupEventArgs {
428+
export interface IButtonGroupEventArgs extends IBaseEventArgs {
428429
button: IgxButtonDirective;
429430
index: number;
430431
}

projects/igniteui-angular/src/lib/calendar/calendar.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ export function isDateInRanges(date: Date, ranges: DateRangeDescriptor[]): boole
5252
date = new Date(date.getFullYear(), date.getMonth(), date.getDate());
5353
const dateInMs = date.getTime();
5454

55+
if (!ranges) {
56+
return false;
57+
}
58+
5559
for (const descriptor of ranges) {
5660
const dRanges = descriptor.dateRange ? descriptor.dateRange.map(
5761
r => new Date(r.getFullYear(), r.getMonth(), r.getDate())) : undefined;
@@ -296,7 +300,7 @@ export class Calendar {
296300

297301
const toType = (partType: string) => {
298302
const index = formattedParts.findIndex(({ type }) => type === partType);
299-
const o: IFormattedParts = { value: '', literal: '', combined: ''};
303+
const o: IFormattedParts = { value: '', literal: '', combined: '' };
300304

301305
if (partType === 'era' && index > -1) {
302306
o.value = formattedParts[index].value;
@@ -316,7 +320,7 @@ export class Calendar {
316320
}
317321
} else {
318322
for (const each of parts) {
319-
result[each] = { value: '', literal: '', combined: ''};
323+
result[each] = { value: '', literal: '', combined: '' };
320324
}
321325
}
322326
return result;
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
<ng-content></ng-content>
1+
<span class="igx-calendar__date-content">
2+
<ng-content></ng-content>
3+
</span>

projects/igniteui-angular/src/lib/calendar/days-view/day-item.component.ts

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, Input, Output, EventEmitter, HostBinding, ElementRef, HostListener } from '@angular/core';
2-
import { ICalendarDate, isDateInRanges } from '../calendar';
3-
import { DateRangeDescriptor } from '../../core/dates';
2+
import { ICalendarDate, isDateInRanges, Calendar } from '../calendar';
3+
import { DateRangeDescriptor, DateRangeType } from '../../core/dates';
44
import { CalendarSelection } from '../calendar-base';
55

66
/**
@@ -40,10 +40,13 @@ export class IgxDayItemComponent {
4040
}
4141

4242
if (this.selection === CalendarSelection.SINGLE) {
43-
this._selected = (this.value as Date).getTime() === date.getTime();
43+
this._selected = (this.value as Date).getTime() === date.getTime();
4444
} else {
45-
this._selected = (this.value as Date[])
46-
.some((each) => each.getTime() === date.getTime());
45+
const selectedDates = (this.value as Date[]);
46+
const currentDate = selectedDates.find(element => element.getTime() === date.getTime());
47+
48+
this._index = selectedDates.indexOf(currentDate) + 1;
49+
this._selected = !!this._index;
4750
}
4851

4952
return this._selected;
@@ -126,7 +129,7 @@ export class IgxDayItemComponent {
126129

127130
@HostBinding('class.igx-calendar__date--current')
128131
public get isTodayCSS(): boolean {
129-
return this.isToday && !this.selected;
132+
return this.isToday;
130133
}
131134

132135
@HostBinding('class.igx-calendar__date--selected')
@@ -144,11 +147,52 @@ export class IgxDayItemComponent {
144147
return this.isDisabled || this.isOutOfRange;
145148
}
146149

150+
@HostBinding('class.igx-calendar__date--range')
151+
public get isWithinRange() {
152+
if (Array.isArray(this.value) && this.value.length > 1) {
153+
154+
return isDateInRanges(this.date.date,
155+
[
156+
{
157+
type: DateRangeType.Between,
158+
dateRange: [this.value[0], this.value[this.value.length - 1]]
159+
}
160+
]
161+
);
162+
}
163+
164+
return false;
165+
}
166+
147167
@HostBinding('class.igx-calendar__date--special')
148168
public get isSpecialCSS(): boolean {
149169
return this.isSpecial;
150170
}
151171

172+
@HostBinding('class.igx-calendar__date--single')
173+
public get isSingleSelection(): boolean {
174+
return this.selection !== CalendarSelection.RANGE;
175+
}
176+
177+
@HostBinding('class.igx-calendar__date--first')
178+
public get isFirstInRange(): boolean {
179+
if (this.isSingleSelection) {
180+
return false;
181+
}
182+
183+
return this._index === 1;
184+
}
185+
186+
@HostBinding('class.igx-calendar__date--last')
187+
public get isLastInRange(): boolean {
188+
if (this.isSingleSelection) {
189+
return false;
190+
}
191+
192+
return (this.value as Date[]).length === this._index;
193+
}
194+
195+
private _index: Number;
152196
private _selected = false;
153197

154198
constructor(private elementRef: ElementRef) { }

projects/igniteui-angular/src/lib/calendar/days-view/days-view.component.html

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,16 @@
55
</div>
66

77
<div *ngFor="let week of getCalendarMonth; last as isLast; index as i; trackBy: rowTracker" class="igx-calendar__body-row" [@animateChange]="animationAction" (@animateChange.done)="animationDone($event, isLast)">
8-
<igx-day-item [date]="day" [selection]="selection" [value]="value" [disabledDates]="disabledDates" [specialDates]="specialDates" [outOfRangeDates]="outOfRangeDates" (onDateSelection)="selectDay($event)" *ngFor="let day of week; trackBy: dateTracker">
9-
{{ formattedDate(day.date) }}
8+
<igx-day-item
9+
*ngFor="let day of week; trackBy: dateTracker"
10+
[date]="day"
11+
[selection]="selection"
12+
[value]="value"
13+
[disabledDates]="disabledDates"
14+
[specialDates]="specialDates"
15+
[outOfRangeDates]="outOfRangeDates"
16+
(onDateSelection)="selectDay($event)"
17+
>
18+
{{ formattedDate(day.date) }}
1019
</igx-day-item>
1120
</div>

0 commit comments

Comments
 (0)