Skip to content

Commit

Permalink
release: 2.0.0-beta.7
Browse files Browse the repository at this point in the history
  • Loading branch information
hsuanxyz committed Sep 1, 2017
1 parent 3e931b3 commit dd29e09
Show file tree
Hide file tree
Showing 65 changed files with 980 additions and 594 deletions.
2 changes: 1 addition & 1 deletion demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.2",
"cordova-plugin-whitelist": "^1.3.1",
"ion2-calendar": "^2.0.0-beta.6",
"ion2-calendar": "^2.0.0-beta.7",
"ionic-angular": "3.6.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
Expand Down
44 changes: 42 additions & 2 deletions demo/src/pages/home/home.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ion-header>
<ion-navbar>
<ion-title>
DEMO
Dev
</ion-title>
</ion-navbar>
</ion-header>
Expand Down Expand Up @@ -33,9 +33,49 @@
<button ion-item (click)="optional()">
set the optional range
</button>
<button ion-item (click)="daysConfig ()">
<button ion-item (click)="daysConfig()">
days config
</button>

</ion-list>


<ion-card>
<ion-card-content>
<ion-card-title>
basic
</ion-card-title>
<ion-calendar [(ngModel)]="date"
[format]="format">
</ion-calendar>
<p>{{date}}</p>
</ion-card-content>
</ion-card>

<ion-card>
<ion-card-content>
<ion-card-title>
multi
</ion-card-title>
<ion-calendar [(ngModel)]="dateMulti"
[options]="optionsMulti"
[format]="format">
</ion-calendar>
<p>{{dateMulti | json}}</p>
</ion-card-content>
</ion-card>

<ion-card>
<ion-card-content>
<ion-card-title>
range
</ion-card-title>
<ion-calendar [(ngModel)]="dateRangeObj"
[options]="optionsRange"
[format]="format">
</ion-calendar>
<p>{{dateRangeObj | json}}</p>
</ion-card-content>
</ion-card>

</ion-content>
116 changes: 66 additions & 50 deletions demo/src/pages/home/home.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';

import {CalendarController, DayConfig} from 'ion2-calendar'
import { CalendarComponentOptions, CalendarController, DayConfig } from 'ion2-calendar'

@Component({
selector: 'page-home',
Expand All @@ -10,6 +10,18 @@ import {CalendarController, DayConfig} from 'ion2-calendar'
export class HomePage {

days: Array<any> = [];
date: string;
dateMulti = [];
dateRangeObj: any;
format = 'YYYY-MM-DD';
optionsMulti: CalendarComponentOptions = {
pickMode: 'multi'
};
optionsRange: CalendarComponentOptions = {
from: new Date(2000, 0),
to: new Date(2020, 11, 31),
pickMode: 'range'
};

constructor(public navCtrl: NavController,
public calendarCtrl: CalendarController,) {
Expand All @@ -21,40 +33,41 @@ export class HomePage {
this.calendarCtrl.openCalendar({
title: 'BASIC',
canBackwardsSelected: true,
color: 'dark',
color: 'cal-color',
doneIcon: true,
closeIcon: true
})
.then((res: any) => {
console.log(res)
})
.catch(() => {
});
.then((res: any) => {
console.log(res)
})
.catch(() => {
});
}

multi() {
this.calendarCtrl.openCalendar({
pickMode: 'multi',
title: 'MULTI',
defaultDates: [new Date(2017, 7, 20), new Date(2017, 7, 18).getTime()]
})
.then((res: any) => {
console.log(res)
})
.catch(() => {
});
.then((res: any) => {
console.log(res)
})
.catch(() => {
});
}

setDefaultDate() {
this.calendarCtrl.openCalendar({
from: new Date(2017, 1, 1),
defaultDate: new Date(2017, 4, 1),
defaultScrollTo: new Date(2017, 4, 1),

})
.then((res: any) => {
console.log(res)
})
.catch(() => {
})
.then((res: any) => {
console.log(res)
})
.catch(() => {
})
}


Expand All @@ -65,11 +78,11 @@ export class HomePage {
pickMode: 'range',
autoDone: true
})
.then((res: any) => {
console.log(res)
})
.catch(() => {
})
.then((res: any) => {
console.log(res)
})
.catch(() => {
})
}

dateRange() {
Expand All @@ -79,48 +92,51 @@ export class HomePage {
canBackwardsSelected: true,
color: 'danger'
})
.then((res: any) => {
console.log(res)
})
.catch(() => {
})
.then((res: any) => {
console.log(res)
})
.catch(() => {
})
}

optional() {
this.calendarCtrl.openCalendar({
from: new Date(2017, 1, 1),
to: new Date(2017, 2, 5),
})
.then((res: any) => {
console.log(res)
})
.catch(() => {
})
.then((res: any) => {
console.log(res)
})
.catch(() => {
})
}

disableWeekdays() {
this.calendarCtrl.openCalendar({
disableWeeks: [0, 6],
canBackwardsSelected: true,
})
.then((res: any) => {
console.log(res)
})
.catch(() => {
})
.then((res: any) => {
console.log(res)
})
.catch(() => {
})
}

local() {

this.calendarCtrl.openCalendar({
monthFormat: 'yyyy 年 MM 月 ',
weekdays: ['天', '一', '二', '三', '四', '五', '六'],
weekStart: 1,
color: 'light',
defaultDate: new Date()
})
.then((res: any) => {
console.log(res)
})
.catch(() => {
})
.then((res: any) => {
console.log(res)
})
.catch(() => {
})
}

daysConfig() {
Expand Down Expand Up @@ -170,12 +186,12 @@ export class HomePage {
daysConfig: _daysConfig,
cssClass: 'my-cal',
})
.then((res: any) => {
console.log(res)
})
.then((res: any) => {
console.log(res)
})

.catch(() => {
})
.catch(() => {
})
}

}
3 changes: 2 additions & 1 deletion demo/src/theme/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ $colors: (
secondary: #32db64,
danger: #f53d3d,
light: #f4f4f4,
dark: #222
dark: #222,
cal-color: #ff8732
);


Expand Down
Loading

0 comments on commit dd29e09

Please sign in to comment.