ionic-angular
Version:
A powerful framework for building mobile and progressive web apps with JavaScript and Angular 2
191 lines (190 loc) • 6.01 kB
TypeScript
import { ElementRef, EventEmitter, QueryList, Renderer } from '@angular/core';
import { NgControl } from '@angular/forms';
import { Config } from '../../config/config';
import { Ion } from '../ion';
/**
* @name SegmentButton
* @description
* The child buttons of the `ion-segment` component. Each `ion-segment-button` must have a value.
*
* @usage
*
* ```html
* <ion-content>
* <!-- Segment buttons with icons -->
* <ion-segment [(ngModel)]="icons" color="secondary">
* <ion-segment-button value="camera">
* <ion-icon name="camera"></ion-icon>
* </ion-segment-button>
* <ion-segment-button value="bookmark">
* <ion-icon name="bookmark"></ion-icon>
* </ion-segment-button>
* </ion-segment>
*
* <!-- Segment buttons with text -->
* <ion-segment [(ngModel)]="relationship" color="primary">
* <ion-segment-button value="friends" (ionSelect)="selectedFriends()">
* Friends
* </ion-segment-button>
* <ion-segment-button value="enemies" (ionSelect)="selectedEnemies()">
* Enemies
* </ion-segment-button>
* </ion-segment>
* </ion-content>
* ```
*
*
* @demo /docs/v2/demos/src/segment/
* @see {@link /docs/v2/components#segment Segment Component Docs}
* @see {@link /docs/v2/api/components/segment/Segment/ Segment API Docs}
*/
export declare class SegmentButton {
private _renderer;
private _elementRef;
_disabled: boolean;
/**
* @input {string} the value of the segment button. Required.
*/
value: string;
/**
* @output {SegmentButton} Emitted when a segment button has been clicked.
*/
ionSelect: EventEmitter<SegmentButton>;
constructor(_renderer: Renderer, _elementRef: ElementRef);
/**
* @input {boolean} If true, the user cannot interact with this element.
*/
disabled: boolean;
/**
* @private
*/
_setElementClass(cssClass: string, shouldAdd: boolean): void;
/**
* @private
* On click of a SegmentButton
*/
onClick(): void;
/**
* @private
*/
ngOnInit(): void;
/**
* @private
*/
isActive: any;
}
/**
* @name Segment
* @description
* A Segment is a group of buttons, sometimes known as Segmented Controls, that allow the user to interact with a compact group of a number of controls.
* Segments provide functionality similar to tabs, selecting one will unselect all others. You should use a tab bar instead of a segmented control when you want to let the user move back and forth between distinct pages in your app.
* You could use Angular 2's `ngModel` or `FormBuilder` API. For an overview on how `FormBuilder` works, checkout [Angular 2 Forms](http://learnangular2.com/forms/), or [Angular FormBuilder](https://angular.io/docs/ts/latest/api/forms/index/FormBuilder-class.html)
*
*
* ```html
* <!-- Segment in a header -->
* <ion-header>
* <ion-toolbar>
* <ion-segment [(ngModel)]="icons" color="secondary">
* <ion-segment-button value="camera">
* <ion-icon name="camera"></ion-icon>
* </ion-segment-button>
* <ion-segment-button value="bookmark">
* <ion-icon name="bookmark"></ion-icon>
* </ion-segment-button>
* </ion-segment>
* </ion-toolbar>
* </ion-header>
*
* <ion-content>
* <!-- Segment in content -->
* <ion-segment [(ngModel)]="relationship" color="primary">
* <ion-segment-button value="friends" (ionSelect)="selectedFriends()">
* Friends
* </ion-segment-button>
* <ion-segment-button value="enemies" (ionSelect)="selectedEnemies()">
* Enemies
* </ion-segment-button>
* </ion-segment>
*
* <!-- Segment in a form -->
* <form [formGroup]="myForm">
* <ion-segment formControlName="mapStyle" color="danger">
* <ion-segment-button value="standard">
* Standard
* </ion-segment-button>
* <ion-segment-button value="hybrid">
* Hybrid
* </ion-segment-button>
* <ion-segment-button value="sat">
* Satellite
* </ion-segment-button>
* </ion-segment>
* </form>
* </ion-content>
* ```
*
*
* @demo /docs/v2/demos/src/segment/
* @see {@link /docs/v2/components#segment Segment Component Docs}
* @see [Angular 2 Forms](http://learnangular2.com/forms/)
*/
export declare class Segment extends Ion {
_disabled: boolean;
/**
* @private
*/
value: string;
/**
* @input {string} The color to use from your Sass `$colors` map.
* Default options are: `"primary"`, `"secondary"`, `"danger"`, `"light"`, and `"dark"`.
* For more information, see [Theming your App](/docs/v2/theming/theming-your-app).
*/
color: string;
/**
* @input {string} The mode determines which platform styles to use.
* Possible values are: `"ios"`, `"md"`, or `"wp"`.
* For more information, see [Platform Styles](/docs/v2/theming/platform-specific-styles).
*/
mode: string;
/**
* @output {Any} Emitted when a segment button has been changed.
*/
ionChange: EventEmitter<SegmentButton>;
/**
* @private
*/
_buttons: QueryList<SegmentButton>;
constructor(config: Config, elementRef: ElementRef, renderer: Renderer, ngControl: NgControl);
/**
* @input {boolean} If true, the user cannot interact with any of the buttons in the segment.
*/
disabled: boolean;
/**
* @private
* Write a new value to the element.
*/
writeValue(value: any): void;
/**
* @private
*/
ngAfterViewInit(): void;
/**
* @private
*/
onChange: (_: any) => void;
/**
* @private
*/
onTouched: (_: any) => void;
/**
* @private
* Set the function to be called when the control receives a change event.
*/
registerOnChange(fn: any): void;
/**
* @private
* Set the function to be called when the control receives a touch event.
*/
registerOnTouched(fn: any): void;
}