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" } 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); }