a zip code crypto-currency system good for red ONLY

checkbox.js 6.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. (function (factory) {
  12. if (typeof module === "object" && typeof module.exports === "object") {
  13. var v = factory(require, exports);
  14. if (v !== undefined) module.exports = v;
  15. }
  16. else if (typeof define === "function" && define.amd) {
  17. define(["require", "exports", "@angular/core", "@angular/forms", "../../config/config", "../../util/util", "../../util/form", "../../util/base-input", "../item/item"], factory);
  18. }
  19. })(function (require, exports) {
  20. "use strict";
  21. Object.defineProperty(exports, "__esModule", { value: true });
  22. var core_1 = require("@angular/core");
  23. var forms_1 = require("@angular/forms");
  24. var config_1 = require("../../config/config");
  25. var util_1 = require("../../util/util");
  26. var form_1 = require("../../util/form");
  27. var base_input_1 = require("../../util/base-input");
  28. var item_1 = require("../item/item");
  29. /**
  30. * @name Checkbox
  31. * @module ionic
  32. *
  33. * @description
  34. * The Checkbox is a simple component styled based on the mode. It can be
  35. * placed in an `ion-item` or used as a stand-alone checkbox.
  36. *
  37. * See the [Angular Docs](https://angular.io/docs/ts/latest/guide/forms.html)
  38. * for more info on forms and inputs.
  39. *
  40. *
  41. * @usage
  42. * ```html
  43. *
  44. * <ion-list>
  45. *
  46. * <ion-item>
  47. * <ion-label>Pepperoni</ion-label>
  48. * <ion-checkbox [(ngModel)]="pepperoni"></ion-checkbox>
  49. * </ion-item>
  50. *
  51. * <ion-item>
  52. * <ion-label>Sausage</ion-label>
  53. * <ion-checkbox [(ngModel)]="sausage" disabled="true"></ion-checkbox>
  54. * </ion-item>
  55. *
  56. * <ion-item>
  57. * <ion-label>Mushrooms</ion-label>
  58. * <ion-checkbox [(ngModel)]="mushrooms"></ion-checkbox>
  59. * </ion-item>
  60. *
  61. * </ion-list>
  62. * ```
  63. *
  64. * @advanced
  65. *
  66. * ```html
  67. *
  68. * <!-- Call function when state changes -->
  69. * <ion-list>
  70. *
  71. * <ion-item>
  72. * <ion-label>Cucumber</ion-label>
  73. * <ion-checkbox [(ngModel)]="cucumber" (ionChange)="updateCucumber()"></ion-checkbox>
  74. * </ion-item>
  75. *
  76. * </ion-list>
  77. * ```
  78. *
  79. * ```ts
  80. * @Component({
  81. * templateUrl: 'main.html'
  82. * })
  83. * class SaladPage {
  84. * cucumber: boolean;
  85. *
  86. * updateCucumber() {
  87. * console.log('Cucumbers new state:' + this.cucumber);
  88. * }
  89. * }
  90. * ```
  91. *
  92. * @demo /docs/demos/src/checkbox/
  93. * @see {@link /docs/components#checkbox Checkbox Component Docs}
  94. */
  95. var Checkbox = (function (_super) {
  96. __extends(Checkbox, _super);
  97. function Checkbox(config, form, item, elementRef, renderer) {
  98. return _super.call(this, config, elementRef, renderer, 'checkbox', false, form, item, null) || this;
  99. }
  100. Object.defineProperty(Checkbox.prototype, "checked", {
  101. /**
  102. * @input {boolean} If true, the element is selected.
  103. */
  104. get: function () {
  105. return this.value;
  106. },
  107. set: function (val) {
  108. this.value = val;
  109. },
  110. enumerable: true,
  111. configurable: true
  112. });
  113. /**
  114. * @hidden
  115. */
  116. Checkbox.prototype._click = function (ev) {
  117. ev.preventDefault();
  118. ev.stopPropagation();
  119. this.value = !this.value;
  120. this._fireTouched();
  121. };
  122. /**
  123. * @hidden
  124. */
  125. Checkbox.prototype._inputNormalize = function (val) {
  126. return util_1.isTrueProperty(val);
  127. };
  128. /**
  129. * @hidden
  130. */
  131. Checkbox.prototype._inputUpdated = function () {
  132. this._item && this._item.setElementClass('item-checkbox-checked', this._value);
  133. };
  134. Checkbox.decorators = [
  135. { type: core_1.Component, args: [{
  136. selector: 'ion-checkbox',
  137. template: '<div class="checkbox-icon" [class.checkbox-checked]="_value">' +
  138. '<div class="checkbox-inner"></div>' +
  139. '</div>' +
  140. '<button role="checkbox" ' +
  141. 'type="button" ' +
  142. 'ion-button="item-cover" ' +
  143. '[id]="id" ' +
  144. '[attr.aria-checked]="_value" ' +
  145. '[attr.aria-labelledby]="_labelId" ' +
  146. '[attr.aria-disabled]="_disabled" ' +
  147. 'class="item-cover"> ' +
  148. '</button>',
  149. host: {
  150. '[class.checkbox-disabled]': '_disabled'
  151. },
  152. providers: [{ provide: forms_1.NG_VALUE_ACCESSOR, useExisting: Checkbox, multi: true }],
  153. encapsulation: core_1.ViewEncapsulation.None,
  154. },] },
  155. ];
  156. /** @nocollapse */
  157. Checkbox.ctorParameters = function () { return [
  158. { type: config_1.Config, },
  159. { type: form_1.Form, },
  160. { type: item_1.Item, decorators: [{ type: core_1.Optional },] },
  161. { type: core_1.ElementRef, },
  162. { type: core_1.Renderer, },
  163. ]; };
  164. Checkbox.propDecorators = {
  165. 'checked': [{ type: core_1.Input },],
  166. '_click': [{ type: core_1.HostListener, args: ['click', ['$event'],] },],
  167. };
  168. return Checkbox;
  169. }(base_input_1.BaseInput));
  170. exports.Checkbox = Checkbox;
  171. });
  172. //# sourceMappingURL=checkbox.js.map