mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Merge branch 'master' into item-buttons
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import {Platform, Page, ActionSheet} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {Platform, Page, ActionSheet, NavController} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
@@ -9,12 +9,18 @@ import {AndroidAttribute} from '../../helpers';
|
||||
})
|
||||
export class BasicPage {
|
||||
|
||||
constructor(actionSheet: ActionSheet, platform: Platform) {
|
||||
this.actionSheet = actionSheet;
|
||||
constructor(platform: Platform, nav: NavController) {
|
||||
this.nav = nav;
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
openMenu() {
|
||||
let buttonHandler = (index) => {
|
||||
console.log('Button clicked', index);
|
||||
if (index == 1) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.platform.is('android')) {
|
||||
var androidSheet = {
|
||||
|
||||
@@ -40,38 +46,44 @@ export class BasicPage {
|
||||
};
|
||||
}
|
||||
|
||||
this.actionSheet.open(androidSheet || {
|
||||
this.actionSheet = ActionSheet.create(androidSheet || {
|
||||
title: 'Albums',
|
||||
buttons: [
|
||||
{ text: 'Share'},
|
||||
{ text: 'Play'},
|
||||
{ text: 'Favorite'}
|
||||
{
|
||||
text: 'Share',
|
||||
handler: buttonHandler
|
||||
},
|
||||
{
|
||||
text: 'Play',
|
||||
handler: buttonHandler
|
||||
},
|
||||
{
|
||||
text: 'Favorite',
|
||||
handler: buttonHandler
|
||||
},
|
||||
{
|
||||
text: 'Delete',
|
||||
style: 'destructive',
|
||||
handler: () => {
|
||||
console.log('Destructive clicked');
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Cancel',
|
||||
style: 'cancel',
|
||||
handler: () => {
|
||||
console.log('Canceled');
|
||||
}
|
||||
}
|
||||
],
|
||||
destructiveText: 'Delete',
|
||||
titleText: 'Albums',
|
||||
cancelText: 'Cancel',
|
||||
cancel: () => {
|
||||
console.log('Canceled');
|
||||
},
|
||||
destructiveButtonClicked: () => {
|
||||
console.log('Destructive clicked');
|
||||
},
|
||||
buttonClicked: (index) => {
|
||||
console.log('Button clicked', index);
|
||||
if (index == 1) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
}).then(actionSheetRef => {
|
||||
console.log(actionSheetRef);
|
||||
this.actionSheetRef = actionSheetRef;
|
||||
});
|
||||
|
||||
this.nav.present(this.actionSheet);
|
||||
}
|
||||
|
||||
onPageWillLeave() {
|
||||
let actionSheet = this.actionSheet.get();
|
||||
if (actionSheet) {
|
||||
actionSheet.close();
|
||||
}
|
||||
this.actionSheet && this.actionSheet.dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<ion-list>
|
||||
|
||||
<button ion-item *ng-for="#p of pages" (click)="openPage(p)">
|
||||
<button ion-item *ngFor="#p of pages" (click)="openPage(p)">
|
||||
{{p.title}}
|
||||
</button>
|
||||
|
||||
@@ -29,4 +29,3 @@
|
||||
|
||||
<ion-nav id="nav" [root]="rootPage" #content></ion-nav>
|
||||
|
||||
<ion-overlay></ion-overlay>
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Directive, ElementRef, Renderer} from 'angular2/angular2';
|
||||
import {Directive, ElementRef, Renderer} from 'angular2/core';
|
||||
import {Platform, Navbar} from 'ionic/ionic';
|
||||
|
||||
import * as actionSheets from './action-sheets/action-sheets';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -10,7 +10,7 @@ import * as helpers from './helpers';
|
||||
config: {
|
||||
platforms: {
|
||||
android: {
|
||||
activator: 'ripple'
|
||||
activator: 'ripple'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,10 +35,17 @@ class DemoApp {
|
||||
this.platform.ready().then(() => {
|
||||
|
||||
window.addEventListener('message', (e) => {
|
||||
|
||||
//TODO(@drewrygh)
|
||||
e = {};
|
||||
e.data = '{}';
|
||||
zone.run(() => {
|
||||
if (e.data) {
|
||||
var data = JSON.parse(e.data);
|
||||
var data;
|
||||
try {
|
||||
data = JSON.parse(e.data);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
if (data.hash) {
|
||||
this.nextPage = helpers.getPageFor(data.hash.replace('#', ''));
|
||||
if (data.hash !== 'menus') {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {App, IonicApp, Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import * as helpers from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
<ion-content>
|
||||
<ion-searchbar [(ng-model)]="searchQuery"></ion-searchbar>
|
||||
<ion-list #list>
|
||||
<ion-item *ng-for="#item of getItems()">
|
||||
<ion-item *ngFor="#item of getItems()">
|
||||
{{item}}
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
</ion-content>
|
||||
</ion-content>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page, Platform} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {FORM_DIRECTIVES, FormBuilder, forwardRef, Validators, Control, ControlGroup} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {FORM_DIRECTIVES, FormBuilder, Validators, Control, ControlGroup} from 'angular2/common';
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {App, IonicApp, Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import * as helpers from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<p>{{character.quote}}</p>
|
||||
</ion-item>
|
||||
|
||||
<ion-item *ng-for="#item of character['items']">
|
||||
<ion-item *ngFor="#item of character['items']">
|
||||
{{item.title}}
|
||||
<ion-note item-right>
|
||||
{{item.note}}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {App, IonicApp, Animation, Modal, Platform, NavController, NavParams, Page, Events} from 'ionic/ionic';
|
||||
import {forwardRef, NgFor} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {NgFor} from 'angular2/common';
|
||||
import * as helpers from '../../helpers';
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {NavController, NavParams} from 'ionic/ionic';
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import * as helpers from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Page, Popup} from 'ionic/ionic';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {NavController, NavParams} from 'ionic/ionic';
|
||||
import {Page, ViewController, Platform} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import * as helpers from '../../helpers';
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {NavController, NavParams} from 'ionic/ionic';
|
||||
import {Page, ViewController, Platform} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import * as helpers from '../../helpers';
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {NavController, NavParams} from 'ionic/ionic';
|
||||
import {Page, ViewController, Platform} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import {forwardRef} from 'angular2/core';
|
||||
import * as helpers from '../../helpers';
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {Component, Control, ControlGroup} from 'angular2/angular2';
|
||||
import {Component} from 'angular2/core';
|
||||
import {Control, ControlGroup} from 'angular2/common';
|
||||
|
||||
import {IonicApp, App} from 'ionic/ionic';
|
||||
import {Translate, TranslatePipe} from 'ionic/ionic';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Component, Directive} from 'angular2/angular2';
|
||||
import {Component, Directive} from 'angular2/core';
|
||||
|
||||
import {App, ActionSheet, IonicApp, IonicView, Register} from 'ionic/ionic';
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {Component, Control, ControlGroup} from 'angular2/angular2';
|
||||
import {Component} from 'angular2/core';
|
||||
import {Control, ControlGroup} from 'angular2/common';
|
||||
|
||||
import {IonicApp, App} from 'ionic/ionic';
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {Component, Control, ControlGroup} from 'angular2/angular2';
|
||||
import {Component} from 'angular2/core';
|
||||
import {Control, ControlGroup} from 'angular2/common';
|
||||
|
||||
import {App, Storage, LocalStorage, SqlStorage} from 'ionic/ionic';
|
||||
|
||||
|
||||
72
gulpfile.js
72
gulpfile.js
@@ -63,7 +63,7 @@ var babelOptions = {
|
||||
}
|
||||
}
|
||||
|
||||
gulp.task('build', ['bundle.system', 'e2e.build', 'copy.web-animations', 'sass', 'fonts']);
|
||||
gulp.task('build', ['bundle.system', 'e2e.build', 'sass', 'fonts']);
|
||||
|
||||
gulp.task('clean.build', function(done) {
|
||||
runSequence('clean', 'build', done);
|
||||
@@ -272,15 +272,15 @@ gulp.task('e2e.build', function() {
|
||||
.pipe(cache('e2e.files'))
|
||||
|
||||
return merge([
|
||||
tsResult,
|
||||
testFiles
|
||||
])
|
||||
.pipe(rename(function(file) {
|
||||
var sep = path.sep;
|
||||
file.dirname = file.dirname.replace(sep + 'test' + sep, sep);
|
||||
}))
|
||||
.pipe(gulp.dest('dist/e2e/'))
|
||||
.pipe(connect.reload());
|
||||
tsResult,
|
||||
testFiles
|
||||
])
|
||||
.pipe(rename(function(file) {
|
||||
var sep = path.sep;
|
||||
file.dirname = file.dirname.replace(sep + 'test' + sep, sep);
|
||||
}))
|
||||
.pipe(gulp.dest('dist/e2e/'))
|
||||
.pipe(connect.reload());
|
||||
|
||||
function createIndexHTML() {
|
||||
return through2.obj(function(file, enc, next) {
|
||||
@@ -457,32 +457,40 @@ require('./scripts/docs/gulp-tasks')(gulp, flags)
|
||||
|
||||
gulp.task('build.demos', function(){
|
||||
var gulpif = require('gulp-if');
|
||||
var lazypipe = require('lazypipe');
|
||||
var merge = require('merge2');
|
||||
var _ = require('lodash');
|
||||
var fs = require('fs');
|
||||
var VinylFile = require('vinyl');
|
||||
|
||||
var buildTest = lazypipe()
|
||||
.pipe(tsc, tscOptions, undefined, tscReporter)
|
||||
.pipe(babel, getBabelOptions('demos', 'common'))
|
||||
// .pipe(babel, getBabelOptions('demos'))
|
||||
|
||||
var baseIndexTemplate = _.template(fs.readFileSync('scripts/demos/index.template.html'))();
|
||||
var docsIndexTemplate = _.template(fs.readFileSync('scripts/demos/docs.index.template.html'))();
|
||||
|
||||
return gulp.src(['demos/**/*'])
|
||||
.pipe(cache('demos', { optimizeMemory: true }))
|
||||
.pipe(gulpif(/.ts$/, buildTest()))
|
||||
var tsResult = gulp.src(['demos/**/*.ts'])
|
||||
.pipe(cache('demos.ts'))
|
||||
.pipe(tsc(tscOptionsNoTypeCheck, undefined, tscReporter))
|
||||
.on('error', function(error) {
|
||||
console.log(error.message);
|
||||
this.emit('end');
|
||||
})
|
||||
.pipe(gulpif(/index.js$/, createIndexHTML())) //TSC changes .ts to .js
|
||||
|
||||
var demoFiles = gulp.src([
|
||||
'demos/**/*',
|
||||
'!demos/**/*.ts'
|
||||
])
|
||||
.pipe(cache('demos.files'));
|
||||
|
||||
return merge([
|
||||
tsResult,
|
||||
demoFiles
|
||||
])
|
||||
.pipe(gulp.dest('dist/demos'))
|
||||
.pipe(connect.reload());
|
||||
|
||||
function createIndexHTML() {
|
||||
return through2.obj(function(file, enc, next) {
|
||||
var indexTemplate = baseIndexTemplate;
|
||||
var customTemplateFp = file.path.split('/').slice(0, -1).join('/') + '/index.html';
|
||||
if (file.path.indexOf('component-docs') > -1) {
|
||||
indexTemplate = docsIndexTemplate;
|
||||
} else if (fs.existsSync(customTemplateFp)) {
|
||||
if (fs.existsSync(customTemplateFp)) {
|
||||
indexTemplate = _.template(fs.readFileSync(customTemplateFp))();
|
||||
}
|
||||
this.push(new VinylFile({
|
||||
@@ -510,7 +518,7 @@ gulp.task('sass.demos:components', function() {
|
||||
.pipe(gulp.dest('../ionic-site/docs/v2/demos/component-docs/'));
|
||||
});
|
||||
|
||||
gulp.task('bundle.demos:api', ['build.demos'], function(done) {
|
||||
gulp.task('bundle.demos:api', ['build.demos', 'transpile.no-typecheck', 'copy.web-animations', 'sass', 'fonts'], function(done) {
|
||||
return buildDemoBundle({demo: 'api'}, done);
|
||||
});
|
||||
|
||||
@@ -559,14 +567,14 @@ function buildDemoBundle(opts, done) {
|
||||
}
|
||||
|
||||
webpack(config, function(err, stats){
|
||||
// var statsOptions = {
|
||||
// 'colors': true,
|
||||
// 'modules': true,
|
||||
// 'chunks': false,
|
||||
// 'exclude': ['node_modules'],
|
||||
// 'errorDetails': true
|
||||
// }
|
||||
// console.log(stats.toString(statsOptions));
|
||||
var statsOptions = {
|
||||
'colors': true,
|
||||
'modules': false,
|
||||
'chunks': false,
|
||||
'exclude': ['node_modules'],
|
||||
'errorDetails': true
|
||||
}
|
||||
console.log(stats.toString(statsOptions));
|
||||
if (--numTasks === 0) done();
|
||||
})
|
||||
})
|
||||
|
||||
@@ -4,7 +4,6 @@ import {Title} from 'angular2/platform/browser';
|
||||
import {Config} from '../../config/config';
|
||||
import {ClickBlock} from '../../util/click-block';
|
||||
import {rafFrames} from '../../util/dom';
|
||||
import {ScrollTo} from '../../animations/scroll-to';
|
||||
|
||||
|
||||
/**
|
||||
@@ -15,20 +14,21 @@ import {ScrollTo} from '../../animations/scroll-to';
|
||||
@Injectable()
|
||||
export class IonicApp {
|
||||
|
||||
constructor(config: Config, clickBlock: ClickBlock, zone: NgZone) {
|
||||
this._config = config;
|
||||
this._zone = zone;
|
||||
constructor(
|
||||
private _config: Config,
|
||||
private _clickBlock: ClickBlock,
|
||||
private _zone: NgZone
|
||||
) {
|
||||
this._titleSrv = new Title();
|
||||
this._title = '';
|
||||
this._disTime = 0;
|
||||
this._clickBlock = clickBlock;
|
||||
this._scrollTime = 0;
|
||||
|
||||
// Our component registry map
|
||||
this.components = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* Sets the document title.
|
||||
* @param {string} val Value to set the document title to.
|
||||
*/
|
||||
@@ -75,6 +75,22 @@ export class IonicApp {
|
||||
return (this._disTime < Date.now());
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
setScrolling() {
|
||||
this._scrollTime = Date.now();
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* Boolean if the app is actively scrolling or not.
|
||||
* @return {bool}
|
||||
*/
|
||||
isScrolling() {
|
||||
return (this._scrollTime + 64 > Date.now());
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* Register a known component with a key, for easy lookups later.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {Component, ElementRef, Optional, NgZone} from 'angular2/core';
|
||||
|
||||
import {Ion} from '../ion';
|
||||
import {IonicApp} from '../app/app';
|
||||
import {Config} from '../../config/config';
|
||||
import {raf} from '../../util/dom';
|
||||
import {Keyboard} from '../../util/keyboard';
|
||||
import {ViewController} from '../nav/view-controller';
|
||||
import {Animation} from '../../animations/animation';
|
||||
import {ScrollTo} from '../../animations/scroll-to';
|
||||
@@ -37,10 +37,15 @@ export class Content extends Ion {
|
||||
* @param {ElementRef} elementRef A reference to the component's DOM element.
|
||||
* @param {Config} config The config object to change content's default settings.
|
||||
*/
|
||||
constructor(elementRef: ElementRef, config: Config, keyboard: Keyboard, @Optional() viewCtrl: ViewController, private _zone: NgZone) {
|
||||
super(elementRef, config);
|
||||
constructor(
|
||||
elementRef: ElementRef,
|
||||
private _config: Config,
|
||||
@Optional() viewCtrl: ViewController,
|
||||
private _app: IonicApp,
|
||||
private _zone: NgZone
|
||||
) {
|
||||
super(elementRef, _config);
|
||||
this.scrollPadding = 0;
|
||||
this.keyboard = keyboard;
|
||||
|
||||
if (viewCtrl) {
|
||||
viewCtrl.setContent(this);
|
||||
@@ -53,7 +58,23 @@ export class Content extends Ion {
|
||||
*/
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
this.scrollElement = this.getNativeElement().children[0];
|
||||
|
||||
let self = this;
|
||||
self.scrollElement = self.getNativeElement().children[0];
|
||||
|
||||
self._scroll = function(ev) {
|
||||
self._app.setScrolling();
|
||||
};
|
||||
|
||||
if (self._config.get('tapPolyfill') === true) {
|
||||
self._zone.runOutsideAngular(function() {
|
||||
self.scrollElement.addEventListener('scroll', self._scroll);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.scrollElement.removeEventListener('scroll', this._scroll);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,28 +308,6 @@ export class Content extends Ion {
|
||||
|
||||
this.scrollPadding = newScrollPadding;
|
||||
this.scrollElement.style.paddingBottom = newScrollPadding + 'px';
|
||||
|
||||
// if (!this.keyboardPromise) {
|
||||
// console.debug('add scroll keyboard close callback', newScrollPadding);
|
||||
//
|
||||
// this.keyboardPromise = this.keyboard.onClose(() => {
|
||||
// console.debug('scroll keyboard closed', newScrollPadding);
|
||||
//
|
||||
// if (this) {
|
||||
// if (this.scrollPadding && this.scrollElement) {
|
||||
// let close = new Animation(this.scrollElement);
|
||||
// close
|
||||
// .duration(250)
|
||||
// .fromTo('paddingBottom', this.scrollPadding + 'px', '0px')
|
||||
// .play();
|
||||
// }
|
||||
//
|
||||
// this.scrollPadding = 0;
|
||||
// this.keyboardPromise = null;
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import {Animation} from '../../animations/animation';
|
||||
* A Modal is a content pane that goes over the user's current page.
|
||||
* Usually it is used for making a choice or editing an item. A modal uses the
|
||||
* `NavController` to
|
||||
* {@link /docs/v2/api/components/nav/NavController/#present NavController.present}
|
||||
* {@link /docs/v2/api/components/nav/NavController/#present present}
|
||||
* itself in the root nav stack. It is added to the stack similar to how
|
||||
* {@link /docs/v2/api/components/nav/NavController/#push NavController.push}
|
||||
* works.
|
||||
|
||||
@@ -11,6 +11,7 @@ export class OverlayNav {
|
||||
constructor() {
|
||||
// deprecated warning
|
||||
console.warn('<ion-overlay> is no longer needed and can be safely removed.');
|
||||
console.warn('https://github.com/driftyco/ionic2/blob/master/CHANGELOG.md#overlay-refactor');
|
||||
console.warn('See the v2 docs for an update on how overlays work.');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import {FORM_DIRECTIVES, FormBuilder, Validators, Control, ControlGroup} from 'angular2/common';
|
||||
|
||||
import {App} from 'ionic/ionic';
|
||||
import {SearchPipe} from 'ionic/components/searchbar/searchbar';
|
||||
|
||||
@App({
|
||||
templateUrl: 'main.html',
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
<!-- <ion-view nav-title="Search Bar"> -->
|
||||
|
||||
<ion-content>
|
||||
<!-- <form [ngFormModel]="form"> -->
|
||||
|
||||
<ion-searchbar [(ngModel)]="searchQuery"></ion-searchbar>
|
||||
<ion-list inset #list>
|
||||
<ion-item *ngFor="#item of getItems()">
|
||||
{{item.title}}
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
<!-- </form> -->
|
||||
</ion-content>
|
||||
|
||||
<!-- </ion-view> -->
|
||||
7
ionic/components/searchbar/test/nav/first.html
Normal file
7
ionic/components/searchbar/test/nav/first.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<ion-navbar *navbar>
|
||||
<ion-title>First Page</ion-title>
|
||||
</ion-navbar>
|
||||
|
||||
<ion-content padding>
|
||||
<button block (click)="goToSecond()">Go to Searchbar Page</button>
|
||||
</ion-content>
|
||||
30
ionic/components/searchbar/test/nav/index.ts
Normal file
30
ionic/components/searchbar/test/nav/index.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import {App, Page, NavController} from 'ionic/ionic';
|
||||
|
||||
@Page({
|
||||
templateUrl: 'first.html'
|
||||
})
|
||||
class FirstPage {
|
||||
constructor(private _nav: NavController) {
|
||||
|
||||
}
|
||||
|
||||
goToSecond() {
|
||||
this._nav.push(SecondPage);
|
||||
}
|
||||
}
|
||||
|
||||
@Page({
|
||||
templateUrl: 'second.html'
|
||||
})
|
||||
class SecondPage {
|
||||
|
||||
}
|
||||
|
||||
@App({
|
||||
template: '<ion-nav [root]="root"></ion-nav>'
|
||||
})
|
||||
class E2EApp {
|
||||
constructor() {
|
||||
this.root = FirstPage;
|
||||
}
|
||||
}
|
||||
13
ionic/components/searchbar/test/nav/second.html
Normal file
13
ionic/components/searchbar/test/nav/second.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<ion-navbar *navbar>
|
||||
<ion-title>Searchbar</ion-title>
|
||||
</ion-navbar>
|
||||
|
||||
<ion-toolbar>
|
||||
<ion-searchbar primary placeholder="Filter Schedules">
|
||||
</ion-searchbar>
|
||||
</ion-toolbar>
|
||||
|
||||
<ion-content>
|
||||
<ion-searchbar primary placeholder="Filter Schedules">
|
||||
</ion-searchbar>
|
||||
</ion-content>
|
||||
@@ -1,7 +1,4 @@
|
||||
import {App, NavController} from 'ionic/ionic';
|
||||
import {Page, Config, IonicApp} from 'ionic/ionic';
|
||||
import {NavParams, NavController, ViewController} from 'ionic/ionic';
|
||||
import {SearchPipe} from 'ionic/components/searchbar/searchbar';
|
||||
import {App} from 'ionic/ionic';
|
||||
|
||||
@App({
|
||||
templateUrl: 'main.html'
|
||||
|
||||
@@ -58,20 +58,28 @@ export class TapClick {
|
||||
this.lastTouch = Date.now();
|
||||
|
||||
if (this.usePolyfill && this.startCoord && this.app.isEnabled()) {
|
||||
// only dispatch mouse click events from a touchend event
|
||||
// when tapPolyfill config is true, and the startCoordand endCoord
|
||||
// are not too far off from each other
|
||||
let endCoord = pointerCoord(ev);
|
||||
|
||||
|
||||
if (!hasPointerMoved(POINTER_TOLERANCE, this.startCoord, endCoord)) {
|
||||
console.debug('create click from touch ' + Date.now());
|
||||
|
||||
// prevent native mouse click events for XX amount of time
|
||||
this.disableClick = this.lastTouch + DISABLE_NATIVE_CLICK_AMOUNT;
|
||||
|
||||
// manually dispatch the mouse click event
|
||||
let clickEvent = document.createEvent('MouseEvents');
|
||||
clickEvent.initMouseEvent('click', true, true, window, 1, 0, 0, endCoord.x, endCoord.y, false, false, false, false, 0, null);
|
||||
clickEvent.isIonicTap = true;
|
||||
ev.target.dispatchEvent(clickEvent);
|
||||
if (this.app.isScrolling()) {
|
||||
// do not fire off a click event while the app was scrolling
|
||||
console.debug('click from touch prevented by scrolling ' + Date.now());
|
||||
|
||||
} else {
|
||||
// dispatch a mouse click event
|
||||
console.debug('create click from touch ' + Date.now());
|
||||
|
||||
let clickEvent = document.createEvent('MouseEvents');
|
||||
clickEvent.initMouseEvent('click', true, true, window, 1, 0, 0, endCoord.x, endCoord.y, false, false, false, false, 0, null);
|
||||
clickEvent.isIonicTap = true;
|
||||
ev.target.dispatchEvent(clickEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import {Config} from './config';
|
||||
import {Platform} from '../platform/platform';
|
||||
import {Form} from '../util/form';
|
||||
import {Keyboard} from '../util/keyboard';
|
||||
import {ActionSheet} from '../components/action-sheet/action-sheet';
|
||||
import {Events} from '../util/events';
|
||||
import {NavRegistry} from '../components/nav/nav-registry';
|
||||
import {Translate} from '../translation/translate';
|
||||
@@ -58,7 +57,6 @@ export function ionicProviders(args={}) {
|
||||
TapClick,
|
||||
Form,
|
||||
Keyboard,
|
||||
ActionSheet,
|
||||
Translate,
|
||||
ROUTER_PROVIDERS,
|
||||
provide(LocationStrategy, {useClass: HashLocationStrategy}),
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
"semver": "^5.0.1",
|
||||
"serve-static": "^1.9.2",
|
||||
"source-map-support": "^0.2.10",
|
||||
"strip-sourcemap-loader": "0.0.1",
|
||||
"systemjs": "0.19.6",
|
||||
"through2": "^0.6.3",
|
||||
"typescript": "^1.7.3",
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<!-- https://www.chromium.org/developers/design-documents/chromium-graphics/how-to-get-gpu-rasterization -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="app.css">
|
||||
|
||||
</head>
|
||||
<body class="platform-cordova">
|
||||
|
||||
<ion-app>
|
||||
<ion-loading-icon></ion-loading-icon>
|
||||
</ion-app>
|
||||
<script src="bundle.js"></script>
|
||||
|
||||
<!-- <script src="/js/ionic.bundle.js"></script>
|
||||
|
||||
<script>
|
||||
System.config({
|
||||
"paths": {
|
||||
"*": "*.js",
|
||||
"ionic/*": "ionic/*",
|
||||
"angular2/*": "angular2/*",
|
||||
"rx": "rx"
|
||||
}
|
||||
})
|
||||
System.import("index");
|
||||
</script> -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -5,7 +5,8 @@
|
||||
<!-- https://www.chromium.org/developers/design-documents/chromium-graphics/how-to-get-gpu-rasterization -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
|
||||
<link href="../../css/ionic.css" rel="stylesheet">
|
||||
<link ios-href="/dist/bundles/ionic.ios.css" rel="stylesheet">
|
||||
<link md-href="/dist/bundles/ionic.md.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -1,26 +1,42 @@
|
||||
var path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: [
|
||||
"es6-shim",
|
||||
"zone.js",
|
||||
"reflect-metadata",
|
||||
"web-animations.min",
|
||||
path.normalize('es6-shim/es6-shim.min'),
|
||||
'reflect-metadata',
|
||||
'web-animations.min',
|
||||
path.normalize('zone.js/dist/zone-microtask'),
|
||||
],
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
loader: "awesome-typescript-loader",
|
||||
query: {
|
||||
'doTypeCheck': false
|
||||
},
|
||||
include: /\/demos\//,
|
||||
exclude: /node_modules/
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
include: path.resolve('node_modules/angular2'),
|
||||
loader: 'strip-sourcemap'
|
||||
}
|
||||
],
|
||||
noParse: [
|
||||
/es6-shim/,
|
||||
/reflect-metadata/,
|
||||
/web-animations/,
|
||||
/zone\.js(\/|\\)dist(\/|\\)zone-microtask/
|
||||
]
|
||||
},
|
||||
resolve: {
|
||||
modulesDirectories: [
|
||||
"node_modules",
|
||||
"dist/src/es5/common", // ionic-framework npm package (stable)
|
||||
"dist/js" // for web-animations polyfill
|
||||
],
|
||||
alias: {
|
||||
'ionic': path.normalize(process.cwd() + '/dist'),
|
||||
'web-animations.min': path.normalize(process.cwd() + '/dist/js/web-animations.min')
|
||||
},
|
||||
extensions: ["", ".js", ".ts"]
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<script src="/node_modules/angular2/bundles/angular2.dev.js"></script>
|
||||
<script src="/node_modules/angular2/bundles/router.dev.js"></script>
|
||||
<script src="/node_modules/angular2/bundles/http.dev.js"></script>
|
||||
<script src="/scripts/resources/web-animations-js/web-animations.min.js"></script>
|
||||
<script src="/dist/bundles/ionic.system.js"></script>
|
||||
<script src="/node_modules/rxjs/bundles/Rx.js"></script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user