Skip to content

Commit cb8df38

Browse files
committed
Merge branch 'master' into 0.27
2 parents 7b42150 + 727d79a commit cb8df38

22 files changed

+475
-190
lines changed

.github/ISSUE_TEMPLATE/Support_question.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ about: Ask a question about the project
44
title: Become a sponsor on Patreon to ask questions
55
labels: ''
66
assignees: ''
7-
87
---
98

10-
To gain access to the private issue tracker for this project where you can ask any questions you'd like about the calendar, you must become a silver sponsor on Patreon: https://www.patreon.com/mattlewis92
9+
To ask any questions you'd like about the calendar beyond bug and feature requests, you must become a silver sponsor or higher on Patreon: https://www.patreon.com/mattlewis92

CHANGELOG.md

+21
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,27 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
<a name="0.26.9"></a>
6+
## [0.26.9](https://github.com/mattlewis92/angular-calendar/compare/v0.26.8...v0.26.9) (2019-03-17)
7+
8+
9+
### Bug Fixes
10+
11+
* allow scrolling on clickable elements on mobile ([b78b87d](https://github.com/mattlewis92/angular-calendar/commit/b78b87d)), closes [#867](https://github.com/mattlewis92/angular-calendar/issues/867)
12+
13+
14+
15+
<a name="0.26.8"></a>
16+
## [0.26.8](https://github.com/mattlewis92/angular-calendar/compare/v0.26.7...v0.26.8) (2019-03-17)
17+
18+
19+
### Bug Fixes
20+
21+
* **week-view:** update header when week starts on changes ([bf3dd4d](https://github.com/mattlewis92/angular-calendar/commit/bf3dd4d)), closes [#868](https://github.com/mattlewis92/angular-calendar/issues/868)
22+
* throw better error message on invalid date formatter ([5f1fe72](https://github.com/mattlewis92/angular-calendar/commit/5f1fe72)), closes [#897](https://github.com/mattlewis92/angular-calendar/issues/897)
23+
24+
25+
526
<a name="0.26.7"></a>
627
## [0.26.7](https://github.com/mattlewis92/angular-calendar/compare/v0.26.6...v0.26.7) (2019-03-16)
728

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ As there are so many events to show on each month, it doesn’t provide a lot of
118118

119119
### Does this calendar work with mobile?
120120

121-
This library is not optimised for mobile. Due to the complex nature of a calendar component, it is non trivial to build a calendar that has a great UX on both desktop and mobile. It is recommended to build your own calendar component for mobile that has a dedicated UX. You may be able to get some degree of mobile support by setting some custom CSS rules for smaller screens and [including hammerjs](http://hammerjs.github.io/) but your mileage may vary.
121+
This library is not optimised for mobile. Due to the complex nature of a calendar component, it is non trivial to build a calendar that has a great UX on both desktop and mobile. It is recommended to build your own calendar component for mobile that has a dedicated UX. You may be able to get some degree of mobile support by setting some custom CSS rules for smaller screens, [including hammerjs](http://hammerjs.github.io/) and using a [custom hammerjs config](https://github.com/mattlewis92/angular-calendar/blob/master/projects/demos/app/hammer-config.ts) to allow scrolling on clickable elements.
122122

123123
### How do I use a custom template?
124124

package-lock.json

+38-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-calendar",
3-
"version": "0.26.7",
3+
"version": "0.26.9",
44
"description": "A calendar component for angular 6.0+ that can display events on a month, week or day view",
55
"scripts": {
66
"start": "node --max_old_space_size=8192 ./node_modules/.bin/ng serve --open",
@@ -105,6 +105,7 @@
105105
"moment-timezone": "^0.5.23",
106106
"ng-packagr": "^4.7.1",
107107
"ngx-contextmenu": "^5.1.1",
108+
"ngx-perfect-scrollbar": "^7.2.1",
108109
"node-sass": "^4.11.0",
109110
"postcss-cli": "^6.1.2",
110111
"postcss-flexibility": "^2.0.0",
@@ -132,7 +133,7 @@
132133
"@angular/core": ">=6.0.0 <9.0.0"
133134
},
134135
"dependencies": {
135-
"angular-draggable-droppable": "^4.1.0",
136+
"angular-draggable-droppable": "^4.2.0",
136137
"angular-resizable-element": "^3.2.4",
137138
"calendar-utils": "^0.3.0-beta.7",
138139
"positioning": "^1.4.0"

projects/angular-calendar/src/modules/common/calendar-date.pipe.ts

+10
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ export class CalendarDatePipe implements PipeTransform {
2525
excludeDays: number[] = [],
2626
daysInWeek?: number
2727
): string {
28+
if (typeof this.dateFormatter[method] === 'undefined') {
29+
const allowedMethods = Object.getOwnPropertyNames(
30+
Object.getPrototypeOf(CalendarDateFormatter.prototype)
31+
).filter(iMethod => iMethod !== 'constructor');
32+
throw new Error(
33+
`${method} is not a valid date formatter. Can only be one of ${allowedMethods.join(
34+
', '
35+
)}`
36+
);
37+
}
2838
return this.dateFormatter[method]({
2939
date,
3040
locale,

projects/angular-calendar/src/modules/common/click.directive.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const clickElements = new Set<HTMLElement>();
1616
selector: '[mwlClick]'
1717
})
1818
export class ClickDirective implements OnInit, OnDestroy {
19-
@Output('mwlClick') click: EventEmitter<MouseEvent> = new EventEmitter(); // tslint:disable-line
19+
@Output('mwlClick') click = new EventEmitter<MouseEvent>(); // tslint:disable-line
2020

2121
private removeListener: () => void;
2222

@@ -27,6 +27,11 @@ export class ClickDirective implements OnInit, OnDestroy {
2727
) {}
2828

2929
ngOnInit(): void {
30+
this.renderer.setAttribute(
31+
this.elm.nativeElement,
32+
'data-calendar-clickable',
33+
'true'
34+
);
3035
clickElements.add(this.elm.nativeElement);
3136
const eventName: string =
3237
typeof window !== 'undefined' && typeof window['Hammer'] !== 'undefined'

projects/angular-calendar/src/modules/week/calendar-week-view.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,8 @@ export class CalendarWeekViewComponent implements OnChanges, OnInit, OnDestroy {
653653
changes.viewDate ||
654654
changes.excludeDays ||
655655
changes.weekendDays ||
656-
changes.daysInWeek;
656+
changes.daysInWeek ||
657+
changes.weekStartsOn;
657658

658659
const refreshBody =
659660
changes.viewDate ||

projects/angular-calendar/test/calendar-date.pipe.spec.ts

+11
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,15 @@ describe('calendarDate pipe', () => {
9595
weekStartsOn: 0
9696
});
9797
});
98+
99+
it('should throw when an invalid method is passed', () => {
100+
const fixture: ComponentFixture<TestComponent> = TestBed.createComponent(
101+
TestComponent
102+
);
103+
fixture.componentInstance.date = new Date('2016-01-01');
104+
fixture.componentInstance.method = 'invalid';
105+
expect(() => fixture.detectChanges()).to.throw(
106+
/^invalid is not a valid date formatter. Can only be one of/
107+
);
108+
});
98109
});

projects/demos/app/demo-app.component.ts

+16-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ interface Demo {
1919
path: string;
2020
sources?: Source[];
2121
darkTheme: boolean;
22+
tags: string[];
2223
}
2324

2425
async function getSources(folder: string): Promise<Source[]> {
@@ -83,9 +84,11 @@ const dependencyVersions: any = {
8384
})
8485
export class DemoAppComponent implements OnInit {
8586
demos: Demo[] = [];
87+
filteredDemos: Demo[] = [];
8688
activeDemo: Demo;
8789
isMenuVisible = false;
8890
firstDemoLoaded = false;
91+
searchText = '';
8992

9093
constructor(private router: Router, analytics: Angulartics2GoogleAnalytics) {
9194
analytics.startTracking();
@@ -99,8 +102,10 @@ export class DemoAppComponent implements OnInit {
99102
.map(route => ({
100103
path: route.path,
101104
label: route.data.label,
102-
darkTheme: route.data.darkTheme
105+
darkTheme: route.data.darkTheme,
106+
tags: route.data.tags || []
103107
}));
108+
this.updateFilteredDemos();
104109

105110
this.router.events
106111
.pipe(filter(event => event instanceof NavigationEnd))
@@ -127,6 +132,16 @@ export class DemoAppComponent implements OnInit {
127132
});
128133
}
129134

135+
updateFilteredDemos() {
136+
this.filteredDemos = this.demos.filter(
137+
demo =>
138+
!this.searchText ||
139+
[demo.label.toLowerCase(), ...demo.tags].some(tag =>
140+
tag.includes(this.searchText.toLowerCase())
141+
)
142+
);
143+
}
144+
130145
editInStackblitz(demo: Demo): void {
131146
const files: {
132147
[path: string]: string;

projects/demos/app/demo-app.css

+19-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,22 @@ h3 {
44

55
.container-fluid {
66
padding-top: 70px;
7-
padding-bottom: 50px;
7+
}
8+
9+
@media (min-width: 768px) {
10+
.container-fluid {
11+
height: 100vh;
12+
}
813
}
914

1015
.spacer-top {
1116
margin-top: 15px;
1217
}
1318

19+
.sidebar-nav {
20+
padding-left: 5px;
21+
}
22+
1423
.sidebar-nav h4 {
1524
margin-bottom: 20px;
1625
}
@@ -41,4 +50,12 @@ h3 {
4150
pre {
4251
background-color: #f5f5f5;
4352
padding: 15px;
44-
}
53+
}
54+
55+
.fill-height {
56+
height: 100%;
57+
}
58+
59+
.scroll-y {
60+
overflow-y: auto;
61+
}

0 commit comments

Comments
 (0)