Skip to content

Commit 9e5f0bc

Browse files
committed
Merge branch 'master' into 0.28
2 parents bb1dede + 70ff8cb commit 9e5f0bc

File tree

8 files changed

+25
-126
lines changed

8 files changed

+25
-126
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
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+
### [0.27.20](https://github.com/mattlewis92/angular-calendar/compare/v0.27.19...v0.27.20) (2019-10-19)
6+
7+
8+
### Bug Fixes
9+
10+
* always use native click event rather than hammerjs's tap event ([ca189c3](https://github.com/mattlewis92/angular-calendar/commit/ca189c3)), closes [#1113](https://github.com/mattlewis92/angular-calendar/issues/1113)
11+
512
### [0.27.19](https://github.com/mattlewis92/angular-calendar/compare/v0.27.18...v0.27.19) (2019-09-25)
613

714

package-lock.json

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

package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-calendar",
3-
"version": "0.27.19",
3+
"version": "0.27.20",
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,7 +105,6 @@
105105
"del-cli": "^3.0.0",
106106
"flatpickr": "^4.6.3",
107107
"font-awesome": "^4.7.0",
108-
"hammerjs": "^2.0.8",
109108
"highlightjs-loader": "^0.2.3",
110109
"husky": "^3.0.7",
111110
"karma": "^4.3.0",
@@ -147,8 +146,8 @@
147146
"@angular/core": ">=6.0.0 <10.0.0"
148147
},
149148
"dependencies": {
150-
"angular-draggable-droppable": "^4.3.2",
151-
"angular-resizable-element": "^3.2.4",
149+
"angular-draggable-droppable": "^4.3.8",
150+
"angular-resizable-element": "^3.2.6",
152151
"calendar-utils": "^0.7.0",
153152
"positioning": "^2.0.0"
154153
},

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

+7-41
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,7 @@ import {
1212
} from '@angular/core';
1313
import { DOCUMENT } from '@angular/common';
1414
import { Observable, Subject } from 'rxjs';
15-
import { requestIdleCallbackObservable } from './request-idle-callback';
16-
import { switchMapTo, takeUntil } from 'rxjs/operators';
17-
18-
const clickElements = new Set<HTMLElement>();
19-
20-
const eventName: string =
21-
typeof window !== 'undefined' && typeof window['Hammer'] !== 'undefined'
22-
? 'tap'
23-
: 'click';
15+
import { takeUntil } from 'rxjs/operators';
2416

2517
@Directive({
2618
selector: '[mwlClick]'
@@ -35,53 +27,27 @@ export class ClickDirective implements OnInit, OnDestroy {
3527
constructor(
3628
private renderer: Renderer2,
3729
private elm: ElementRef<HTMLElement>,
38-
@Inject(DOCUMENT) private document,
39-
private zone: NgZone
30+
@Inject(DOCUMENT) private document
4031
) {}
4132

4233
ngOnInit(): void {
4334
if (!this.clickListenerDisabled) {
44-
this.renderer.setAttribute(
45-
this.elm.nativeElement,
46-
'data-calendar-clickable',
47-
'true'
48-
);
49-
clickElements.add(this.elm.nativeElement);
50-
51-
// issue #942 - lazily initialise all click handlers after initial render as hammerjs is slow
52-
requestIdleCallbackObservable()
53-
.pipe(
54-
switchMapTo(this.listen()),
55-
takeUntil(this.destroy$)
56-
)
35+
this.listen()
36+
.pipe(takeUntil(this.destroy$))
5737
.subscribe(event => {
58-
// prevent child click events from firing on parent elements that also have click events
59-
let nearestClickableParent = event.target as HTMLElement;
60-
while (
61-
!clickElements.has(nearestClickableParent) &&
62-
nearestClickableParent !== this.document.body
63-
) {
64-
nearestClickableParent = nearestClickableParent.parentElement;
65-
}
66-
const isThisClickableElement =
67-
this.elm.nativeElement === nearestClickableParent;
68-
if (isThisClickableElement) {
69-
this.zone.run(() => {
70-
this.click.next(event);
71-
});
72-
}
38+
event.stopPropagation();
39+
this.click.emit(event);
7340
});
7441
}
7542
}
7643

7744
ngOnDestroy(): void {
7845
this.destroy$.next();
79-
clickElements.delete(this.elm.nativeElement);
8046
}
8147

8248
private listen() {
8349
return new Observable<MouseEvent>(observer => {
84-
return this.renderer.listen(this.elm.nativeElement, eventName, event => {
50+
return this.renderer.listen(this.elm.nativeElement, 'click', event => {
8551
observer.next(event);
8652
});
8753
});

projects/angular-calendar/src/modules/common/request-idle-callback.ts

-28
This file was deleted.

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

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import { NgModule } from '@angular/core';
22
import { RouterModule } from '@angular/router';
3-
import {
4-
BrowserModule,
5-
HAMMER_GESTURE_CONFIG
6-
} from '@angular/platform-browser';
3+
import { BrowserModule } from '@angular/platform-browser';
74
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
85
import {
96
NgbTabsetModule,
@@ -17,7 +14,6 @@ import { DemoAppComponent } from './demo-app.component';
1714
import { DemoComponent as DefaultDemoComponent } from './demo-modules/kitchen-sink/component';
1815
import { DemoModule as DefaultDemoModule } from './demo-modules/kitchen-sink/module';
1916
import { environment } from '../environments/environment';
20-
import { CustomHammerConfig } from './hammer-config';
2117
import { FormsModule } from '@angular/forms';
2218
import { ClipboardModule } from 'ngx-clipboard';
2319

@@ -444,12 +440,6 @@ import { ClipboardModule } from 'ngx-clipboard';
444440
}
445441
)
446442
],
447-
providers: [
448-
{
449-
provide: HAMMER_GESTURE_CONFIG,
450-
useClass: CustomHammerConfig
451-
}
452-
],
453443
bootstrap: [DemoAppComponent]
454444
})
455445
export class DemoAppModule {}

projects/demos/app/hammer-config.ts

-28
This file was deleted.

projects/demos/polyfills.ts

-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@
1919
*/
2020

2121
import 'core-js/modules/es.object.entries';
22-
import 'hammerjs';
2322
import 'zone.js/dist/zone';

0 commit comments

Comments
 (0)