ion2-calendar
Advanced tools
Comparing version 2.1.7 to 2.2.0
import { OnInit, EventEmitter, Provider } from '@angular/core'; | ||
import { CalendarComponentOptions, CalendarDay, CalendarComponentPayloadTypes, CalendarComponentMonthChange, CalendarComponentTypeProperty } from '../calendar.model'; | ||
import { CalendarMonth, CalendarModalOptions, CalendarComponentOptions, CalendarDay, CalendarComponentPayloadTypes, CalendarComponentMonthChange, CalendarComponentTypeProperty } from '../calendar.model'; | ||
import { CalendarService } from "../services/calendar.service"; | ||
@@ -8,11 +8,11 @@ import { ControlValueAccessor } from '@angular/forms'; | ||
calSvc: CalendarService; | ||
private _d; | ||
private _options; | ||
private _view; | ||
private _calendarMonthValue; | ||
private _showToggleButtons; | ||
_d: CalendarModalOptions; | ||
_options: CalendarComponentOptions; | ||
_view: 'month' | 'days'; | ||
_calendarMonthValue: CalendarDay[]; | ||
_showToggleButtons: boolean; | ||
showToggleButtons: boolean; | ||
private _showMonthPicker; | ||
_showMonthPicker: boolean; | ||
showMonthPicker: boolean; | ||
private monthOpt; | ||
monthOpt: CalendarMonth; | ||
format: string; | ||
@@ -48,9 +48,9 @@ type: CalendarComponentTypeProperty; | ||
private initOpt(); | ||
private createMonth(date); | ||
private _createCalendarDay(value); | ||
private _handleType(value); | ||
createMonth(date: number): CalendarMonth; | ||
_createCalendarDay(value: CalendarComponentPayloadTypes): CalendarDay; | ||
_handleType(value: number): CalendarComponentPayloadTypes; | ||
writeValue(obj: any): void; | ||
registerOnChange(fn: () => {}): void; | ||
registerOnTouched(fn: () => {}): void; | ||
private _writeValue(value); | ||
_writeValue(value: any): void; | ||
} |
@@ -23,5 +23,6 @@ import { ElementRef, ChangeDetectorRef, Renderer2, OnInit } from '@angular/core'; | ||
_d: CalendarModalOptions; | ||
actualFirstTime: number; | ||
constructor(_renderer: Renderer2, _elementRef: ElementRef, params: NavParams, viewCtrl: ViewController, ref: ChangeDetectorRef, calSvc: CalendarService); | ||
ngOnInit(): void; | ||
ionViewDidLoad(): void; | ||
ngAfterViewInit(): void; | ||
init(): void; | ||
@@ -36,2 +37,3 @@ initDefaultDate(): void; | ||
backwardsMonth(): void; | ||
scrollToDate(date: Date): void; | ||
scrollToDefaultDate(): void; | ||
@@ -38,0 +40,0 @@ onScroll($event: any): void; |
@@ -23,4 +23,6 @@ "use strict"; | ||
}; | ||
CalendarModal.prototype.ionViewDidLoad = function () { | ||
CalendarModal.prototype.ngAfterViewInit = function () { | ||
this.findCssClass(); | ||
if (this._d.canBackwardsSelected) | ||
this.backwardsMonth(); | ||
this.scrollToDefaultDate(); | ||
@@ -126,3 +128,3 @@ }; | ||
} | ||
var firstTime = moment(first.original.time).subtract(1, 'M').valueOf(); | ||
var firstTime = this.actualFirstTime = moment(first.original.time).subtract(1, 'M').valueOf(); | ||
(_a = this.calendarMonths).unshift.apply(_a, this.calSvc.createMonthsByPeriod(firstTime, 1, this._d)); | ||
@@ -132,7 +134,8 @@ this.ref.detectChanges(); | ||
}; | ||
CalendarModal.prototype.scrollToDefaultDate = function () { | ||
CalendarModal.prototype.scrollToDate = function (date) { | ||
var _this = this; | ||
var defaultDateIndex = this.findInitMonthNumber(this._d.defaultScrollTo); | ||
var defaultDateMonth = this.monthsEle.nativeElement.children["month-" + defaultDateIndex].offsetTop; | ||
if (defaultDateIndex === 0 || defaultDateMonth === 0) | ||
var defaultDateIndex = this.findInitMonthNumber(date); | ||
var monthElement = this.monthsEle.nativeElement.children["month-" + defaultDateIndex]; | ||
var defaultDateMonth = monthElement ? monthElement.offsetTop : 0; | ||
if (defaultDateIndex === -1 || defaultDateMonth === 0) | ||
return; | ||
@@ -143,2 +146,5 @@ setTimeout(function () { | ||
}; | ||
CalendarModal.prototype.scrollToDefaultDate = function () { | ||
this.scrollToDate(this._d.defaultScrollTo); | ||
}; | ||
CalendarModal.prototype.onScroll = function ($event) { | ||
@@ -148,3 +154,3 @@ var _this = this; | ||
return; | ||
if ($event.scrollTop <= 200 && this._s) { | ||
if ($event.scrollTop <= 200 && $event.directionY === "up" && this._s) { | ||
this._s = !1; | ||
@@ -163,7 +169,7 @@ var lastHeight_1 = this.content.getContentDimensions().scrollHeight; | ||
CalendarModal.prototype.findInitMonthNumber = function (date) { | ||
var startDate = moment(this._d.from); | ||
var startDate = this.actualFirstTime ? moment(this.actualFirstTime) : moment(this._d.from); | ||
var defaultScrollTo = moment(date); | ||
var isAfter = defaultScrollTo.isAfter(startDate); | ||
if (!isAfter) | ||
return 0; | ||
return -1; | ||
if (this.showYearPicker) { | ||
@@ -186,3 +192,3 @@ startDate = moment(new Date(this.year, 0, 1)); | ||
selector: 'ion-calendar-modal', | ||
template: "\n <ion-header>\n <ion-navbar [color]=\"_d.color\">\n\n <ion-buttons start>\n <button type='button' ion-button icon-only clear (click)=\"onCancel()\">\n <span *ngIf=\"_d.closeLabel !== '' && !_d.closeIcon\">{{_d.closeLabel}}</span>\n <ion-icon *ngIf=\"_d.closeIcon\" name=\"close\"></ion-icon>\n </button>\n </ion-buttons>\n\n <ion-title>{{_d.title}}</ion-title>\n\n <ion-buttons end>\n <button type='button' ion-button icon-only *ngIf=\"!_d.autoDone\" clear [disabled]=\"!canDone()\" (click)=\"done()\">\n <span *ngIf=\"_d.doneLabel !== '' && !_d.doneIcon\">{{_d.doneLabel}}</span>\n <ion-icon *ngIf=\"_d.doneIcon\" name=\"checkmark\"></ion-icon>\n </button>\n\n </ion-buttons>\n\n </ion-navbar>\n\n <ion-calendar-week\n [color]=\"_d.color\"\n [weekArray]=\"_d.weekdays\"\n [weekStart]=\"_d.weekStart\">\n </ion-calendar-week>\n\n </ion-header>\n\n <ion-content (ionScroll)=\"onScroll($event)\" class=\"calendar-page\"\n [ngClass]=\"{'multi-selection': _d.pickMode === 'multi'}\">\n\n <div #months>\n <ng-template ngFor let-month [ngForOf]=\"calendarMonths\" [ngForTrackBy]=\"trackByIndex\" let-i=\"index\">\n <div class=\"month-box\" [attr.id]=\"'month-' + i\">\n <h4 class=\"text-center month-title\">{{_monthFormat(month.original.date)}}</h4>\n <ion-calendar-month [month]=\"month\"\n [pickMode]=\"_d.pickMode\"\n [isSaveHistory]=\"_d.isSaveHistory\"\n [id]=\"_d.id\"\n [color]=\"_d.color\"\n (onChange)=\"onChange($event)\"\n [(ngModel)]=\"datesTemp\">\n\n </ion-calendar-month>\n </div>\n </ng-template>\n\n </div>\n\n <ion-infinite-scroll (ionInfinite)=\"nextMonth($event)\">\n <ion-infinite-scroll-content></ion-infinite-scroll-content>\n </ion-infinite-scroll>\n\n </ion-content>\n " | ||
template: "\n <ion-header>\n <ion-navbar [color]=\"_d.color\">\n\n <ion-buttons start>\n <button type='button' ion-button icon-only clear (click)=\"onCancel()\">\n <span *ngIf=\"_d.closeLabel !== '' && !_d.closeIcon\">{{_d.closeLabel}}</span>\n <ion-icon *ngIf=\"_d.closeIcon\" name=\"close\"></ion-icon>\n </button>\n </ion-buttons>\n\n <ion-title>{{_d.title}}</ion-title>\n\n <ion-buttons end>\n <button type='button' ion-button icon-only *ngIf=\"!_d.autoDone\" clear [disabled]=\"!canDone()\" (click)=\"done()\">\n <span *ngIf=\"_d.doneLabel !== '' && !_d.doneIcon\">{{_d.doneLabel}}</span>\n <ion-icon *ngIf=\"_d.doneIcon\" name=\"checkmark\"></ion-icon>\n </button>\n\n </ion-buttons>\n\n </ion-navbar>\n \n <ng-content select=\"[sub-header]\"></ng-content>\n\n <ion-calendar-week\n [color]=\"_d.color\"\n [weekArray]=\"_d.weekdays\"\n [weekStart]=\"_d.weekStart\">\n </ion-calendar-week>\n\n </ion-header>\n\n <ion-content (ionScroll)=\"onScroll($event)\" class=\"calendar-page\"\n [ngClass]=\"{'multi-selection': _d.pickMode === 'multi'}\">\n\n <div #months>\n <ng-template ngFor let-month [ngForOf]=\"calendarMonths\" [ngForTrackBy]=\"trackByIndex\" let-i=\"index\">\n <div class=\"month-box\" [attr.id]=\"'month-' + i\">\n <h4 class=\"text-center month-title\">{{_monthFormat(month.original.date)}}</h4>\n <ion-calendar-month [month]=\"month\"\n [pickMode]=\"_d.pickMode\"\n [isSaveHistory]=\"_d.isSaveHistory\"\n [id]=\"_d.id\"\n [color]=\"_d.color\"\n (onChange)=\"onChange($event)\"\n [(ngModel)]=\"datesTemp\">\n\n </ion-calendar-month>\n </div>\n </ng-template>\n\n </div>\n\n <ion-infinite-scroll (ionInfinite)=\"nextMonth($event)\">\n <ion-infinite-scroll-content></ion-infinite-scroll-content>\n </ion-infinite-scroll>\n\n </ion-content>\n " | ||
},] }, | ||
@@ -189,0 +195,0 @@ ]; |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"CalendarModal":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":7,"character":1},"arguments":[{"selector":"ion-calendar-modal","template":"\n <ion-header>\n <ion-navbar [color]=\"_d.color\">\n\n <ion-buttons start>\n <button type='button' ion-button icon-only clear (click)=\"onCancel()\">\n <span *ngIf=\"_d.closeLabel !== '' && !_d.closeIcon\">{{_d.closeLabel}}</span>\n <ion-icon *ngIf=\"_d.closeIcon\" name=\"close\"></ion-icon>\n </button>\n </ion-buttons>\n\n <ion-title>{{_d.title}}</ion-title>\n\n <ion-buttons end>\n <button type='button' ion-button icon-only *ngIf=\"!_d.autoDone\" clear [disabled]=\"!canDone()\" (click)=\"done()\">\n <span *ngIf=\"_d.doneLabel !== '' && !_d.doneIcon\">{{_d.doneLabel}}</span>\n <ion-icon *ngIf=\"_d.doneIcon\" name=\"checkmark\"></ion-icon>\n </button>\n\n </ion-buttons>\n\n </ion-navbar>\n\n <ion-calendar-week\n [color]=\"_d.color\"\n [weekArray]=\"_d.weekdays\"\n [weekStart]=\"_d.weekStart\">\n </ion-calendar-week>\n\n </ion-header>\n\n <ion-content (ionScroll)=\"onScroll($event)\" class=\"calendar-page\"\n [ngClass]=\"{'multi-selection': _d.pickMode === 'multi'}\">\n\n <div #months>\n <ng-template ngFor let-month [ngForOf]=\"calendarMonths\" [ngForTrackBy]=\"trackByIndex\" let-i=\"index\">\n <div class=\"month-box\" [attr.id]=\"'month-' + i\">\n <h4 class=\"text-center month-title\">{{_monthFormat(month.original.date)}}</h4>\n <ion-calendar-month [month]=\"month\"\n [pickMode]=\"_d.pickMode\"\n [isSaveHistory]=\"_d.isSaveHistory\"\n [id]=\"_d.id\"\n [color]=\"_d.color\"\n (onChange)=\"onChange($event)\"\n [(ngModel)]=\"datesTemp\">\n\n </ion-calendar-month>\n </div>\n </ng-template>\n\n </div>\n\n <ion-infinite-scroll (ionInfinite)=\"nextMonth($event)\">\n <ion-infinite-scroll-content></ion-infinite-scroll-content>\n </ion-infinite-scroll>\n\n </ion-content>\n "}]}],"members":{"content":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":70,"character":3},"arguments":[{"__symbolic":"reference","module":"ionic-angular","name":"Content","line":70,"character":13}]}]}],"monthsEle":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":71,"character":3},"arguments":["months"]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"Renderer2","line":83,"character":33},{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":84,"character":34},{"__symbolic":"reference","module":"ionic-angular","name":"NavParams","line":85,"character":29},{"__symbolic":"reference","module":"ionic-angular","name":"ViewController","line":86,"character":31},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":87,"character":26},{"__symbolic":"reference","module":"../services/calendar.service","name":"CalendarService","line":88,"character":29}]}],"ngOnInit":[{"__symbolic":"method"}],"ionViewDidLoad":[{"__symbolic":"method"}],"init":[{"__symbolic":"method"}],"initDefaultDate":[{"__symbolic":"method"}],"findCssClass":[{"__symbolic":"method"}],"onChange":[{"__symbolic":"method"}],"onCancel":[{"__symbolic":"method"}],"done":[{"__symbolic":"method"}],"canDone":[{"__symbolic":"method"}],"nextMonth":[{"__symbolic":"method"}],"backwardsMonth":[{"__symbolic":"method"}],"scrollToDefaultDate":[{"__symbolic":"method"}],"onScroll":[{"__symbolic":"method"}],"findInitMonthNumber":[{"__symbolic":"method"}],"_getDayTime":[{"__symbolic":"method"}],"_monthFormat":[{"__symbolic":"method"}],"trackByIndex":[{"__symbolic":"method"}]}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"CalendarModal":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":7,"character":1},"arguments":[{"selector":"ion-calendar-modal","template":"\n <ion-header>\n <ion-navbar [color]=\"_d.color\">\n\n <ion-buttons start>\n <button type='button' ion-button icon-only clear (click)=\"onCancel()\">\n <span *ngIf=\"_d.closeLabel !== '' && !_d.closeIcon\">{{_d.closeLabel}}</span>\n <ion-icon *ngIf=\"_d.closeIcon\" name=\"close\"></ion-icon>\n </button>\n </ion-buttons>\n\n <ion-title>{{_d.title}}</ion-title>\n\n <ion-buttons end>\n <button type='button' ion-button icon-only *ngIf=\"!_d.autoDone\" clear [disabled]=\"!canDone()\" (click)=\"done()\">\n <span *ngIf=\"_d.doneLabel !== '' && !_d.doneIcon\">{{_d.doneLabel}}</span>\n <ion-icon *ngIf=\"_d.doneIcon\" name=\"checkmark\"></ion-icon>\n </button>\n\n </ion-buttons>\n\n </ion-navbar>\n \n <ng-content select=\"[sub-header]\"></ng-content>\n\n <ion-calendar-week\n [color]=\"_d.color\"\n [weekArray]=\"_d.weekdays\"\n [weekStart]=\"_d.weekStart\">\n </ion-calendar-week>\n\n </ion-header>\n\n <ion-content (ionScroll)=\"onScroll($event)\" class=\"calendar-page\"\n [ngClass]=\"{'multi-selection': _d.pickMode === 'multi'}\">\n\n <div #months>\n <ng-template ngFor let-month [ngForOf]=\"calendarMonths\" [ngForTrackBy]=\"trackByIndex\" let-i=\"index\">\n <div class=\"month-box\" [attr.id]=\"'month-' + i\">\n <h4 class=\"text-center month-title\">{{_monthFormat(month.original.date)}}</h4>\n <ion-calendar-month [month]=\"month\"\n [pickMode]=\"_d.pickMode\"\n [isSaveHistory]=\"_d.isSaveHistory\"\n [id]=\"_d.id\"\n [color]=\"_d.color\"\n (onChange)=\"onChange($event)\"\n [(ngModel)]=\"datesTemp\">\n\n </ion-calendar-month>\n </div>\n </ng-template>\n\n </div>\n\n <ion-infinite-scroll (ionInfinite)=\"nextMonth($event)\">\n <ion-infinite-scroll-content></ion-infinite-scroll-content>\n </ion-infinite-scroll>\n\n </ion-content>\n "}]}],"members":{"content":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":72,"character":3},"arguments":[{"__symbolic":"reference","module":"ionic-angular","name":"Content","line":72,"character":13}]}]}],"monthsEle":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":73,"character":3},"arguments":["months"]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"Renderer2","line":86,"character":33},{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":87,"character":24},{"__symbolic":"reference","module":"ionic-angular","name":"NavParams","line":88,"character":19},{"__symbolic":"reference","module":"ionic-angular","name":"ViewController","line":89,"character":21},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":90,"character":16},{"__symbolic":"reference","module":"../services/calendar.service","name":"CalendarService","line":91,"character":19}]}],"ngOnInit":[{"__symbolic":"method"}],"ngAfterViewInit":[{"__symbolic":"method"}],"init":[{"__symbolic":"method"}],"initDefaultDate":[{"__symbolic":"method"}],"findCssClass":[{"__symbolic":"method"}],"onChange":[{"__symbolic":"method"}],"onCancel":[{"__symbolic":"method"}],"done":[{"__symbolic":"method"}],"canDone":[{"__symbolic":"method"}],"nextMonth":[{"__symbolic":"method"}],"backwardsMonth":[{"__symbolic":"method"}],"scrollToDate":[{"__symbolic":"method"}],"scrollToDefaultDate":[{"__symbolic":"method"}],"onScroll":[{"__symbolic":"method"}],"findInitMonthNumber":[{"__symbolic":"method"}],"_getDayTime":[{"__symbolic":"method"}],"_monthFormat":[{"__symbolic":"method"}],"trackByIndex":[{"__symbolic":"method"}]}}}}] |
{ | ||
"name": "ion2-calendar", | ||
"version": "2.1.7", | ||
"version": "2.2.0", | ||
"description": "A date picker component for ionic2 ", | ||
@@ -61,3 +61,5 @@ "main": "./dist/index.js", | ||
"entryFile": "src/index.ts", | ||
"styleIncludePaths": [""], | ||
"styleIncludePaths": [ | ||
"" | ||
], | ||
"umdModuleIds": { | ||
@@ -64,0 +66,0 @@ "moment": "moment" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
163239
61
1486