ionic-framework
Version:
193 lines • 11.2 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require('angular2/core');
var ionic_1 = require('ionic/ionic');
var ionic_2 = require('ionic/ionic');
var ionic_3 = require('ionic/ionic');
var MyCmpTest = (function () {
function MyCmpTest() {
}
MyCmpTest = __decorate([
core_1.Component({
selector: 'my-cmp',
template: "<p>My Custom Component Test <icon star></icon></p>",
directives: [ionic_3.IONIC_DIRECTIVES]
}),
__metadata('design:paramtypes', [])
], MyCmpTest);
return MyCmpTest;
})();
var FirstPage = (function () {
function FirstPage(nav, app, config) {
this.nav = nav;
this.title = 'First Page';
this.pushPage = FullPage;
this.pages = [];
for (var i = 1; i <= 50; i++) {
this.pages.push(i);
}
}
FirstPage.prototype.setPages = function () {
var items = [
PrimaryHeaderPage
];
this.nav.setPages(items);
};
FirstPage.prototype.setRoot = function () {
this.nav.setRoot(PrimaryHeaderPage);
};
FirstPage.prototype.pushPrimaryHeaderPage = function () {
this.nav.push(PrimaryHeaderPage);
};
FirstPage.prototype.pushFullPage = function () {
this.nav.push(FullPage, { id: 8675309, myData: [1, 2, 3, 4] });
};
FirstPage.prototype.pushAnother = function () {
this.nav.push(AnotherPage);
};
FirstPage.prototype.reload = function () {
window.location.reload();
};
FirstPage = __decorate([
ionic_2.Page({
template: "\n <ion-navbar *navbar>\n <ion-title>{{title}}</ion-title>\n <ion-buttons start>\n <button><icon star></icon></button>\n </ion-buttons>\n <ion-buttons end>\n <button>S1</button>\n </ion-buttons>\n </ion-navbar>\n <ion-content>\n <ion-list>\n <ion-list-header>\n {{title}}\n </ion-list-header>\n\n <button ion-item class=\"e2eFrom1To2\" (click)=\"pushFullPage()\">Push to FullPage</button>\n <button ion-item (click)=\"pushPrimaryHeaderPage()\">Push to PrimaryHeaderPage</button>\n <button ion-item (click)=\"pushAnother()\">Push to AnotherPage</button>\n <button ion-item [nav-push]=\"[pushPage, {id: 42}]\">Push FullPage w/ [nav-push] array</button>\n <button ion-item [nav-push]=\"pushPage\" [nav-params]=\"{id:40}\">Push w/ [nav-push] and [nav-params]</button>\n <button ion-item [nav-push]=\"['FirstPage', {id: 22}]\">Push w/ [nav-push] array and string view name</button>\n <button ion-item nav-push=\"FirstPage\" [nav-params]=\"{id: 23}\">Push w/ nav-push and [nav-params]</button>\n <button ion-item (click)=\"setPages()\">setPages() (Go to PrimaryHeaderPage)</button>\n <button ion-item (click)=\"setRoot()\">setRoot(PrimaryHeaderPage) (Go to PrimaryHeaderPage)</button>\n <button ion-item (click)=\"nav.pop()\">Pop</button>\n <button ion-item (click)=\"reload()\">Reload</button>\n\n <button *ng-for=\"#i of pages\" ion-item (click)=\"pushPrimaryHeaderPage()\">Page {{i}}</button>\n </ion-list>\n <my-cmp></my-cmp>\n </ion-content>",
directives: [MyCmpTest]
}),
__metadata('design:paramtypes', [(typeof (_a = typeof ionic_1.NavController !== 'undefined' && ionic_1.NavController) === 'function' && _a) || Object, (typeof (_b = typeof ionic_2.IonicApp !== 'undefined' && ionic_2.IonicApp) === 'function' && _b) || Object, (typeof (_c = typeof ionic_2.Config !== 'undefined' && ionic_2.Config) === 'function' && _c) || Object])
], FirstPage);
return FirstPage;
var _a, _b, _c;
})();
var FullPage = (function () {
function FullPage(nav, params) {
this.nav = nav;
this.params = params;
}
FullPage.prototype.setPages = function () {
var items = [
FirstPage,
PrimaryHeaderPage
];
this.nav.setPages(items);
};
FullPage.prototype.pushPrimaryHeaderPage = function () {
this.nav.push(PrimaryHeaderPage);
};
FullPage.prototype.pushAnother = function () {
this.nav.push(AnotherPage);
};
FullPage.prototype.pushFirstPage = function () {
this.nav.push(FirstPage);
};
FullPage = __decorate([
ionic_2.Page({
template: "\n <ion-content padding>\n <h1>Full page</h1>\n <p>This page does not have a nav bar!</p>\n <p><button (click)=\"nav.pop()\">Pop</button></p>\n <p><button class=\"e2eFrom2To3\" (click)=\"pushPrimaryHeaderPage()\">Push to PrimaryHeaderPage</button></p>\n <p><button (click)=\"pushAnother()\">Push to AnotherPage</button></p>\n <p><button (click)=\"pushFirstPage()\">Push to FirstPage</button></p>\n <p><button class=\"e2eFrom2To1\" nav-pop>Pop with NavPop (Go back to 1st)</button></p>\n <p><button (click)=\"setPages()\">setPages() (Go to PrimaryHeaderPage, FirstPage 1st in history)</button></p>\n </ion-content>\n "
}),
__metadata('design:paramtypes', [(typeof (_a = typeof ionic_1.NavController !== 'undefined' && ionic_1.NavController) === 'function' && _a) || Object, (typeof (_b = typeof ionic_3.NavParams !== 'undefined' && ionic_3.NavParams) === 'function' && _b) || Object])
], FullPage);
return FullPage;
var _a, _b;
})();
var PrimaryHeaderPage = (function () {
function PrimaryHeaderPage(nav, viewCtrl) {
this.nav = nav;
this.viewCtrl = viewCtrl;
}
PrimaryHeaderPage.prototype.onPageWillEnter = function () {
this.viewCtrl.setBackButtonText('Previous');
};
PrimaryHeaderPage.prototype.pushAnother = function () {
this.nav.push(AnotherPage);
};
PrimaryHeaderPage.prototype.pushFullPage = function () {
this.nav.push(FullPage, { id: 8675309, myData: [1, 2, 3, 4] });
};
PrimaryHeaderPage.prototype.insert = function () {
this.nav.insert(2, FirstPage);
};
PrimaryHeaderPage.prototype.removeSecond = function () {
this.nav.remove(1);
};
PrimaryHeaderPage.prototype.setRoot = function () {
this.nav.setRoot(AnotherPage);
};
PrimaryHeaderPage = __decorate([
ionic_2.Page({
template: "\n <ion-navbar *navbar primary>\n <ion-title>Primary Color Page Header</ion-title>\n </ion-navbar>\n <ion-content padding>\n <p><button class=\"e2eFrom3To2\" (click)=\"nav.pop()\">Pop</button></p>\n <p><button (click)=\"pushAnother()\">Push to AnotherPage</button></p>\n <p><button (click)=\"pushFullPage()\">Push to FullPage</button></p>\n <p><button (click)=\"setRoot()\">setRoot(AnotherPage)</button></p>\n <p><button id=\"insert\" (click)=\"insert()\">Insert first page into history before this</button></p>\n <p><button id=\"remove\" (click)=\"removeSecond()\">Remove second page in history</button></p>\n <div class=\"yellow\"><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f></div>\n </ion-content>\n "
}),
__metadata('design:paramtypes', [(typeof (_a = typeof ionic_1.NavController !== 'undefined' && ionic_1.NavController) === 'function' && _a) || Object, (typeof (_b = typeof ionic_3.ViewController !== 'undefined' && ionic_3.ViewController) === 'function' && _b) || Object])
], PrimaryHeaderPage);
return PrimaryHeaderPage;
var _a, _b;
})();
var AnotherPage = (function () {
function AnotherPage(nav, viewCtrl) {
this.nav = nav;
this.viewCtrl = viewCtrl;
this.bbHideToggleVal = false;
this._bbCount = 0;
}
AnotherPage.prototype.pushFullPage = function () {
this.nav.push(FullPage);
};
AnotherPage.prototype.pushPrimaryHeaderPage = function () {
this.nav.push(PrimaryHeaderPage);
};
AnotherPage.prototype.pushFirstPage = function () {
this.nav.push(FirstPage);
};
AnotherPage.prototype.setRoot = function () {
this.nav.setRoot(FirstPage);
};
AnotherPage.prototype.toggleBackButton = function () {
this.bbHideToggleVal = !this.bbHideToggleVal;
this.viewCtrl.showBackButton(this.bbHideToggleVal);
};
AnotherPage.prototype.setBackButtonText = function () {
var backButtonText = 'Messages';
if (this._bbCount > 0) {
backButtonText += " (" + this._bbCount + ")";
}
this.viewCtrl.setBackButtonText(backButtonText);
++this._bbCount;
};
AnotherPage = __decorate([
ionic_2.Page({
template: "\n <ion-navbar *navbar hide-back-button>\n <ion-title>Another Page Header</ion-title>\n </ion-navbar>\n <ion-content padding>\n <p>Back button hidden w/ <code>ion-navbar hide-back-button</code></p>\n <p><button (click)=\"nav.pop()\">Pop</button></p>\n <p><button (click)=\"pushFullPage()\">Push to FullPage</button></p>\n <p><button (click)=\"pushPrimaryHeaderPage()\">Push to PrimaryHeaderPage</button></p>\n <p><button (click)=\"pushFirstPage()\">Push to FirstPage</button></p>\n <p><button (click)=\"setRoot()\">setRoot(FirstPage)</button></p>\n <p><button (click)=\"toggleBackButton()\">Toggle hide-back-button</button></p>\n <p><button (click)=\"setBackButtonText()\">Set Back Button Text</button></p>\n </ion-content>\n "
}),
__metadata('design:paramtypes', [(typeof (_a = typeof ionic_1.NavController !== 'undefined' && ionic_1.NavController) === 'function' && _a) || Object, (typeof (_b = typeof ionic_3.ViewController !== 'undefined' && ionic_3.ViewController) === 'function' && _b) || Object])
], AnotherPage);
return AnotherPage;
var _a, _b;
})();
var E2EApp = (function () {
function E2EApp() {
this.root = FirstPage;
}
Object.defineProperty(E2EApp.prototype, "isChangeDetecting", {
get: function () {
console.log('isChangeDetecting');
return true;
},
enumerable: true,
configurable: true
});
E2EApp = __decorate([
ionic_1.App({
pages: [FirstPage, FullPage, PrimaryHeaderPage, AnotherPage],
template: "<ion-nav [root]=\"root\"></ion-nav>",
host: {
'[class.is-change-detecting]': 'isChangeDetecting'
}
}),
__metadata('design:paramtypes', [])
], E2EApp);
return E2EApp;
})();