UNPKG

ionic-framework

Version:
231 lines 10.9 kB
var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; 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 ionic_1 = require('ionic/ionic'); var ionic_2 = require('ionic/ionic'); var E2EApp = (function () { function E2EApp(modal, config, platform) { this.modal = modal; console.log('platforms', platform.platforms()); console.log('mode', config.get('mode')); console.log('core', platform.is('core')); console.log('cordova', platform.is('cordova')); console.log('mobile', platform.is('mobile')); console.log('ipad', platform.is('ipad')); console.log('iphone', platform.is('iphone')); console.log('phablet', platform.is('phablet')); console.log('tablet', platform.is('tablet')); console.log('ios', platform.is('ios')); console.log('android', platform.is('android')); console.log('windows phone', platform.is('windowsphone')); platform.ready().then(function () { console.log('platform.ready'); }); } E2EApp.prototype.openModal = function () { this.modal.open(ModalPassParams, { userId: 3141209 }); }; E2EApp.prototype.openToolbarModal = function () { this.modal.open(ToolbarModal).then(function (modalRef) { // modal has finished opening // modalRef is a reference to the modal instance modalRef.onClose = function (modalData) { // somehow modalRef.close(modalData) was called w/ modalData console.log('modalRef.onClose', modalData); }; }); }; E2EApp.prototype.openModalChildNav = function () { this.modal.open(ContactUs, null, { handle: 'my-awesome-modal' }); }; E2EApp.prototype.openModalCustomAnimation = function () { this.modal.open(ContactUs, null, { handle: 'my-awesome-modal', enterAnimation: 'my-fade-in', leaveAnimation: 'my-fade-out' }); }; E2EApp = __decorate([ ionic_1.App({ templateUrl: 'main.html' }), __metadata('design:paramtypes', [(typeof (_a = typeof ionic_2.Modal !== 'undefined' && ionic_2.Modal) === 'function' && _a) || Object, (typeof (_b = typeof ionic_1.Config !== 'undefined' && ionic_1.Config) === 'function' && _b) || Object, (typeof (_c = typeof ionic_1.Platform !== 'undefined' && ionic_1.Platform) === 'function' && _c) || Object]) ], E2EApp); return E2EApp; var _a, _b, _c; })(); var ModalPassParams = (function () { function ModalPassParams(modal, params) { this.modal = modal; this.userId = params.get('userId'); } ModalPassParams = __decorate([ ionic_1.Page({ template: "\n <h3>Pass Params</h3>\n <p>User Id: {{userId}}</p>\n <p><button (click)=\"close()\">Close Modal</button></p>\n " }), __metadata('design:paramtypes', [(typeof (_a = typeof ionic_2.Modal !== 'undefined' && ionic_2.Modal) === 'function' && _a) || Object, (typeof (_b = typeof ionic_2.NavParams !== 'undefined' && ionic_2.NavParams) === 'function' && _b) || Object]) ], ModalPassParams); return ModalPassParams; var _a, _b; })(); var ToolbarModal = (function () { function ToolbarModal(modal) { this.modal = modal; } ToolbarModal.prototype.closeModal = function () { this.close({ adel: 'hello', lionel: 'hello' }); }; ToolbarModal = __decorate([ ionic_1.Page({ template: "\n <ion-toolbar>\n <ion-title>Modals</ion-title>\n </ion-toolbar>\n\n <ion-toolbar primary>\n <ion-title>Another toolbar</ion-title>\n </ion-toolbar>\n\n <ion-content padding>\n <button block danger (click)=\"closeModal()\" class=\"e2eCloseToolbarModal\">\n <icon close></icon>\n Close Modal\n </button>\n </ion-content>\n " }), __metadata('design:paramtypes', [(typeof (_a = typeof ionic_2.Modal !== 'undefined' && ionic_2.Modal) === 'function' && _a) || Object]) ], ToolbarModal); return ToolbarModal; var _a; })(); var ContactUs = (function () { function ContactUs() { console.log('ContactUs constructor'); this.rootView = ModalFirstPage; } ContactUs.prototype.onPageLoaded = function () { console.log('ContactUs onPageLoaded'); }; ContactUs.prototype.onPageWillEnter = function () { console.log('ContactUs onPageWillEnter'); }; ContactUs.prototype.onPageDidEnter = function () { console.log('ContactUs onPageDidEnter'); }; ContactUs.prototype.onPageWillLeave = function () { console.log('ContactUs onPageWillLeave'); }; ContactUs.prototype.onPageDidLeave = function () { console.log('ContactUs onPageDidLeave'); }; ContactUs.prototype.onPageWillUnload = function () { console.log('ContactUs onPageWillUnload'); }; ContactUs.prototype.onPageDidUnload = function () { console.log('ContactUs onPageDidUnload'); }; ContactUs = __decorate([ ionic_1.Page({ template: '<ion-nav [root]="rootView"></ion-nav>' }), __metadata('design:paramtypes', []) ], ContactUs); return ContactUs; })(); var ModalFirstPage = (function () { function ModalFirstPage(nav, modal, actionSheet) { this.nav = nav; this.modal = modal; this.actionSheet = actionSheet; } ModalFirstPage.prototype.push = function () { var page = ModalSecondPage; var params = { id: 8675309, myData: [1, 2, 3, 4] }; var opts = { animation: 'ios' }; this.nav.push(page, params, opts); }; ModalFirstPage.prototype.closeModal = function () { this.modal.get().close(); }; ModalFirstPage.prototype.closeByHandeModal = function () { this.modal.get('my-awesome-modal').close(); }; ModalFirstPage.prototype.openActionSheet = function () { var _this = this; this.actionSheet.open({ buttons: [ { text: 'Share This' }, { text: 'Move' } ], destructiveText: 'Delete', titleText: 'Modify your album', cancelText: 'Cancel', cancel: function () { console.log('Canceled'); }, destructiveButtonClicked: function () { console.log('Destructive clicked'); }, buttonClicked: function (index) { console.log('Button clicked', index); if (index == 1) { return false; } return true; } }).then(function (actionSheetRef) { _this.actionSheetRef = actionSheetRef; }); }; ModalFirstPage = __decorate([ ionic_1.Page({ template: "\n <ion-navbar *navbar>\n <ion-title>First Page Header</ion-title>\n <ion-buttons start>\n <button class=\"e2eCloseMenu\" (click)=\"closeModal()\">Close</button>\n </ion-buttons>\n </ion-navbar>\n <ion-content padding>\n <p>\n <button (click)=\"push()\">Push (Go to 2nd)</button>\n </p>\n <p>\n <button (click)=\"openActionSheet()\">Open Action Sheet</button>\n </p>\n <p>\n <button (click)=\"closeByHandeModal()\">Close By Handle</button>\n </p>\n <f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>\n <f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>\n </ion-content>\n " }), __metadata('design:paramtypes', [(typeof (_a = typeof ionic_2.NavController !== 'undefined' && ionic_2.NavController) === 'function' && _a) || Object, (typeof (_b = typeof ionic_2.Modal !== 'undefined' && ionic_2.Modal) === 'function' && _b) || Object, (typeof (_c = typeof ionic_2.ActionSheet !== 'undefined' && ionic_2.ActionSheet) === 'function' && _c) || Object]) ], ModalFirstPage); return ModalFirstPage; var _a, _b, _c; })(); var ModalSecondPage = (function () { function ModalSecondPage(nav, params) { this.nav = nav; console.log('Second page params:', params); } ModalSecondPage = __decorate([ ionic_1.Page({ template: "\n <ion-navbar *navbar>\n <ion-title>Second Page Header</ion-title>\n </ion-navbar>\n <ion-content padding>\n <p>\n <button (click)=\"nav.pop()\">Pop (Go back to 1st)</button>\n </p>\n <f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>\n <f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>\n </ion-content>\n " }), __metadata('design:paramtypes', [(typeof (_a = typeof ionic_2.NavController !== 'undefined' && ionic_2.NavController) === 'function' && _a) || Object, (typeof (_b = typeof ionic_2.NavParams !== 'undefined' && ionic_2.NavParams) === 'function' && _b) || Object]) ], ModalSecondPage); return ModalSecondPage; var _a, _b; })(); var FadeIn = (function (_super) { __extends(FadeIn, _super); function FadeIn(enteringView, leavingView) { _super.call(this, enteringView.pageRef()); this .easing('ease') .duration(1000) .fromTo('translateY', '0%', '0%') .fadeIn() .before.addClass('show-page'); } return FadeIn; })(ionic_2.Animation); ionic_2.Animation.register('my-fade-in', FadeIn); var FadeOut = (function (_super) { __extends(FadeOut, _super); function FadeOut(enteringView, leavingView) { _super.call(this, leavingView.pageRef()); this .easing('ease') .duration(500) .fadeOut() .before.addClass('show-page'); } return FadeOut; })(ionic_2.Animation); ionic_2.Animation.register('my-fade-out', FadeOut);