From 1e17b8d214c2cfa3c948350c62427b56d139e00b Mon Sep 17 00:00:00 2001 From: Corentin Roche Date: Fri, 28 Jun 2024 10:29:16 +0200 Subject: [PATCH 1/2] fix a bug where slide event do not trigger --- src/monthview.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/monthview.ts b/src/monthview.ts index 9838c576..b2aceb9b 100644 --- a/src/monthview.ts +++ b/src/monthview.ts @@ -201,12 +201,9 @@ export class MonthViewComponent implements ICalendarComponent, OnInit, OnDestroy ngAfterViewInit() { this.slider = new Swiper(this.swiperElement?.nativeElement, this.sliderOptions); let me = this; - this.slider.on('slideNextTransitionEnd', function() { - me.onSlideChanged(1); - }); - this.slider.on('slidePrevTransitionEnd', function() { - me.onSlideChanged(-1); + this.slider.on('transitionEnd', function(event) { + me.onSlideChanged(event.realIndex); }); if(this.dir == 'rtl') { @@ -221,8 +218,12 @@ export class MonthViewComponent implements ICalendarComponent, OnInit, OnDestroy this.slider = swiper; } - onSlideChanged(direction: number) { - this.currentViewIndex = (this.currentViewIndex + direction + 3) % 3; + onSlideChanged(newViewIndex: number) { + if (newViewIndex === this.currentViewIndex) { + return; + } + const direction = (newViewIndex === (this.currentViewIndex + 1) % 3) ? 1 : -1; + this.currentViewIndex = newViewIndex; this.move(direction); } From 58b44c29a9bf46db3f88bf12d356933fbd6e2380 Mon Sep 17 00:00:00 2001 From: Corentin Roche Date: Fri, 28 Jun 2024 11:19:11 +0200 Subject: [PATCH 2/2] v2.4.1 --- package-lock.json | 4 +-- package.json | 73 ++++++++++++++++++++++++----------------------- 2 files changed, 40 insertions(+), 37 deletions(-) diff --git a/package-lock.json b/package-lock.json index 68495a78..f7becc81 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ionic2-calendar", - "version": "2.3.0", + "version": "2.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ionic2-calendar", - "version": "2.3.0", + "version": "2.4.0", "license": "MIT", "dependencies": { "tslib": "^2.3.0" diff --git a/package.json b/package.json index 254a23e7..2a3e9459 100644 --- a/package.json +++ b/package.json @@ -1,37 +1,40 @@ { - "name": "ionic2-calendar", - "version": "2.4.0", - "description": "Ionic calendar component", - "keywords": [ - "Ionic", - "calendar" - ], - "author": { - "name": "twinssbc" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "git+https://github.com/twinssbc/Ionic2-Calendar.git" - }, - "scripts": { - "build": "rm -rf dist && ng build" - }, - "dependencies": { - "tslib": "^2.3.0" - }, - "peerDependencies": { - "@angular/common": "^17.0.2", - "@angular/core": "^17.0.2", - "@ionic/angular": "^7.0.0", - "swiper": "^11.0.0" - }, - "devDependencies": { - "@angular-devkit/build-angular": "^17.0.0", - "@angular/cli": "^17.0.0", - "@angular/compiler": "^17.0.2", - "@angular/compiler-cli": "^17.0.2", - "ng-packagr": "^17.0.0", - "typescript": "~5.2.2" - } + "name": "@cxfreeze/ionic-calendar", + "version": "2.4.1", + "description": "Ionic calendar component", + "keywords": [ + "Ionic", + "calendar" + ], + "author": "cxfreeze", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/cxFreeze/Ionic2-Calendar.git" + }, + "scripts": { + "build": "rm -rf dist && ng build" + }, + "dependencies": { + "tslib": "^2.3.0" + }, + "peerDependencies": { + "@angular/common": "^17.0.2", + "@angular/core": "^17.0.2", + "@ionic/angular": "^7.0.0", + "swiper": "^11.0.0" + }, + "devDependencies": { + "@angular-devkit/build-angular": "^17.0.0", + "@angular/cli": "^17.0.0", + "@angular/compiler": "^17.0.2", + "@angular/compiler-cli": "^17.0.2", + "ng-packagr": "^17.0.0", + "typescript": "~5.2.2" + }, + "bugs": { + "url": "https://github.com/cxFreeze/Ionic2-Calendar/issues" + }, + "homepage": "https://github.com/cxFreeze/Ionic2-Calendar#readme", + "main": "index.js" }