chore(templates): import required directives for ionic templates

This commit is contained in:
Adam Bradley
2016-07-01 00:59:37 -05:00
parent 009d5a980a
commit 656426672c
27 changed files with 266 additions and 217 deletions

View File

@ -1,8 +1,11 @@
import { Component, Renderer, ElementRef, HostListener, ViewEncapsulation } from '@angular/core'; import { Component, Renderer, ElementRef, HostListener, ViewEncapsulation } from '@angular/core';
import { NgClass, NgFor, NgIf } from '@angular/common';
import { Animation } from '../../animations/animation'; import { Animation } from '../../animations/animation';
import { Backdrop } from '../backdrop/backdrop';
import { Config } from '../../config/config'; import { Config } from '../../config/config';
import { Form } from '../../util/form'; import { Form } from '../../util/form';
import { Icon } from '../icon/icon';
import { Key } from '../../util/key'; import { Key } from '../../util/key';
import { NavParams } from '../nav/nav-params'; import { NavParams } from '../nav/nav-params';
import { Transition, TransitionOptions } from '../../transitions/transition'; import { Transition, TransitionOptions } from '../../transitions/transition';
@ -35,6 +38,7 @@ import { ViewController } from '../nav/view-controller';
</div> </div>
</div> </div>
`, `,
directives: [Backdrop, Icon, NgClass, NgFor, NgIf],
host: { host: {
'role': 'dialog', 'role': 'dialog',
'[attr.aria-labelledby]': 'hdrId', '[attr.aria-labelledby]': 'hdrId',

View File

@ -1,6 +1,9 @@
import {Component, ElementRef, Renderer, HostListener, ViewEncapsulation} from '@angular/core'; import { Component, ElementRef, HostListener, Renderer, ViewEncapsulation } from '@angular/core';
import { NgClass, NgFor, NgIf, NgSwitch, NgSwitchCase, NgSwitchDefault } from '@angular/common';
import { NgModel } from '@angular/forms';
import { Animation } from '../../animations/animation'; import { Animation } from '../../animations/animation';
import { Backdrop } from '../backdrop/backdrop';
import { Config } from '../../config/config'; import { Config } from '../../config/config';
import { isPresent } from '../../util/util'; import { isPresent } from '../../util/util';
import { Key } from '../../util/key'; import { Key } from '../../util/key';
@ -62,6 +65,7 @@ import {ViewController} from '../nav/view-controller';
</div> </div>
</div> </div>
`, `,
directives: [Backdrop, NgClass, NgFor, NgIf, NgModel, NgSwitch, NgSwitchCase, NgSwitchDefault],
host: { host: {
'role': 'dialog', 'role': 'dialog',
'[attr.aria-labelledby]': 'hdrId', '[attr.aria-labelledby]': 'hdrId',

View File

@ -35,11 +35,8 @@ import {isTrueProperty} from '../../util/util';
*/ */
@Component({ @Component({
selector: 'button:not([ion-item]),[button]', selector: 'button:not([ion-item]),[button]',
template: // NOTE: template must not contain spaces between elements
'<span class="button-inner">' + template: '<span class="button-inner"><ng-content></ng-content></span><ion-button-effect></ion-button-effect>',
'<ng-content></ng-content>' +
'</span>' +
'<ion-button-effect></ion-button-effect>',
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
}) })

View File

@ -5,7 +5,7 @@ import { Form } from '../../util/form';
import { Item } from '../item/item'; import { Item } from '../item/item';
import { isTrueProperty } from '../../util/util'; import { isTrueProperty } from '../../util/util';
const CHECKBOX_VALUE_ACCESSOR = new Provider( export const CHECKBOX_VALUE_ACCESSOR = new Provider(
NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => Checkbox), multi: true}); NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => Checkbox), multi: true});
@ -49,19 +49,20 @@ const CHECKBOX_VALUE_ACCESSOR = new Provider(
*/ */
@Component({ @Component({
selector: 'ion-checkbox', selector: 'ion-checkbox',
template: template: `
'<div class="checkbox-icon" [class.checkbox-checked]="_checked">' + <div class="checkbox-icon" [class.checkbox-checked]="_checked">
'<div class="checkbox-inner"></div>' + <div class="checkbox-inner"></div>
'</div>' + </div>
'<button role="checkbox" ' + <button role="checkbox"
'type="button" ' + type="button"
'category="item-cover" ' + category="item-cover"
'[id]="id" ' + [id]="id"
'[attr.aria-checked]="_checked" ' + [attr.aria-checked]="_checked"
'[attr.aria-labelledby]="_labelId" ' + [attr.aria-labelledby]="_labelId"
'[attr.aria-disabled]="_disabled" ' + [attr.aria-disabled]="_disabled"
'class="item-cover">' + class="item-cover">
'</button>', </button>
`,
host: { host: {
'[class.checkbox-disabled]': '_disabled' '[class.checkbox-disabled]': '_disabled'
}, },

View File

@ -10,7 +10,7 @@ import { merge, isBlank, isPresent, isTrueProperty, isArray, isString } from '..
import { dateValueRange, renderDateTime, renderTextFormat, convertFormatToKey, getValueFromFormat, parseTemplate, parseDate, updateDate, DateTimeData, convertDataToISO, daysInMonth, dateSortValue, dateDataSortValue, LocaleData } from '../../util/datetime-util'; import { dateValueRange, renderDateTime, renderTextFormat, convertFormatToKey, getValueFromFormat, parseTemplate, parseDate, updateDate, DateTimeData, convertDataToISO, daysInMonth, dateSortValue, dateDataSortValue, LocaleData } from '../../util/datetime-util';
import { NavController } from '../nav/nav-controller'; import { NavController } from '../nav/nav-controller';
const DATETIME_VALUE_ACCESSOR = new Provider( export const DATETIME_VALUE_ACCESSOR = new Provider(
NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => DateTime), multi: true}); NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => DateTime), multi: true});
@ -248,16 +248,17 @@ const DATETIME_VALUE_ACCESSOR = new Provider(
*/ */
@Component({ @Component({
selector: 'ion-datetime', selector: 'ion-datetime',
template: template: `
'<div class="datetime-text">{{_text}}</div>' + <div class="datetime-text">{{_text}}</div>
'<button aria-haspopup="true" ' + <button aria-haspopup="true"
'type="button" ' + type="button"
'[id]="id" ' + [id]="id"
'category="item-cover" ' + category="item-cover"
'[attr.aria-labelledby]="_labelId" ' + [attr.aria-labelledby]="_labelId"
'[attr.aria-disabled]="_disabled" ' + [attr.aria-disabled]="_disabled"
'class="item-cover">' + class="item-cover">
'</button>', </button>
`,
host: { host: {
'[class.datetime-disabled]': '_disabled' '[class.datetime-disabled]': '_disabled'
}, },

View File

@ -1,7 +1,9 @@
import { Component, Input, ViewEncapsulation } from '@angular/core'; import { Component, Input, ViewEncapsulation } from '@angular/core';
import { NgIf } from '@angular/common';
import { Config } from '../../config/config'; import { Config } from '../../config/config';
import { InfiniteScroll } from './infinite-scroll'; import { InfiniteScroll } from './infinite-scroll';
import { Spinner } from '../spinner/spinner';
/** /**
@ -16,6 +18,7 @@ import { InfiniteScroll } from './infinite-scroll';
'</div>' + '</div>' +
'<div class="infinite-loading-text" [innerHTML]="loadingText" *ngIf="loadingText"></div>' + '<div class="infinite-loading-text" [innerHTML]="loadingText" *ngIf="loadingText"></div>' +
'</div>', '</div>',
directives: [NgIf, Spinner],
host: { host: {
'[attr.state]': 'inf.state' '[attr.state]': 'inf.state'
}, },

View File

@ -1,5 +1,6 @@
import { Component, Optional, ElementRef, ViewChild, ViewEncapsulation } from '@angular/core'; import { Component, Optional, ElementRef, ViewChild, ViewEncapsulation } from '@angular/core';
import { NgControl } from '@angular/forms'; import { NgIf } from '@angular/common';
import { NgControl, NgModel } from '@angular/forms';
import { App } from '../app/app'; import { App } from '../app/app';
import { Config } from '../../config/config'; import { Config } from '../../config/config';
@ -74,15 +75,13 @@ import { Platform } from '../../platform/platform';
*/ */
@Component({ @Component({
selector: 'ion-input', selector: 'ion-input',
template: template: `
'<input [type]="type" [(ngModel)]="_value" (blur)="inputBlurred($event)" (focus)="inputFocused($event)" [placeholder]="placeholder" class="text-input">' + <input [type]="type" [(ngModel)]="_value" (blur)="inputBlurred($event)" (focus)="inputFocused($event)" [placeholder]="placeholder" class="text-input">
'<input [type]="type" aria-hidden="true" next-input *ngIf="_useAssist">' + <input [type]="type" aria-hidden="true" next-input *ngIf="_useAssist">
'<button clear [hidden]="!clearInput" type="button" class="text-input-clear-icon" (click)="clearTextInput()" (mousedown)="clearTextInput()"></button>' + <button clear [hidden]="!clearInput" type="button" class="text-input-clear-icon" (click)="clearTextInput()" (mousedown)="clearTextInput()"></button>
'<div (touchstart)="pointerStart($event)" (touchend)="pointerEnd($event)" (mousedown)="pointerStart($event)" (mouseup)="pointerEnd($event)" class="input-cover" tappable *ngIf="_useAssist"></div>', <div (touchstart)="pointerStart($event)" (touchend)="pointerEnd($event)" (mousedown)="pointerStart($event)" (mouseup)="pointerEnd($event)" class="input-cover" tappable *ngIf="_useAssist"></div>
directives: [ `,
NextInput, directives: [NativeInput, NextInput, NgIf, NgModel],
NativeInput,
],
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
}) })
export class TextInput extends InputBase { export class TextInput extends InputBase {
@ -170,10 +169,7 @@ export class TextInput extends InputBase {
'<textarea [(ngModel)]="_value" (blur)="inputBlurred($event)" (focus)="inputFocused($event)" [placeholder]="placeholder" class="text-input"></textarea>' + '<textarea [(ngModel)]="_value" (blur)="inputBlurred($event)" (focus)="inputFocused($event)" [placeholder]="placeholder" class="text-input"></textarea>' +
'<input type="text" aria-hidden="true" next-input *ngIf="_useAssist">' + '<input type="text" aria-hidden="true" next-input *ngIf="_useAssist">' +
'<div (touchstart)="pointerStart($event)" (touchend)="pointerEnd($event)" (mousedown)="pointerStart($event)" (mouseup)="pointerEnd($event)" class="input-cover" tappable *ngIf="_useAssist"></div>', '<div (touchstart)="pointerStart($event)" (touchend)="pointerEnd($event)" (mousedown)="pointerStart($event)" (mouseup)="pointerEnd($event)" class="input-cover" tappable *ngIf="_useAssist"></div>',
directives: [ directives: [NativeInput, NextInput, NgIf],
NextInput,
NativeInput
],
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
}) })
export class TextArea extends InputBase { export class TextArea extends InputBase {

View File

@ -178,9 +178,10 @@ const enum SlidingState {
*/ */
@Component({ @Component({
selector: 'ion-item-sliding', selector: 'ion-item-sliding',
template: template: `
'<ng-content select="ion-item,[ion-item]"></ng-content>' + <ng-content select="ion-item,[ion-item]"></ng-content>
'<ng-content select="ion-item-options"></ng-content>', <ng-content select="ion-item-options"></ng-content>
`,
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
}) })

View File

@ -1,4 +1,5 @@
import { ChangeDetectionStrategy, Component, ContentChild, ContentChildren, Directive, ElementRef, forwardRef, Input, Renderer, ViewChild, ViewEncapsulation } from '@angular/core'; import { ChangeDetectionStrategy, Component, ContentChild, ContentChildren, Directive, ElementRef, forwardRef, Input, Renderer, ViewChild, ViewEncapsulation } from '@angular/core';
import { NgIf } from '@angular/common';
import { Button } from '../button/button'; import { Button } from '../button/button';
import { Form } from '../../util/form'; import { Form } from '../../util/form';
@ -267,21 +268,22 @@ import { Label } from '../label/label';
*/ */
@Component({ @Component({
selector: 'ion-list-header,ion-item,[ion-item],ion-item-divider', selector: 'ion-list-header,ion-item,[ion-item],ion-item-divider',
template: template: `
'<ng-content select="[item-left],ion-checkbox:not([item-right])"></ng-content>' + <ng-content select="[item-left],ion-checkbox:not([item-right])"></ng-content>
'<div class="item-inner">' + <div class="item-inner">
'<div class="input-wrapper">' + <div class="input-wrapper">
'<ng-content select="ion-label"></ng-content>' + <ng-content select="ion-label"></ng-content>
'<ion-label *ngIf="_viewLabel">' + <ion-label *ngIf="_viewLabel">
'<ng-content></ng-content>' + <ng-content></ng-content>
'</ion-label>' + </ion-label>
'<ng-content select="ion-select,ion-input,ion-textarea,ion-datetime,ion-range,[item-content]"></ng-content>' + <ng-content select="ion-select,ion-input,ion-textarea,ion-datetime,ion-range,[item-content]"></ng-content>
'</div>' + </div>
'<ng-content select="[item-right],ion-radio,ion-toggle"></ng-content>' + <ng-content select="[item-right],ion-radio,ion-toggle"></ng-content>
'<ion-reorder></ion-reorder>' + <ion-reorder></ion-reorder>
'</div>' + </div>
'<ion-button-effect></ion-button-effect>', <ion-button-effect></ion-button-effect>
directives: [forwardRef(() => Reorder)], `,
directives: [NgIf, Label, forwardRef(() => Reorder)],
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
}) })

View File

@ -1,9 +1,12 @@
import { Component, ElementRef, Renderer, ViewEncapsulation } from '@angular/core'; import { Component, ElementRef, Renderer, ViewEncapsulation } from '@angular/core';
import { NgIf } from '@angular/common';
import { Animation } from '../../animations/animation'; import { Animation } from '../../animations/animation';
import { Backdrop } from '../backdrop/backdrop';
import { Config } from '../../config/config'; import { Config } from '../../config/config';
import { isDefined, isPresent, isUndefined } from '../../util/util'; import { isDefined, isPresent, isUndefined } from '../../util/util';
import { NavParams } from '../nav/nav-params'; import { NavParams } from '../nav/nav-params';
import { Spinner } from '../spinner/spinner';
import { Transition, TransitionOptions } from '../../transitions/transition'; import { Transition, TransitionOptions } from '../../transitions/transition';
import { ViewController} from '../nav/view-controller'; import { ViewController} from '../nav/view-controller';
@ -13,14 +16,16 @@ import { ViewController} from '../nav/view-controller';
*/ */
@Component({ @Component({
selector: 'ion-loading', selector: 'ion-loading',
template: template: `
'<ion-backdrop [class.hide-backdrop]="!d.showBackdrop"></ion-backdrop>' + <ion-backdrop [class.hide-backdrop]="!d.showBackdrop"></ion-backdrop>
'<div class="loading-wrapper">' + <div class="loading-wrapper">
'<div *ngIf="showSpinner" class="loading-spinner">' + <div *ngIf="showSpinner" class="loading-spinner">
'<ion-spinner [name]="d.spinner"></ion-spinner>' + <ion-spinner [name]="d.spinner"></ion-spinner>
'</div>' + </div>
'<div *ngIf="d.content" [innerHTML]="d.content" class="loading-content"></div>' + <div *ngIf="d.content" [innerHTML]="d.content" class="loading-content"></div>
'</div>', </div>
`,
directives: [Backdrop, NgIf, Spinner],
host: { host: {
'role': 'dialog' 'role': 'dialog'
}, },

View File

@ -179,9 +179,11 @@ import { Platform } from '../../platform/platform';
host: { host: {
'role': 'navigation' 'role': 'navigation'
}, },
template: template: `
'<ng-content></ng-content>' + <ng-content></ng-content>
'<ion-backdrop (click)="bdClick($event)" disableScroll="false"></ion-backdrop>', <ion-backdrop (click)="bdClick($event)" disableScroll="false"></ion-backdrop>
`,
directives: [Backdrop],
changeDetection: ChangeDetectionStrategy.OnPush, changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
}) })
@ -281,17 +283,17 @@ export class Menu extends Ion {
/** /**
* @output {event} When the menu is being dragged open. * @output {event} When the menu is being dragged open.
*/ */
@Output() ionDrag: EventEmitter<number> = new EventEmitter(); @Output() ionDrag: EventEmitter<number> = new EventEmitter<number>();
/** /**
* @output {event} When the menu has been opened. * @output {event} When the menu has been opened.
*/ */
@Output() ionOpen: EventEmitter<boolean> = new EventEmitter(); @Output() ionOpen: EventEmitter<boolean> = new EventEmitter<boolean>();
/** /**
* @output {event} When the menu has been closed. * @output {event} When the menu has been closed.
*/ */
@Output() ionClose: EventEmitter<boolean> = new EventEmitter(); @Output() ionClose: EventEmitter<boolean> = new EventEmitter<boolean>();
constructor( constructor(
private _menuCtrl: MenuController, private _menuCtrl: MenuController,

View File

@ -2,9 +2,10 @@ import { Component, ComponentResolver, HostListener, Renderer, ViewChild, ViewCo
import { addSelector } from '../../config/bootstrap'; import { addSelector } from '../../config/bootstrap';
import { Animation } from '../../animations/animation'; import { Animation } from '../../animations/animation';
import { pascalCaseToDashCase } from '../../util/util'; import { Backdrop } from '../backdrop/backdrop';
import { Key } from '../../util/key'; import { Key } from '../../util/key';
import { NavParams } from '../nav/nav-params'; import { NavParams } from '../nav/nav-params';
import { pascalCaseToDashCase } from '../../util/util';
import { PageTransition } from '../../transitions/page-transition'; import { PageTransition } from '../../transitions/page-transition';
import { TransitionOptions } from '../../transitions/transition'; import { TransitionOptions } from '../../transitions/transition';
import { ViewController } from '../nav/view-controller'; import { ViewController } from '../nav/view-controller';
@ -21,7 +22,8 @@ import { windowDimensions } from '../../util/dom';
<div class="modal-wrapper"> <div class="modal-wrapper">
<div #viewport nav-viewport></div> <div #viewport nav-viewport></div>
</div> </div>
` `,
directives: [Backdrop]
}) })
export class ModalCmp { export class ModalCmp {

View File

@ -2,6 +2,7 @@ import { Component, Directive, ElementRef, forwardRef, Inject, Input, Optional }
import { App } from '../app/app'; import { App } from '../app/app';
import { Config } from '../../config/config'; import { Config } from '../../config/config';
import { Icon } from '../icon/icon';
import { Ion } from '../ion'; import { Ion } from '../ion';
import { isTrueProperty } from '../../util/util'; import { isTrueProperty } from '../../util/util';
import { NavController } from '../nav/nav-controller'; import { NavController } from '../nav/nav-controller';
@ -94,28 +95,29 @@ class ToolbarBackground {
*/ */
@Component({ @Component({
selector: 'ion-navbar', selector: 'ion-navbar',
template: template: `
'<div class="toolbar-background"></div>' + <div class="toolbar-background"></div>
'<button category="bar-button" class="back-button" [hidden]="_hideBb">' + <button category="bar-button" class="back-button" [hidden]="_hideBb">
'<span class="button-inner">' + <span class="button-inner">
'<ion-icon class="back-button-icon" [name]="_bbIcon"></ion-icon>' + <ion-icon class="back-button-icon" [name]="_bbIcon"></ion-icon>
'<span class="back-button-text">' + <span class="back-button-text">
'<span class="back-default">{{_bbText}}</span>' + <span class="back-default">{{_bbText}}</span>
'</span>' + </span>
'</span>' + </span>
'</button>' + </button>
'<ng-content select="[menuToggle],ion-buttons[left]"></ng-content>' + <ng-content select="[menuToggle],ion-buttons[left]"></ng-content>
'<ng-content select="ion-buttons[start]"></ng-content>' + <ng-content select="ion-buttons[start]"></ng-content>
'<ng-content select="ion-buttons[end],ion-buttons[right]"></ng-content>' + <ng-content select="ion-buttons[end],ion-buttons[right]"></ng-content>
'<div class="toolbar-content">' + <div class="toolbar-content">
'<ng-content></ng-content>' + <ng-content></ng-content>
'</div>', </div>
`,
directives: [BackButton, BackButtonText, Icon, ToolbarBackground],
host: { host: {
'[hidden]': '_hidden', '[hidden]': '_hidden',
'class': 'toolbar', 'class': 'toolbar',
'[class.statusbar-padding]': '_sbPadding' '[class.statusbar-padding]': '_sbPadding'
}, }
directives: [BackButton, BackButtonText, ToolbarBackground]
}) })
export class Navbar extends ToolbarBase { export class Navbar extends ToolbarBase {
private _bbIcon: string; private _bbIcon: string;

View File

@ -1,7 +1,9 @@
import { Component, ElementRef, EventEmitter, Input, HostListener, Output, QueryList, Renderer, ViewChild, ViewChildren, ViewEncapsulation } from '@angular/core'; import { Component, ElementRef, EventEmitter, Input, HostListener, Output, QueryList, Renderer, ViewChild, ViewChildren, ViewEncapsulation } from '@angular/core';
import { NgClass, NgFor, NgIf } from '@angular/common';
import { DomSanitizationService } from '@angular/platform-browser'; import { DomSanitizationService } from '@angular/platform-browser';
import { Animation } from '../../animations/animation'; import { Animation } from '../../animations/animation';
import { Backdrop } from '../backdrop/backdrop';
import { cancelRaf, pointerCoord, raf } from '../../util/dom'; import { cancelRaf, pointerCoord, raf } from '../../util/dom';
import { clamp, isNumber, isPresent, isString } from '../../util/util'; import { clamp, isNumber, isPresent, isString } from '../../util/util';
import { Config } from '../../config/config'; import { Config } from '../../config/config';
@ -28,6 +30,7 @@ import { ViewController } from '../nav/view-controller';
</div> </div>
<div *ngIf="col.suffix" class="picker-suffix" [style.width]="col.suffixWidth">{{col.suffix}}</div> <div *ngIf="col.suffix" class="picker-suffix" [style.width]="col.suffixWidth">{{col.suffix}}</div>
`, `,
directives: [NgFor, NgIf],
host: { host: {
'[style.min-width]': 'col.columnWidth', '[style.min-width]': 'col.columnWidth',
'[class.picker-opts-left]': 'col.align=="left"', '[class.picker-opts-left]': 'col.align=="left"',
@ -363,10 +366,10 @@ export class PickerColumnCmp {
</div> </div>
</div> </div>
`, `,
directives: [Backdrop, NgClass, NgFor, PickerColumnCmp],
host: { host: {
'role': 'dialog' 'role': 'dialog'
}, },
directives: [PickerColumnCmp],
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
}) })
export class PickerCmp { export class PickerCmp {

View File

@ -2,6 +2,7 @@ import { Component, ComponentResolver, ElementRef, HostListener, Renderer, ViewC
import { addSelector } from '../../config/bootstrap'; import { addSelector } from '../../config/bootstrap';
import { Animation } from '../../animations/animation'; import { Animation } from '../../animations/animation';
import { Backdrop } from '../backdrop/backdrop';
import { Config } from '../../config/config'; import { Config } from '../../config/config';
import { CSS, nativeRaf } from '../../util/dom'; import { CSS, nativeRaf } from '../../util/dom';
import { isPresent, pascalCaseToDashCase } from '../../util/util'; import { isPresent, pascalCaseToDashCase } from '../../util/util';
@ -27,7 +28,8 @@ import { ViewController } from '../nav/view-controller';
</div> </div>
</div> </div>
</div> </div>
` `,
directives: [Backdrop]
}) })
export class PopoverCmp { export class PopoverCmp {
@ViewChild('viewport', {read: ViewContainerRef}) viewport: ViewContainerRef; @ViewChild('viewport', {read: ViewContainerRef}) viewport: ViewContainerRef;

View File

@ -43,19 +43,20 @@ import { RadioGroup } from './radio-group';
*/ */
@Component({ @Component({
selector: 'ion-radio', selector: 'ion-radio',
template: template: `
'<div class="radio-icon" [class.radio-checked]="_checked">' + <div class="radio-icon" [class.radio-checked]="_checked">
'<div class="radio-inner"></div>' + <div class="radio-inner"></div>
'</div>' + </div>
'<button role="radio" ' + <button role="radio"
'type="button" ' + type="button"
'category="item-cover" ' + category="item-cover"
'[id]="id" ' + [id]="id"
'[attr.aria-checked]="_checked" ' + [attr.aria-checked]="_checked"
'[attr.aria-labelledby]="_labelId" ' + [attr.aria-labelledby]="_labelId"
'[attr.aria-disabled]="_disabled" ' + [attr.aria-disabled]="_disabled"
'class="item-cover">' + class="item-cover">
'</button>', </button>
`,
host: { host: {
'[class.radio-disabled]': '_disabled' '[class.radio-disabled]': '_disabled'
}, },

View File

@ -5,7 +5,7 @@ import { ListHeader } from '../list/list';
import { isCheckedProperty } from '../../util/util'; import { isCheckedProperty } from '../../util/util';
import { RadioButton } from './radio-button'; import { RadioButton } from './radio-button';
const RADIO_VALUE_ACCESSOR = new Provider( export const RADIO_VALUE_ACCESSOR = new Provider(
NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => RadioGroup), multi: true}); NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => RadioGroup), multi: true});
/** /**

View File

@ -1,4 +1,5 @@
import { AfterViewInit, Component, ElementRef, EventEmitter, forwardRef, Input, Inject, OnDestroy, OnInit, Optional, Output, Provider, QueryList, Renderer, ViewChild, ViewChildren, ViewEncapsulation } from '@angular/core'; import { AfterViewInit, Component, ElementRef, EventEmitter, forwardRef, Input, Inject, OnDestroy, OnInit, Optional, Output, Provider, QueryList, Renderer, ViewChild, ViewChildren, ViewEncapsulation } from '@angular/core';
import { NgFor, NgIf } from '@angular/common';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { clamp, isNumber, isPresent, isString, isTrueProperty } from '../../util/util'; import { clamp, isNumber, isPresent, isString, isTrueProperty } from '../../util/util';
@ -9,7 +10,7 @@ import { Item } from '../item/item';
import { UIEventManager } from '../../util/ui-event-manager'; import { UIEventManager } from '../../util/ui-event-manager';
const RANGE_VALUE_ACCESSOR = new Provider( export const RANGE_VALUE_ACCESSOR = new Provider(
NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => Range), multi: true}); NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => Range), multi: true});
/** /**
@ -17,9 +18,11 @@ const RANGE_VALUE_ACCESSOR = new Provider(
*/ */
@Component({ @Component({
selector: '.range-knob-handle', selector: '.range-knob-handle',
template: template: `
'<div class="range-pin" *ngIf="range.pin">{{_val}}</div>' + <div class="range-pin" *ngIf="range.pin">{{_val}}</div>
'<div class="range-knob"></div>', <div class="range-knob"></div>
`,
directives: [NgIf],
host: { host: {
'[class.range-knob-pressed]': 'pressed', '[class.range-knob-pressed]': 'pressed',
'[class.range-knob-min]': '_val===range.min', '[class.range-knob-min]': '_val===range.min',
@ -176,22 +179,23 @@ export class RangeKnob implements OnInit {
*/ */
@Component({ @Component({
selector: 'ion-range', selector: 'ion-range',
template: template: `
'<ng-content select="[range-left]"></ng-content>' + <ng-content select="[range-left]"></ng-content>
'<div class="range-slider" #slider>' + <div class="range-slider" #slider>
'<div class="range-tick" *ngFor="let t of _ticks" [style.left]="t.left" [class.range-tick-active]="t.active"></div>' + <div class="range-tick" *ngFor="let t of _ticks" [style.left]="t.left" [class.range-tick-active]="t.active"></div>
'<div class="range-bar"></div>' + <div class="range-bar"></div>
'<div class="range-bar range-bar-active" [style.left]="_barL" [style.right]="_barR" #bar></div>' + <div class="range-bar range-bar-active" [style.left]="_barL" [style.right]="_barR" #bar></div>
'<div class="range-knob-handle"></div>' + <div class="range-knob-handle"></div>
'<div class="range-knob-handle" [upper]="true" *ngIf="_dual"></div>' + <div class="range-knob-handle" [upper]="true" *ngIf="_dual"></div>
'</div>' + </div>
'<ng-content select="[range-right]"></ng-content>', <ng-content select="[range-right]"></ng-content>
`,
directives: [NgFor, NgIf, RangeKnob],
host: { host: {
'[class.range-disabled]': '_disabled', '[class.range-disabled]': '_disabled',
'[class.range-pressed]': '_pressed', '[class.range-pressed]': '_pressed',
'[class.range-has-pin]': '_pin' '[class.range-has-pin]': '_pin'
}, },
directives: [RangeKnob],
providers: [RANGE_VALUE_ACCESSOR], providers: [RANGE_VALUE_ACCESSOR],
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
}) })

View File

@ -1,7 +1,10 @@
import { Component, Input, ViewEncapsulation } from '@angular/core'; import { Component, Input, ViewEncapsulation } from '@angular/core';
import { NgIf } from '@angular/common';
import { Config } from '../../config/config'; import { Config } from '../../config/config';
import { Icon } from '../icon/icon';
import { Refresher } from './refresher'; import { Refresher } from './refresher';
import { Spinner } from '../spinner/spinner';
/** /**
@ -9,19 +12,21 @@ import { Refresher } from './refresher';
*/ */
@Component({ @Component({
selector: 'ion-refresher-content', selector: 'ion-refresher-content',
template: template: `
'<div class="refresher-pulling">' + <div class="refresher-pulling">
'<div class="refresher-pulling-icon" *ngIf="pullingIcon">' + <div class="refresher-pulling-icon" *ngIf="pullingIcon">
'<ion-icon [name]="pullingIcon"></ion-icon>' + <ion-icon [name]="pullingIcon"></ion-icon>
'</div>' + </div>
'<div class="refresher-pulling-text" [innerHTML]="pullingText" *ngIf="pullingText"></div>' + <div class="refresher-pulling-text" [innerHTML]="pullingText" *ngIf="pullingText"></div>
'</div>' + </div>
'<div class="refresher-refreshing">' + <div class="refresher-refreshing">
'<div class="refresher-refreshing-icon">' + <div class="refresher-refreshing-icon">
'<ion-spinner [name]="refreshingSpinner"></ion-spinner>' + <ion-spinner [name]="refreshingSpinner"></ion-spinner>
'</div>' + </div>
'<div class="refresher-refreshing-text" [innerHTML]="refreshingText" *ngIf="refreshingText"></div>' + <div class="refresher-refreshing-text" [innerHTML]="refreshingText" *ngIf="refreshingText"></div>
'</div>', </div>
`,
directives: [Icon, NgIf, Spinner],
host: { host: {
'[attr.state]': 'r.state' '[attr.state]': 'r.state'
}, },

View File

@ -1,7 +1,8 @@
import { Component, Directive, ElementRef, EventEmitter, HostBinding, Input, Optional, Output, ViewChild, ViewEncapsulation } from '@angular/core'; import { Component, Directive, ElementRef, EventEmitter, HostBinding, Input, Optional, Output, ViewChild, ViewEncapsulation } from '@angular/core';
import { NgControl} from '@angular/forms'; import { NgControl, NgModel } from '@angular/forms';
import { Config } from '../../config/config'; import { Config } from '../../config/config';
import { Icon } from '../icon/icon';
import { isPresent } from '../../util/util'; import { isPresent } from '../../util/util';
import { Debouncer } from '../../util/debouncer'; import { Debouncer } from '../../util/debouncer';
@ -27,12 +28,6 @@ import { Debouncer } from '../../util/debouncer';
*/ */
@Component({ @Component({
selector: 'ion-searchbar', selector: 'ion-searchbar',
host: {
'[class.searchbar-has-value]': '_value',
'[class.searchbar-active]': '_isActive',
'[class.searchbar-show-cancel]': 'showCancelButton',
'[class.searchbar-left-aligned]': 'shouldAlignLeft()'
},
template: template:
'<div class="searchbar-input-container">' + '<div class="searchbar-input-container">' +
'<button (click)="cancelSearchbar($event)" (mousedown)="cancelSearchbar($event)" clear dark class="searchbar-md-cancel">' + '<button (click)="cancelSearchbar($event)" (mousedown)="cancelSearchbar($event)" clear dark class="searchbar-md-cancel">' +
@ -43,6 +38,13 @@ import { Debouncer } from '../../util/debouncer';
'<button clear class="searchbar-clear-icon" (click)="clearInput($event)" (mousedown)="clearInput($event)"></button>' + '<button clear class="searchbar-clear-icon" (click)="clearInput($event)" (mousedown)="clearInput($event)"></button>' +
'</div>' + '</div>' +
'<button #cancelButton [tabindex]="_isActive ? 1 : -1" clear (click)="cancelSearchbar($event)" (mousedown)="cancelSearchbar($event)" class="searchbar-ios-cancel">{{cancelButtonText}}</button>', '<button #cancelButton [tabindex]="_isActive ? 1 : -1" clear (click)="cancelSearchbar($event)" (mousedown)="cancelSearchbar($event)" class="searchbar-ios-cancel">{{cancelButtonText}}</button>',
directives: [Icon, NgModel],
host: {
'[class.searchbar-has-value]': '_value',
'[class.searchbar-active]': '_isActive',
'[class.searchbar-show-cancel]': 'showCancelButton',
'[class.searchbar-left-aligned]': 'shouldAlignLeft()'
},
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
}) })
export class Searchbar { export class Searchbar {

View File

@ -42,9 +42,10 @@ import { isPresent, isTrueProperty } from '../../util/util';
*/ */
@Component({ @Component({
selector: 'ion-segment-button', selector: 'ion-segment-button',
template: template: `
'<ng-content></ng-content>' + <ng-content></ng-content>
'<ion-button-effect></ion-button-effect>', <ion-button-effect></ion-button-effect>
`,
host: { host: {
'tappable': '', 'tappable': '',
'class': 'segment-button', 'class': 'segment-button',

View File

@ -1,4 +1,5 @@
import { AfterContentInit, Component, ContentChildren, ElementRef, EventEmitter, forwardRef, Input, HostListener, OnDestroy, Optional, Output, Provider, Renderer, QueryList, ViewEncapsulation } from '@angular/core'; import { AfterContentInit, Component, ContentChildren, ElementRef, EventEmitter, forwardRef, Input, HostListener, OnDestroy, Optional, Output, Provider, Renderer, QueryList, ViewEncapsulation } from '@angular/core';
import { NgIf } from '@angular/common';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { ActionSheet } from '../action-sheet/action-sheet'; import { ActionSheet } from '../action-sheet/action-sheet';
@ -10,7 +11,7 @@ import { Item } from '../item/item';
import { NavController } from '../nav/nav-controller'; import { NavController } from '../nav/nav-controller';
import { Option } from '../option/option'; import { Option } from '../option/option';
const SELECT_VALUE_ACCESSOR = new Provider( export const SELECT_VALUE_ACCESSOR = new Provider(
NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => Select), multi: true}); NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => Select), multi: true});
@ -116,19 +117,21 @@ const SELECT_VALUE_ACCESSOR = new Provider(
*/ */
@Component({ @Component({
selector: 'ion-select', selector: 'ion-select',
template: template: `
'<div *ngIf="!_text" class="select-placeholder select-text">{{placeholder}}</div>' + <div *ngIf="!_text" class="select-placeholder select-text">{{placeholder}}</div>
'<div *ngIf="_text" class="select-text">{{_text}}</div>' + <div *ngIf="_text" class="select-text">{{_text}}</div>
'<div class="select-icon">' + <div class="select-icon">
'<div class="select-icon-inner"></div>' + <div class="select-icon-inner"></div>
'</div>' + </div>
'<button aria-haspopup="true" ' + <button aria-haspopup="true"
'[id]="id" ' + [id]="id"
'category="item-cover" ' + category="item-cover"
'[attr.aria-labelledby]="_labelId" ' + [attr.aria-labelledby]="_labelId"
'[attr.aria-disabled]="_disabled" ' + [attr.aria-disabled]="_disabled"
'class="item-cover">' + class="item-cover">
'</button>', </button>
`,
directives: [NgIf],
host: { host: {
'[class.select-disabled]': '_disabled' '[class.select-disabled]': '_disabled'
}, },

View File

@ -1,4 +1,5 @@
import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@angular/core'; import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@angular/core';
import { NgFor, NgStyle } from '@angular/common';
import { Config } from '../../config/config'; import { Config } from '../../config/config';
@ -97,13 +98,15 @@ import { Config } from '../../config/config';
*/ */
@Component({ @Component({
selector: 'ion-spinner', selector: 'ion-spinner',
template: template: `
'<svg viewBox="0 0 64 64" *ngFor="let i of _c" [ngStyle]="i.style">' + <svg viewBox="0 0 64 64" *ngFor="let i of _c" [ngStyle]="i.style">
'<circle [attr.r]="i.r" transform="translate(32,32)"></circle>' + <circle [attr.r]="i.r" transform="translate(32,32)"></circle>
'</svg>' + </svg>
'<svg viewBox="0 0 64 64" *ngFor="let i of _l" [ngStyle]="i.style">' + <svg viewBox="0 0 64 64" *ngFor="let i of _l" [ngStyle]="i.style">
'<line [attr.y1]="i.y1" [attr.y2]="i.y2" transform="translate(32,32)"></line>' + <line [attr.y1]="i.y1" [attr.y2]="i.y2" transform="translate(32,32)"></line>
'</svg>', </svg>
`,
directives: [NgFor, NgStyle],
host: { host: {
'[class]': '_applied', '[class]': '_applied',
'[class.spinner-paused]': 'paused' '[class.spinner-paused]': 'paused'

View File

@ -1,8 +1,11 @@
import { Component, ElementRef, EventEmitter, Input, Output, Optional, Renderer, ViewChild, ViewContainerRef, ViewEncapsulation } from '@angular/core'; import { Component, ElementRef, EventEmitter, Input, Output, Optional, Renderer, ViewChild, ViewContainerRef, ViewEncapsulation } from '@angular/core';
import { NgClass, NgFor, NgIf } from '@angular/common';
import { App } from '../app/app'; import { App } from '../app/app';
import { Badge } from '../badge/badge';
import { Config } from '../../config/config'; import { Config } from '../../config/config';
import { Content } from '../content/content'; import { Content } from '../content/content';
import { Icon } from '../icon/icon';
import { Ion } from '../ion'; import { Ion } from '../ion';
import { isBlank, isTrueProperty } from '../../util/util'; import { isBlank, isTrueProperty } from '../../util/util';
import { nativeRaf } from '../../util/dom'; import { nativeRaf } from '../../util/dom';
@ -134,22 +137,20 @@ import { ViewController } from '../nav/view-controller';
*/ */
@Component({ @Component({
selector: 'ion-tabs', selector: 'ion-tabs',
template: template: `
'<ion-tabbar role="tablist" #tabbar>' + <ion-tabbar role="tablist" #tabbar>
'<a *ngFor="let t of _tabs" [tab]="t" class="tab-button" [class.tab-disabled]="!t.enabled" [class.tab-hidden]="!t.show" role="tab" href="#" (ionSelect)="select($event)">' + <a *ngFor="let t of _tabs" [tab]="t" class="tab-button" [class.tab-disabled]="!t.enabled" [class.tab-hidden]="!t.show" role="tab" href="#" (ionSelect)="select($event)">
'<ion-icon *ngIf="t.tabIcon" [name]="t.tabIcon" [isActive]="t.isSelected" class="tab-button-icon"></ion-icon>' + <ion-icon *ngIf="t.tabIcon" [name]="t.tabIcon" [isActive]="t.isSelected" class="tab-button-icon"></ion-icon>
'<span *ngIf="t.tabTitle" class="tab-button-text">{{t.tabTitle}}</span>' + <span *ngIf="t.tabTitle" class="tab-button-text">{{t.tabTitle}}</span>
'<ion-badge *ngIf="t.tabBadge" class="tab-badge" [ngClass]="\'badge-\' + t.tabBadgeStyle">{{t.tabBadge}}</ion-badge>' + <ion-badge *ngIf="t.tabBadge" class="tab-badge" [ngClass]="\'badge-\' + t.tabBadgeStyle">{{t.tabBadge}}</ion-badge>
'<ion-button-effect></ion-button-effect>' + <ion-button-effect></ion-button-effect>
'</a>' + </a>
'<tab-highlight></tab-highlight>' + <tab-highlight></tab-highlight>
'</ion-tabbar>' + </ion-tabbar>
'<ng-content></ng-content>' + <ng-content></ng-content>
'<div #portal tab-portal></div>', <div #portal tab-portal></div>
directives: [ `,
TabButton, directives: [Badge, Icon, NgClass, NgFor, NgIf, TabButton, TabHighlight],
TabHighlight
],
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
}) })
export class Tabs extends Ion { export class Tabs extends Ion {

View File

@ -1,4 +1,5 @@
import { AfterViewInit, Component, ElementRef, Renderer } from '@angular/core'; import { AfterViewInit, Component, ElementRef, Renderer } from '@angular/core';
import { NgIf } from '@angular/common';
import { Animation } from '../../animations/animation'; import { Animation } from '../../animations/animation';
import { Config } from '../../config/config'; import { Config } from '../../config/config';
@ -27,6 +28,7 @@ import { ViewController } from '../nav/view-controller';
</div> </div>
</div> </div>
`, `,
directives: [NgIf],
host: { host: {
'role': 'dialog', 'role': 'dialog',
'[attr.aria-labelledby]': 'hdrId', '[attr.aria-labelledby]': 'hdrId',

View File

@ -8,7 +8,7 @@ import { pointerCoord } from '../../util/dom';
import { UIEventManager } from '../../util/ui-event-manager'; import { UIEventManager } from '../../util/ui-event-manager';
const TOGGLE_VALUE_ACCESSOR = new Provider( export const TOGGLE_VALUE_ACCESSOR = new Provider(
NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => Toggle), multi: true}); NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => Toggle), multi: true});
@ -51,19 +51,20 @@ const TOGGLE_VALUE_ACCESSOR = new Provider(
*/ */
@Component({ @Component({
selector: 'ion-toggle', selector: 'ion-toggle',
template: template: `
'<div class="toggle-icon" [class.toggle-checked]="_checked" [class.toggle-activated]="_activated">' + <div class="toggle-icon" [class.toggle-checked]="_checked" [class.toggle-activated]="_activated">
'<div class="toggle-inner"></div>' + <div class="toggle-inner"></div>
'</div>' + </div>
'<button role="checkbox" ' + <button role="checkbox"
'type="button" ' + type="button"
'category="item-cover" ' + category="item-cover"
'[id]="id" ' + [id]="id"
'[attr.aria-checked]="_checked" ' + [attr.aria-checked]="_checked"
'[attr.aria-labelledby]="_labelId" ' + [attr.aria-labelledby]="_labelId"
'[attr.aria-disabled]="_disabled" ' + [attr.aria-disabled]="_disabled"
'class="item-cover">' + class="item-cover">
'</button>', </button>
`,
host: { host: {
'[class.toggle-disabled]': '_disabled' '[class.toggle-disabled]': '_disabled'
}, },

View File

@ -190,14 +190,15 @@ export class ToolbarBase extends Ion {
*/ */
@Component({ @Component({
selector: 'ion-toolbar', selector: 'ion-toolbar',
template: template: `
'<div class="toolbar-background"></div>' + <div class="toolbar-background"></div>
'<ng-content select="[menuToggle],ion-buttons[left]"></ng-content>' + <ng-content select="[menuToggle],ion-buttons[left]"></ng-content>
'<ng-content select="ion-buttons[start]"></ng-content>' + <ng-content select="ion-buttons[start]"></ng-content>
'<ng-content select="ion-buttons[end],ion-buttons[right]"></ng-content>' + <ng-content select="ion-buttons[end],ion-buttons[right]"></ng-content>
'<div class="toolbar-content">' + <div class="toolbar-content">
'<ng-content></ng-content>' + <ng-content></ng-content>
'</div>', </div>
`,
host: { host: {
'class': 'toolbar', 'class': 'toolbar',
'[class.statusbar-padding]': '_sbPadding' '[class.statusbar-padding]': '_sbPadding'