Skip to content

Commit d1367ac

Browse files
authored
Merge branch '9.0.x' into nalipiev/changelog-fix
2 parents a5a6839 + a3ee13a commit d1367ac

File tree

76 files changed

+9570
-11239
lines changed

Some content is hidden

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

76 files changed

+9570
-11239
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ All notable changes for each version of this project will be documented in this
102102
</igx-grid>
103103
```
104104
- `IgxSlider`:
105+
- **Breaking Change** - `isContinuous` - input has been deleted. The option is not supported anymore.
105106
- `primaryTicks` input was added. Which sets the number of primary ticks
106107
- `secondaryTicks` input was added. Which sets the number of secondary ticks.
107108
- `showTicks` input was added. Which show/hide all slider ticks and tick labels.
@@ -110,7 +111,6 @@ All notable changes for each version of this project will be documented in this
110111
- `ticksOrientation` input was added. Allows to change ticks orientation to top|bottom|mirror.
111112
- `tickLabelsOrientation` input was added. Allows you to change the rotation of all tick labels from horizontal to vertical(toptobottom, bottomtotop).
112113
- `igxSliderTickLabel` directive has been introduced. Allows you to set a custom template for all tick labels.
113-
- `isContinuous` - input has been deleted. The option is not supported anymore.
114114
- `onValueChanged` - new output has been exposed. This event is emitted at the end of every slide interaction.
115115

116116
- `IgxCarousel`:

gulpfile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ function typedocBuildExportFn(cb) {
184184
}
185185

186186
function typedocImportJsonFn(cb) {
187-
spawnSync('typedoc', [TYPEDOC.PROJECT_PATH, "--generate-from-json", TYPEDOC.EXPORT_JSON_PATH],
187+
spawnSync('typedoc', [TYPEDOC.PROJECT_PATH, "--generate-from-json", TYPEDOC.EXPORT_JSON_PATH, "--warns"],
188188
{ stdio: 'inherit', shell: true});
189189
cb();
190190
}
@@ -206,6 +206,7 @@ function typedocBuildDocsJA (cb) {
206206
slash(path.join(__dirname, 'i18nRepo', 'typedoc', 'ja')),
207207
'--templateStrings',
208208
TYPEDOC.TEMPLATE_STRINGS_PATH,
209+
'--warns',
209210
'--localize',
210211
'jp'], { stdio: 'inherit', shell: true });
211212

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
"test:lib:tgrid": "ng test igniteui-angular --watch=false --no-progress --code-coverage --karma-config=./projects/igniteui-angular/karma.tree-grid.conf.js",
1616
"test:lib:hgrid": "ng test igniteui-angular --watch=false --no-progress --code-coverage --karma-config=./projects/igniteui-angular/karma.hierarchical-grid.conf.js",
1717
"test:lib:others": "ng test igniteui-angular --watch=false --no-progress --code-coverage --karma-config=./projects/igniteui-angular/karma.non-grid.conf.js",
18-
"test:lib:azure:grid": "ng test igniteui-angular --watch=false --no-progress --code-coverage --karma-config=./projects/igniteui-angular/karma.azure.grid.conf.js",
19-
"test:lib:azure:tgrid": "ng test igniteui-angular --watch=false --no-progress --code-coverage --karma-config=./projects/igniteui-angular/karma.azure.tree-grid.conf.js",
20-
"test:lib:azure:hgrid": "ng test igniteui-angular --watch=false --no-progress --code-coverage --karma-config=./projects/igniteui-angular/karma.azure.hierarchical-grid.conf.js",
21-
"test:lib:azure:others": "ng test igniteui-angular --watch=false --no-progress --code-coverage --karma-config=./projects/igniteui-angular/karma.azure.non-grid.conf.js",
18+
"test:lib:azure:grid": "ng test igniteui-angular --watch=false --no-progress --code-coverage --karma-config=./projects/igniteui-angular/karma.azure.grid.conf.js --tsConfig=./projects/igniteui-angular/tsconfig.ivy.false.spec.json",
19+
"test:lib:azure:tgrid": "ng test igniteui-angular --watch=false --no-progress --code-coverage --karma-config=./projects/igniteui-angular/karma.azure.tree-grid.conf.js --tsConfig=./projects/igniteui-angular/tsconfig.ivy.false.spec.json",
20+
"test:lib:azure:hgrid": "ng test igniteui-angular --watch=false --no-progress --code-coverage --karma-config=./projects/igniteui-angular/karma.azure.hierarchical-grid.conf.js --tsConfig=./projects/igniteui-angular/tsconfig.ivy.false.spec.json",
21+
"test:lib:azure:others": "ng test igniteui-angular --watch=false --no-progress --code-coverage --karma-config=./projects/igniteui-angular/karma.azure.non-grid.conf.js --tsConfig=./projects/igniteui-angular/tsconfig.ivy.false.spec.json",
2222
"test:lib:watch": "ng test igniteui-angular",
2323
"test:schematics": "ts-node --project projects/igniteui-angular/migrations/tsconfig.json ./node_modules/jasmine/bin/jasmine.js ./projects/igniteui-angular/migrations/**/*.spec.ts ./projects/igniteui-angular/schematics/**/*.spec.ts",
2424
"build:lib": "ng build igniteui-angular --prod && gulp buildStyle",
@@ -115,7 +115,7 @@
115115
"ts-node": "~7.0.1",
116116
"tslint": "~5.12.1",
117117
"typedoc": "^0.16.9",
118-
"typedoc-plugin-localization": "^1.6.1",
118+
"typedoc-plugin-localization": "^2.2.0",
119119
"typescript": "~3.7.5",
120120
"webpack-sources": "1.3.0"
121121
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ export class IgxCalendarBaseDirective implements ControlValueAccessor {
317317
/**
318318
*@hidden
319319
*/
320-
public calendarModel: Calendar;
320+
protected calendarModel: Calendar;
321321

322322
/**
323323
* @hidden
@@ -620,7 +620,7 @@ export class IgxCalendarBaseDirective implements ControlValueAccessor {
620620
* Deselects date(s) (based on the selection type).
621621
*/
622622
public deselectDate(value?: Date | Date[]) {
623-
if (this.selectedDates === null || this.selectedDates.length === 0) {
623+
if (!this.selectedDates || this.selectedDates.length === 0) {
624624
return;
625625
}
626626

projects/igniteui-angular/src/lib/calendar/calendar-multi-view.component.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -841,9 +841,9 @@ describe('Multi-View Calendar - ', () => {
841841
})));
842842

843843
it('When select a new month - should come at correct position', fakeAsync(() => {
844-
const monthPicker = HelperTestFunctions.getCalendarSubHeader(fixture)
844+
const secondMonthPicker = HelperTestFunctions.getCalendarSubHeader(fixture)
845845
.querySelectorAll(HelperTestFunctions.CALENDAR_DATE_CSSCLASS)[2];
846-
UIInteractions.simulateKeyDownEvent(monthPicker, 'Enter');
846+
UIInteractions.simulateKeyDownEvent(secondMonthPicker, 'Enter');
847847
fixture.detectChanges();
848848
tick(100);
849849
const months = HelperTestFunctions.getMonthsFromMonthView(fixture);
@@ -878,7 +878,7 @@ describe('Multi-View Calendar - ', () => {
878878
UIInteractions.simulateKeyDownEvent(months[11], 'Enter');
879879
fixture.detectChanges();
880880
tick(100);
881-
HelperTestFunctions.verifyCalendarSubHeaders(fixture, [new Date('2019-12-12'), new Date('2020-1-1'), new Date('2020-2-2')]);
881+
HelperTestFunctions.verifyCalendarSubHeaders(fixture, [new Date('2019-11-12'), new Date('2019-12-1'), new Date('2020-1-2')]);
882882
}));
883883

884884
it('When select a new year - should come at correct position', fakeAsync(() => {
@@ -887,9 +887,9 @@ describe('Multi-View Calendar - ', () => {
887887
fixture.detectChanges();
888888
HelperTestFunctions.verifyCalendarSubHeaders(fixture, [new Date('2019-12-12'), new Date('2020-1-1'), new Date('2020-2-2')]);
889889

890-
const monthPicker = HelperTestFunctions.getCalendarSubHeader(fixture)
890+
const secondYearPicker = HelperTestFunctions.getCalendarSubHeader(fixture)
891891
.querySelectorAll(HelperTestFunctions.CALENDAR_DATE_CSSCLASS)[3];
892-
UIInteractions.simulateKeyDownEvent(monthPicker, 'Enter');
892+
UIInteractions.simulateKeyDownEvent(secondYearPicker, 'Enter');
893893
fixture.detectChanges();
894894
tick(150);
895895
fixture.detectChanges();
@@ -920,7 +920,7 @@ describe('Multi-View Calendar - ', () => {
920920
tick(100);
921921
fixture.detectChanges();
922922

923-
HelperTestFunctions.verifyCalendarSubHeaders(fixture, [new Date('2021-12-12'), new Date('2022-1-1'), new Date('2022-2-2')]);
923+
HelperTestFunctions.verifyCalendarSubHeaders(fixture, [new Date('2020-12-12'), new Date('2021-1-1'), new Date('2021-2-2')]);
924924
}));
925925

926926
});

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
</ng-template>
55

66
<ng-template let-result #defaultMonth let-obj>
7-
<span tabindex="0" #monthsBtn (keydown)="activeViewYearKB(getViewDate(obj.index), $event)" (click)="activeViewYear(getViewDate(obj.index), $event)"
7+
<span tabindex="0" #monthsBtn (keydown)="onActiveViewYearKB(getViewDate(obj.index), $event, obj.index)" (click)="onActiveViewYear(getViewDate(obj.index), obj.index, $event)"
88
class="igx-calendar-picker__date">
99
{{ formattedMonth(getViewDate(obj.index)) }}
1010
</span>
11-
<span tabindex="0" #yearsBtn (keydown)="activeViewDecadeKB($event, getViewDate(obj.index))" (click)="activeViewDecade(getViewDate(obj.index))"
11+
<span tabindex="0" #yearsBtn (keydown)="onActiveViewDecadeKB($event, getViewDate(obj.index), obj.index)" (click)="onActiveViewDecade(getViewDate(obj.index), obj.index)"
1212
class="igx-calendar-picker__date">
1313
{{ formattedYear(getViewDate(obj.index)) }}
1414
</span>
@@ -31,7 +31,7 @@ <h2 class="igx-calendar__header-date">
3131
}">
3232
<igx-icon fontSet="material">keyboard_arrow_left</igx-icon>
3333
</div>
34-
<div class="igx-calendar-picker__dates" *ngFor="let view of dayViews; index as i;" [style.width.%]="100/monthsViewNumber" [attr.data-month]="getMonth(i)">
34+
<div class="igx-calendar-picker__dates" *ngFor="let view of monthsViewNumber | IgxMonthViewSlots; index as i;" [style.width.%]="100/monthsViewNumber" [attr.data-month]="i | IgxGetViewDate:viewDate:false">
3535
<ng-container *ngTemplateOutlet="subheaderTemplate ? subheaderTemplate : defaultMonth; context: getContext(i)">
3636
</ng-container>
3737
</div>
@@ -46,11 +46,11 @@ <h2 class="igx-calendar__header-date">
4646
<div style="display: flex"
4747
[@animateChange]="animationAction"
4848
(@animateChange.done)="animationDone($event)">
49-
<igx-days-view *ngFor="let view of dayViews; index as i;" [changeDaysView]="true" #days
49+
<igx-days-view *ngFor="let view of monthsViewNumber | IgxMonthViewSlots; index as i;" [changeDaysView]="true" #days
5050
[selection]="selection"
5151
[locale]="locale"
5252
[value]="value"
53-
[viewDate]="getViewDate(i)"
53+
[viewDate]="i | IgxGetViewDate:viewDate"
5454
[weekStart]="weekStart"
5555
[formatOptions]="formatOptions"
5656
[formatViews]="formatViews"

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

Lines changed: 27 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ let NEXT_ID = 0;
8787
templateUrl: 'calendar.component.html'
8888
})
8989
export class IgxCalendarComponent extends IgxMonthPickerBaseDirective implements AfterViewInit, OnDestroy {
90+
9091
/**
9192
* Sets/gets the `id` of the calendar.
9293
*
@@ -142,23 +143,11 @@ export class IgxCalendarComponent extends IgxMonthPickerBaseDirective implements
142143
}
143144

144145
set monthsViewNumber(val: number) {
145-
if (this._monthsViewNumber === val || val <= 0) {
146+
if (val < 1 ) {
146147
return;
147-
} else if (this._monthsViewNumber < val) {
148-
for (let i = this._monthsViewNumber; i < val; i++) {
149-
const nextMonthDate = new Date(this.viewDate);
150-
nextMonthDate.setMonth(nextMonthDate.getMonth() + i);
151-
const monthView = {
152-
value: null,
153-
viewDate: nextMonthDate
154-
};
155-
this.dayViews.push(monthView);
156-
}
157-
this._monthsViewNumber = val;
158-
} else {
159-
this.dayViews.splice(val, this.dayViews.length - val);
160-
this._monthsViewNumber = val;
161148
}
149+
150+
this._monthsViewNumber = val;
162151
}
163152

164153
/**
@@ -252,8 +241,8 @@ export class IgxCalendarComponent extends IgxMonthPickerBaseDirective implements
252241
* @hidden
253242
* @internal
254243
*/
255-
@ViewChild('monthsBtn')
256-
public monthsBtn: ElementRef;
244+
@ViewChildren('monthsBtn')
245+
public monthsBtns: QueryList<ElementRef>;
257246

258247
/**
259248
* ViewChild that represents the decade view.
@@ -327,7 +316,7 @@ export class IgxCalendarComponent extends IgxMonthPickerBaseDirective implements
327316
/**
328317
* Sets the header template.
329318
*
330-
* @example
319+
* @example
331320
* ```html
332321
* <igx-calendar headerTemplateDirective = "igxCalendarHeader"></igx-calendar>
333322
* ```
@@ -429,23 +418,6 @@ export class IgxCalendarComponent extends IgxMonthPickerBaseDirective implements
429418
*/
430419
private _monthViewsChanges$: Subscription;
431420

432-
/**
433-
* @hidden
434-
* @internal
435-
*/
436-
private defaultDayView = {
437-
value: this.value,
438-
viewDate: this.viewDate
439-
};
440-
441-
/**
442-
* Days which are displayed into the calendar days view
443-
*
444-
* @hidden
445-
* @internal
446-
*/
447-
public dayViews = [this.defaultDayView];
448-
449421
public ngAfterViewInit() {
450422
this.setSiblingMonths(this.monthViews);
451423
this._monthViewsChanges$ = this.monthViews.changes.subscribe(c => {
@@ -494,7 +466,7 @@ export class IgxCalendarComponent extends IgxMonthPickerBaseDirective implements
494466
* @internal
495467
*/
496468
public previousMonth(isKeydownTrigger = false) {
497-
this.viewDate = this.calendarModel.timedelta(this.viewDate, 'month', -1);
469+
this.viewDate = this.calendarModel.getPrevMonth(this.viewDate);
498470
this.animationAction = ScrollMonth.PREV;
499471
this.isKeydownTrigger = isKeydownTrigger;
500472
}
@@ -506,7 +478,7 @@ export class IgxCalendarComponent extends IgxMonthPickerBaseDirective implements
506478
* @internal
507479
*/
508480
public nextMonth(isKeydownTrigger = false) {
509-
this.viewDate = this.calendarModel.timedelta(this.viewDate, 'month', 1);
481+
this.viewDate = this.calendarModel.getNextMonth(this.viewDate);
510482
this.animationAction = ScrollMonth.NEXT;
511483
this.isKeydownTrigger = isKeydownTrigger;
512484
}
@@ -564,8 +536,8 @@ export class IgxCalendarComponent extends IgxMonthPickerBaseDirective implements
564536
* @hidden
565537
* @internal
566538
*/
567-
public activeViewDecade(args: Date) {
568-
super.activeViewDecade();
539+
public onActiveViewDecade(args: Date, activeViewIdx: number) {
540+
super.activeViewDecade(activeViewIdx);
569541
requestAnimationFrame(() => {
570542
if (this.dacadeView) {
571543
this.dacadeView.date = args;
@@ -578,8 +550,8 @@ export class IgxCalendarComponent extends IgxMonthPickerBaseDirective implements
578550
* @hidden
579551
* @internal
580552
*/
581-
public activeViewDecadeKB(event, args: Date) {
582-
super.activeViewDecadeKB(event, args);
553+
public onActiveViewDecadeKB(event, args: Date, activeViewIdx: number) {
554+
super.activeViewDecadeKB(event, activeViewIdx);
583555

584556
requestAnimationFrame(() => {
585557
if (this.dacadeView) {
@@ -635,51 +607,53 @@ export class IgxCalendarComponent extends IgxMonthPickerBaseDirective implements
635607
this.callback = (next) => {
636608
const day = this.daysView.dates.find((item) => item.date.date.getTime() === next.getTime());
637609
if (day) {
638-
this.daysView.navService.focusNextDate(day.nativeElement, args.key, true);
610+
this.daysView.daysNavService.focusNextDate(day.nativeElement, args.key, true);
639611
}
640612
};
641-
this.viewDate = this.calendarModel.timedelta(this.nextDate, 'month', 0);
613+
this.viewDate = this.nextDate;
642614
}
643615

644616
/**
645617
* @hidden
646618
* @intenal
647619
*/
648620
public changeMonth(event: Date) {
649-
this.viewDate = new Date(this.viewDate.getFullYear(), event.getMonth());
621+
this.viewDate = this.calendarModel.getFirstViewDate(event, 'month', this.activeViewIdx);
650622
this.activeView = CalendarView.DEFAULT;
651623

652624
requestAnimationFrame(() => {
653-
if (this.monthsBtn) { this.monthsBtn.nativeElement.focus(); }
625+
const elem = this.monthsBtns.find((e: ElementRef, idx: number) => idx === this.activeViewIdx);
626+
if (elem) { elem.nativeElement.focus(); }
654627
});
655628
}
656629

657630
/**
658631
* @hidden
659632
* @internal
660633
*/
661-
public activeViewYear(args: Date, event): void {
634+
public onActiveViewYear(args: Date, activeViewIdx: number, event?): void {
662635
this.activeView = CalendarView.YEAR;
636+
this.activeViewIdx = activeViewIdx;
663637
requestAnimationFrame(() => {
664638
this.monthsView.date = args;
665639
this.focusMonth(event.target);
666640
});
667641
}
668642

669643
private focusMonth(target: HTMLElement) {
670-
const month = this.monthsView.dates.find((date) =>
671-
date.index === parseInt(target.parentElement.attributes['data-month'].value, 10));
644+
const month = this.monthsView.monthsRef.find((e) =>
645+
e.index === parseInt(target.parentElement.attributes['data-month'].value, 10));
672646
if (month) { month.nativeElement.focus(); }
673647
}
674648

675649
/**
676650
* @hidden
677651
* @internal
678652
*/
679-
public activeViewYearKB(args: Date, event): void {
653+
public onActiveViewYearKB(args: Date, event, activeViewIdx: number): void {
680654
if (event.key === KEYS.SPACE || event.key === KEYS.SPACE_IE || event.key === KEYS.ENTER) {
681655
event.preventDefault();
682-
this.activeViewYear(args, event);
656+
this.onActiveViewYear(args, activeViewIdx, event);
683657
}
684658
}
685659

@@ -722,22 +696,13 @@ export class IgxCalendarComponent extends IgxMonthPickerBaseDirective implements
722696
return date;
723697
}
724698

725-
/**
726-
* @hidden
727-
* @internal
728-
*/
729-
public getMonth(i: number): number {
730-
const date = this.calendarModel.timedelta(this.viewDate, 'month', i);
731-
return date.getMonth();
732-
}
733-
734699
/**
735700
* Getter for the context object inside the calendar templates.
736701
* @hidden
737702
* @internal
738703
*/
739704
public getContext(i: number) {
740-
const date = this.calendarModel.timedelta(this.viewDate, 'month', i);
705+
const date = this.getViewDate(i);
741706
return this.generateContext(date, i);
742707
}
743708

@@ -941,8 +906,8 @@ export class IgxCalendarComponent extends IgxMonthPickerBaseDirective implements
941906
private generateContext(value: Date, i?: number) {
942907
const formatObject = {
943908
index: i,
944-
monthView: () => this.activeViewYear(value, event),
945-
yearView: () => this.activeViewDecade(value),
909+
monthView: () => this.onActiveViewYear(value, i),
910+
yearView: () => this.onActiveViewDecade(value, i),
946911
...this.calendarModel.formatToParts(value, this.locale, this.formatOptions,
947912
['era', 'year', 'month', 'day', 'weekday'])
948913
};

0 commit comments

Comments
 (0)