chore(): update components.d.ts

This commit is contained in:
Manu Mtz.-Almeida
2018-03-24 03:27:20 +01:00
parent 153f8ca02c
commit 08f5976a57
5 changed files with 55 additions and 51 deletions

View File

@ -116,6 +116,9 @@ import {
import { import {
SelectPopoverOption, SelectPopoverOption,
} from './components/select-popover/select-popover'; } from './components/select-popover/select-popover';
import {
FrameworkDelegate as FrameworkDelegate3,
} from './utils/framework-delegate';
import { import {
DomRenderFn, DomRenderFn,
HeaderFn, HeaderFn,
@ -3052,6 +3055,7 @@ declare global {
* Programatically open the Menu. * Programatically open the Menu.
*/ */
'open': (menuId?: string) => Promise<boolean>; 'open': (menuId?: string) => Promise<boolean>;
'registerAnimation': (name: string, animation: AnimationBuilder) => void;
/** /**
* Used to enable or disable the ability to swipe open the menu. * Used to enable or disable the ability to swipe open the menu.
*/ */
@ -5753,6 +5757,7 @@ declare global {
* The component to display inside of the tab. * The component to display inside of the tab.
*/ */
'component': any; 'component': any;
'delegate': FrameworkDelegate;
/** /**
* If true, the user cannot interact with the tab. Defaults to `false`. * If true, the user cannot interact with the tab. Defaults to `false`.
*/ */
@ -5819,6 +5824,7 @@ declare global {
* The component to display inside of the tab. * The component to display inside of the tab.
*/ */
'component'?: any; 'component'?: any;
'delegate'?: FrameworkDelegate;
/** /**
* If true, the user cannot interact with the tab. Defaults to `false`. * If true, the user cannot interact with the tab. Defaults to `false`.
*/ */

View File

@ -66,6 +66,9 @@ property. If a menu is not found then it'll return `null`.
Programatically open the Menu. Programatically open the Menu.
#### registerAnimation()
#### swipeEnable() #### swipeEnable()
Used to enable or disable the ability to swipe open the menu. Used to enable or disable the ability to swipe open the menu.

View File

@ -9,33 +9,29 @@
</head> </head>
<body onload="initialize()"> <body onload="initialize()">
<ion-platform></ion-platform>
<ion-app> <ion-app>
<ion-header>
<ion-toolbar>
<ion-title>Platform - basic</ion-title>
</ion-toolbar>
</ion-header>
<ion-header> <ion-content padding>
<ion-toolbar> <h2>The Platforms are:</h2>
<ion-title>Platform - basic</ion-title> <ul class="platform-name-list"></ul>
</ion-toolbar>
</ion-header>
<ion-content padding> <h2>The Platforms versions are:</h2>
<h2>The Platforms are:</h2> <ul class="platform-version-list"></ul>
<ul class="platform-name-list"></ul>
<h2>The Platforms versions are:</h2>
<ul class="platform-version-list"></ul>
<h2>The orientation is <span class="orientation"></span></h2>
<h2>The ready event has fired: <span class="ready"></span></h2>
</ion-content>
<h2>The orientation is <span class="orientation"></span></h2>
<h2>The ready event has fired: <span class="ready"></span></h2>
</ion-content>
</ion-app> </ion-app>
<script> <script>
async function initialize() { async function initialize() {
const app = document.querySelector('ion-app');
await app.componentOnReady();
const platform = document.querySelector('ion-platform'); const platform = document.querySelector('ion-platform');
await platform.componentOnReady(); await platform.componentOnReady();

View File

@ -24,6 +24,7 @@ import { SelectPopoverOption } from '../select-popover/select-popover';
} }
}) })
export class Select { export class Select {
private childOpts: HTMLIonSelectOptionElement[] = []; private childOpts: HTMLIonSelectOptionElement[] = [];
private selectId: string; private selectId: string;
private labelId: string; private labelId: string;
@ -272,7 +273,7 @@ export class Select {
this.emitStyle(); this.emitStyle();
} }
getLabel() { private getLabel() {
const item = this.el.closest('ion-item'); const item = this.el.closest('ion-item');
if (item) { if (item) {
return item.querySelector('ion-label'); return item.querySelector('ion-label');
@ -280,7 +281,7 @@ export class Select {
return null; return null;
} }
open(ev: UIEvent) { private open(ev: UIEvent) {
let selectInterface = this.interface; let selectInterface = this.interface;
if ((selectInterface === 'action-sheet' || selectInterface === 'popover') && this.multiple) { if ((selectInterface === 'action-sheet' || selectInterface === 'popover') && this.multiple) {
@ -304,7 +305,7 @@ export class Select {
return this.openAlert(); return this.openAlert();
} }
openPopover(ev: UIEvent) { private async openPopover(ev: UIEvent) {
const interfaceOptions = {...this.interfaceOptions}; const interfaceOptions = {...this.interfaceOptions};
const popoverOpts: PopoverOptions = Object.assign(interfaceOptions, { const popoverOpts: PopoverOptions = Object.assign(interfaceOptions, {
@ -331,19 +332,13 @@ export class Select {
ev: ev ev: ev
}); });
const popover = this.popoverCtrl.create(popoverOpts); const popover = this.overlay = await this.popoverCtrl.create(popoverOpts);
await popover.present();
return popover.then(overlay => { this.isExpanded = true;
this.overlay = overlay; return popover;
return overlay.present().then(() => {
this.isExpanded = true;
return overlay;
});
});
} }
openActionSheet() { private async openActionSheet() {
const interfaceOptions = {...this.interfaceOptions}; const interfaceOptions = {...this.interfaceOptions};
const actionSheetButtons = this.childOpts.map(option => { const actionSheetButtons = this.childOpts.map(option => {
@ -369,17 +364,14 @@ export class Select {
cssClass: 'select-action-sheet' + (interfaceOptions.cssClass ? ' ' + interfaceOptions.cssClass : '') cssClass: 'select-action-sheet' + (interfaceOptions.cssClass ? ' ' + interfaceOptions.cssClass : '')
}); });
const actionSheet = this.actionSheetCtrl.create(actionSheetOpts); const actionSheet = this.overlay = await this.actionSheetCtrl.create(actionSheetOpts);
return actionSheet.then(overlay => { await actionSheet.present();
this.overlay = overlay;
return overlay.present().then(() => { this.isExpanded = true;
this.isExpanded = true; return actionSheet;
return overlay;
});
});
} }
openAlert() { private async openAlert() {
const interfaceOptions = {...this.interfaceOptions}; const interfaceOptions = {...this.interfaceOptions};
const label = this.getLabel(); const label = this.getLabel();
@ -416,20 +408,17 @@ export class Select {
(interfaceOptions.cssClass ? ' ' + interfaceOptions.cssClass : '') (interfaceOptions.cssClass ? ' ' + interfaceOptions.cssClass : '')
}); });
const alert = this.alertCtrl.create(alertOpts); const alert = this.overlay = await this.alertCtrl.create(alertOpts);
return alert.then(overlay => { await alert.present();
this.overlay = overlay;
return overlay.present().then(() => { this.isExpanded = true;
this.isExpanded = true; return alert;
return overlay;
});
});
} }
/** /**
* Close the select interface. * Close the select interface.
*/ */
close(): Promise<any> | void { private close(): Promise<void> {
// TODO check !this.overlay || !this.isFocus() // TODO check !this.overlay || !this.isFocus()
if (!this.overlay) { if (!this.overlay) {
return Promise.resolve(); return Promise.resolve();
@ -463,7 +452,7 @@ export class Select {
return (this.value !== null && this.value !== undefined && this.value !== ''); return (this.value !== null && this.value !== undefined && this.value !== '');
} }
emitStyle() { private emitStyle() {
clearTimeout(this.styleTmr); clearTimeout(this.styleTmr);
this.styleTmr = setTimeout(() => { this.styleTmr = setTimeout(() => {

View File

@ -81,6 +81,11 @@ any
The component to display inside of the tab. The component to display inside of the tab.
#### delegate
#### disabled #### disabled
boolean boolean
@ -170,6 +175,11 @@ any
The component to display inside of the tab. The component to display inside of the tab.
#### delegate
#### disabled #### disabled
boolean boolean