a zip code crypto-currency system good for red ONLY

segment.js 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. var __extends = (this && this.__extends) || (function () {
  2. var extendStatics = Object.setPrototypeOf ||
  3. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  4. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5. return function (d, b) {
  6. extendStatics(d, b);
  7. function __() { this.constructor = d; }
  8. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9. };
  10. })();
  11. import { ContentChildren, Directive, ElementRef, Optional, Renderer } from '@angular/core';
  12. import { NgControl } from '@angular/forms';
  13. import { Config } from '../../config/config';
  14. import { BaseInput } from '../../util/base-input';
  15. import { SegmentButton } from './segment-button';
  16. /**
  17. * @name Segment
  18. * @description
  19. * 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.
  20. * 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.
  21. * You could use Angular's `ngModel` or `FormBuilder` API. For an overview on how `FormBuilder` works, checkout [Angular Forms](http://learnangular2.com/forms/), or [Angular FormBuilder](https://angular.io/docs/ts/latest/api/forms/index/FormBuilder-class.html)
  22. *
  23. *
  24. * ```html
  25. * <!-- Segment in a header -->
  26. * <ion-header>
  27. * <ion-toolbar>
  28. * <ion-segment [(ngModel)]="icons" color="secondary">
  29. * <ion-segment-button value="camera">
  30. * <ion-icon name="camera"></ion-icon>
  31. * </ion-segment-button>
  32. * <ion-segment-button value="bookmark">
  33. * <ion-icon name="bookmark"></ion-icon>
  34. * </ion-segment-button>
  35. * </ion-segment>
  36. * </ion-toolbar>
  37. * </ion-header>
  38. *
  39. * <ion-content>
  40. * <!-- Segment in content -->
  41. * <ion-segment [(ngModel)]="relationship" color="primary" (ionChange)="segmentChanged($event)">
  42. * <ion-segment-button value="friends">
  43. * Friends
  44. * </ion-segment-button>
  45. * <ion-segment-button value="enemies">
  46. * Enemies
  47. * </ion-segment-button>
  48. * </ion-segment>
  49. *
  50. * <!-- Segment in a form -->
  51. * <form [formGroup]="myForm">
  52. * <ion-segment formControlName="mapStyle" color="danger">
  53. * <ion-segment-button value="standard">
  54. * Standard
  55. * </ion-segment-button>
  56. * <ion-segment-button value="hybrid">
  57. * Hybrid
  58. * </ion-segment-button>
  59. * <ion-segment-button value="sat">
  60. * Satellite
  61. * </ion-segment-button>
  62. * </ion-segment>
  63. * </form>
  64. * </ion-content>
  65. * ```
  66. *
  67. *
  68. * @demo /docs/demos/src/segment/
  69. * @see {@link /docs/components#segment Segment Component Docs}
  70. * @see [Angular Forms](http://learnangular2.com/forms/)
  71. */
  72. var Segment = (function (_super) {
  73. __extends(Segment, _super);
  74. function Segment(config, elementRef, renderer, ngControl) {
  75. return _super.call(this, config, elementRef, renderer, 'segment', null, null, null, ngControl) || this;
  76. }
  77. /**
  78. * @hidden
  79. */
  80. Segment.prototype.ngAfterContentInit = function () {
  81. var _this = this;
  82. this._initialize();
  83. this._buttons.forEach(function (button) {
  84. button.ionSelect.subscribe(function (selectedButton) {
  85. _this.value = selectedButton.value;
  86. _this._fireTouched();
  87. });
  88. });
  89. };
  90. /**
  91. * @hidden
  92. * Write a new value to the element.
  93. */
  94. Segment.prototype._inputUpdated = function () {
  95. if (!this._buttons) {
  96. (void 0) /* assert */;
  97. return;
  98. }
  99. var buttons = this._buttons.toArray();
  100. var value = this.value;
  101. for (var _i = 0, buttons_1 = buttons; _i < buttons_1.length; _i++) {
  102. var button = buttons_1[_i];
  103. button.isActive = (button.value === value);
  104. }
  105. };
  106. Segment.decorators = [
  107. { type: Directive, args: [{
  108. selector: 'ion-segment',
  109. host: {
  110. '[class.segment-disabled]': '_disabled'
  111. }
  112. },] },
  113. ];
  114. /** @nocollapse */
  115. Segment.ctorParameters = function () { return [
  116. { type: Config, },
  117. { type: ElementRef, },
  118. { type: Renderer, },
  119. { type: NgControl, decorators: [{ type: Optional },] },
  120. ]; };
  121. Segment.propDecorators = {
  122. '_buttons': [{ type: ContentChildren, args: [SegmentButton,] },],
  123. };
  124. return Segment;
  125. }(BaseInput));
  126. export { Segment };
  127. //# sourceMappingURL=segment.js.map