a zip code crypto-currency system good for red ONLY

item.js 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  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", "../button/button", "../../config/config", "../../util/form", "../icon/icon", "../ion", "../label/label", "./item-reorder"], 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 button_1 = require("../button/button");
  24. var config_1 = require("../../config/config");
  25. var form_1 = require("../../util/form");
  26. var icon_1 = require("../icon/icon");
  27. var ion_1 = require("../ion");
  28. var label_1 = require("../label/label");
  29. var item_reorder_1 = require("./item-reorder");
  30. /**
  31. * @name Item
  32. * @description
  33. * An item can contain text, images, and anything else. Generally it is placed in a list with other
  34. * items. It can easily be swiped, deleted, reordered, edited, and more. An item is only required to
  35. * be in a [List](../../list/List) if manipulating the item via gestures is required. It requires an
  36. * [ItemSliding](../ItemSliding) wrapper element in order to be swiped.
  37. *
  38. *
  39. * ## Common Usage
  40. * There are a few elements that are considered items, but not all of them are styled to look the same.
  41. * The basic item can be written as an `<ion-item>` element or it can be added to any element by adding
  42. * `ion-item` as an attribute. List headers and item dividers, although styled differently, are also items
  43. * and can be written as `<ion-list-header>` and `<ion-item-divider>`, respectively.
  44. *
  45. * ### As an Element
  46. * A basic item should be written as a `<ion-item>` element when it is not clickable.
  47. *
  48. * ```html
  49. * <ion-item>
  50. * Item
  51. * </ion-item>
  52. * ```
  53. *
  54. * A list header should be written as `<ion-list-header>`.
  55. *
  56. * ```html
  57. * <ion-list-header>
  58. * List Header
  59. * </ion-list-header>
  60. * ```
  61. *
  62. * An item divider should be written as `<ion-item-divider>`.
  63. *
  64. * ```html
  65. * <ion-item-divider>
  66. * Item Divider
  67. * </ion-item-divider>
  68. * ```
  69. *
  70. * ### As an Attribute
  71. * The attribute `ion-item` should be added to a `<button>` when the item can be clicked or tapped. It
  72. * should be added to an `<a>` element when the item needs to contain a `href`. It can be added as an
  73. * attribute to any element to take on the item styling.
  74. *
  75. * ```html
  76. * <button ion-item (click)="buttonClick()">
  77. * Button Item
  78. * </button>
  79. *
  80. * <a ion-item href="https://www.ionicframework.com">
  81. * Anchor Item
  82. * </a>
  83. * ```
  84. *
  85. * Note: do not add `ion-item` as an attribute to an `<ion-list-header>` or `<ion-item-divider>` element
  86. * as they are already items and their styling will be changed to look like a basic item.
  87. *
  88. * ## Detail Arrows
  89. * By default, `<button>` and `<a>` elements with the `ion-item` attribute will display a right arrow icon
  90. * on `ios` mode. To hide the right arrow icon on either of these elements, add the `detail-none` attribute
  91. * to the item. To show the right arrow icon on an element that doesn't display it naturally, add the
  92. * `detail-push` attribute to the item.
  93. *
  94. * ```html
  95. * <ion-item detail-push>
  96. * Item with Detail Arrow
  97. * </ion-item>
  98. *
  99. * <button ion-item (click)="buttonClick()">
  100. * Button Item with Detail Arrow
  101. * </button>
  102. *
  103. * <a ion-item detail-none href="https://www.ionicframework.com">
  104. * Anchor Item with no Detail Arrow
  105. * </a>
  106. * ```
  107. *
  108. * This feature is not enabled by default for `md` and `wp` modes, but it can be enabled by setting the
  109. * Sass variables `$item-md-detail-push-show` and `$item-wp-detail-push-show`, respectively, to `true`.
  110. * It can also be disabled for ios by setting `$item-ios-detail-push-show` to `false`. See the
  111. * [theming documentation](http://ionicframework.com/docs/theming/overriding-ionic-variables/) for
  112. * more information on overriding Sass variables.
  113. *
  114. *
  115. * ## Item Placement
  116. * Items rely heavily on content projection to position content. The item grabs content based on the
  117. * element or attribute and positions it that way. This logic makes it possible to write a complex
  118. * item with simple, understandable markup without having to worry about styling and positioning
  119. * the elements.
  120. *
  121. * The below chart details the attributes item looks for and where it will place the element with
  122. * that attribute inside of the item:
  123. *
  124. * | Attribute | Description |
  125. * |----------------|----------------------------------------------------------------------------------------------------- |
  126. * | `item-start` | Placed to the left of all other elements, outside of the inner item. |
  127. * | `item-end` | Placed to the right of all other elements, inside of the inner item, outside of the input wrapper. |
  128. * | `item-content` | Placed to the right of any `ion-label`, inside of the input wrapper. |
  129. *
  130. * ### Checkboxes, Radios and Toggles
  131. * [Checkboxes](../../checkbox/Checkbox) are positioned in the same place as the `item-start` attribute.
  132. * [Radios](../../radio/RadioButton) and [Toggles](../../toggle/Toggle) are positioned in the same place
  133. * as the `item-end` attribute. All of these components can be positioned differently by adding the
  134. * `item-start` or `item-end` attribute.
  135. *
  136. * ### Content and Inputs
  137. * A [Label](../../label/Label) is placed inside of the item to the left of all content and inputs. The
  138. * following components are all placed in the same position as the `item-content` attribute: [Select](../../select/Select),
  139. * [Input](../../input/Input), [TextArea](../../input/TextArea), [DateTime](../../datetime/DateTime), and
  140. * [Range](../../range/Range).
  141. *
  142. * Any element directly placed inside of an `<ion-item>` that does not have one of the previously mentioned
  143. * attributes and isn't one of the above elements will be placed inside of a [Label](../../label/Label).
  144. *
  145. * ### Text Alignment
  146. * By default, Items will align text to the left and add an ellipsis when the text is wider than the item.
  147. * See the [Utility Attributes Documentation](../../../../theming/css-utilities/) for attributes that can
  148. * be added to `ion-item` to transform the text.
  149. *
  150. * @usage
  151. *
  152. * ```html
  153. * <ion-list>
  154. *
  155. * <ion-list-header>
  156. * Header
  157. * </ion-list-header>
  158. *
  159. * <ion-item>
  160. * Item
  161. * </ion-item>
  162. *
  163. * <ion-item detail-push>
  164. * Item with Detail Arrow
  165. * </ion-item>
  166. *
  167. * <button ion-item (click)="buttonClick()">
  168. * Button Item
  169. * </button>
  170. *
  171. * <ion-item-divider>
  172. * Item Divider
  173. * </ion-item-divider>
  174. *
  175. * <button ion-item detail-none (click)="buttonClick()">
  176. * Button Item with no Detail Arrow
  177. * </button>
  178. *
  179. * <a ion-item href="https://www.ionicframework.com">
  180. * Anchor Item
  181. * </a>
  182. *
  183. * <ion-item no-lines>
  184. * Item with no border
  185. * </ion-item>
  186. *
  187. * <ion-item text-wrap>
  188. * Multiline text that should wrap when it is too long
  189. * to fit on one line in the item.
  190. * </ion-item>
  191. *
  192. * </ion-list>
  193. * ```
  194. *
  195. *
  196. * @advanced
  197. *
  198. * ```html
  199. * <ion-list>
  200. *
  201. * <!-- List header with buttons on each side -->
  202. * <ion-list-header>
  203. * <button ion-button item-start (click)="buttonClick()">Button</button>
  204. * List Header
  205. * <button ion-button outline item-end (click)="buttonClick()">Outline</button>
  206. * </ion-list-header>
  207. *
  208. * <!-- Loops through and creates multiple items -->
  209. * <ion-item *ngFor="let item of items">
  210. * Item {% raw %}{{item}}{% endraw %}
  211. * </ion-item>
  212. *
  213. * <!-- Button item with an icon on the left -->
  214. * <button ion-item>
  215. * <ion-icon name="star" item-start></ion-icon>
  216. * Button Item
  217. * </button>
  218. *
  219. * <!-- Item with a label and content -->
  220. * <ion-item>
  221. * <ion-label>
  222. * Item Label
  223. * </ion-label>
  224. * <div item-content>
  225. * Item Content next to the label
  226. * </div>
  227. * </ion-item>
  228. *
  229. * <!-- Item with left and right buttons -->
  230. * <ion-item>
  231. * <button ion-button item-start (click)="buttonClick()">Button</button>
  232. * Item
  233. * <button ion-button outline item-end (click)="buttonClick()">Outline</button>
  234. * </ion-item>
  235. *
  236. * <!-- Item divider with a right button -->
  237. * <ion-item-divider>
  238. * Item Divider
  239. * <button ion-button item-end>Button</button>
  240. * </ion-item-divider>
  241. *
  242. * <!-- Disabled button item with left and right buttons -->
  243. * <button ion-item disabled>
  244. * <button ion-button item-start (click)="buttonClick()">
  245. * <ion-icon name="home"></ion-icon>
  246. * Left Icon
  247. * </button>
  248. * Disabled Button Item
  249. * <button ion-button outline item-end (click)="buttonClick()">
  250. * <ion-icon name="star"></ion-icon>
  251. * Left Icon
  252. * </button>
  253. * </button>
  254. *
  255. * <!-- Item with an avatar on the left and button on the right -->
  256. * <ion-item>
  257. * <ion-avatar item-start>
  258. * <img src="img/my-avatar.png">
  259. * </ion-avatar>
  260. * Avatar Item
  261. * <button ion-button outline item-end>View</button>
  262. * </ion-item>
  263. *
  264. * <!-- Item with a thumbnail on the right -->
  265. * <ion-item>
  266. * <h2>Item</h2>
  267. * <p>Item Paragraph</p>
  268. * <ion-thumbnail item-end>
  269. * <img src="img/my-thumbnail.png">
  270. * </ion-thumbnail>
  271. * </ion-item>
  272. *
  273. * <!-- Sliding item -->
  274. * <ion-item-sliding>
  275. * <ion-item>
  276. * Item
  277. * </ion-item>
  278. * <ion-item-options>
  279. * <button ion-button color="primary" (click)="archive()">Archive</button>
  280. * </ion-item-options>
  281. * </ion-item-sliding>
  282. *
  283. * </ion-list>
  284. * ```
  285. *
  286. *
  287. * @demo /docs/demos/src/item/
  288. * @see {@link /docs/components#lists List Component Docs}
  289. * @see {@link ../../list/List List API Docs}
  290. * @see {@link ../ItemSliding ItemSliding API Docs}
  291. */
  292. var Item = (function (_super) {
  293. __extends(Item, _super);
  294. function Item(form, config, elementRef, renderer, reorder) {
  295. var _this = _super.call(this, config, elementRef, renderer, 'item') || this;
  296. _this._ids = -1;
  297. _this._inputs = [];
  298. _this._viewLabel = true;
  299. _this._name = 'item';
  300. /**
  301. * @hidden
  302. */
  303. _this.labelId = null;
  304. _this._setName(elementRef);
  305. _this._hasReorder = !!reorder;
  306. _this.id = form.nextId().toString();
  307. _this.labelId = 'lbl-' + _this.id;
  308. // auto add "tappable" attribute to ion-item components that have a click listener
  309. if (!renderer.orgListen) {
  310. renderer.orgListen = renderer.listen;
  311. renderer.listen = function (renderElement, name, callback) {
  312. if (name === 'click' && renderElement.setAttribute) {
  313. renderElement.setAttribute('tappable', '');
  314. }
  315. return renderer.orgListen(renderElement, name, callback);
  316. };
  317. }
  318. return _this;
  319. }
  320. /**
  321. * @hidden
  322. */
  323. Item.prototype.registerInput = function (type) {
  324. this._inputs.push(type);
  325. return this.id + '-' + (++this._ids);
  326. };
  327. /**
  328. * @hidden
  329. */
  330. Item.prototype.ngAfterContentInit = function () {
  331. if (this._viewLabel && this._inputs.length) {
  332. var labelText = this.getLabelText().trim();
  333. this._viewLabel = (labelText.length > 0);
  334. }
  335. if (this._inputs.length > 1) {
  336. this.setElementClass('item-multiple-inputs', true);
  337. }
  338. };
  339. /**
  340. * @hidden
  341. */
  342. Item.prototype._updateColor = function (newColor, componentName) {
  343. componentName = componentName || 'item'; // item-radio
  344. this._setColor(newColor, componentName);
  345. };
  346. /**
  347. * @hidden
  348. */
  349. Item.prototype._setName = function (elementRef) {
  350. var nodeName = elementRef.nativeElement.nodeName.replace('ION-', '');
  351. if (nodeName === 'LIST-HEADER' || nodeName === 'ITEM-DIVIDER') {
  352. this._name = nodeName;
  353. }
  354. };
  355. /**
  356. * @hidden
  357. */
  358. Item.prototype.getLabelText = function () {
  359. return this._label ? this._label.text : '';
  360. };
  361. Object.defineProperty(Item.prototype, "contentLabel", {
  362. /**
  363. * @hidden
  364. */
  365. set: function (label) {
  366. if (label) {
  367. this._label = label;
  368. label.id = this.labelId;
  369. if (label.type) {
  370. this.setElementClass('item-label-' + label.type, true);
  371. }
  372. this._viewLabel = false;
  373. }
  374. },
  375. enumerable: true,
  376. configurable: true
  377. });
  378. Object.defineProperty(Item.prototype, "viewLabel", {
  379. /**
  380. * @hidden
  381. */
  382. set: function (label) {
  383. if (!this._label) {
  384. this._label = label;
  385. }
  386. },
  387. enumerable: true,
  388. configurable: true
  389. });
  390. Object.defineProperty(Item.prototype, "_buttons", {
  391. /**
  392. * @hidden
  393. */
  394. set: function (buttons) {
  395. buttons.forEach(function (button) {
  396. if (!button._size) {
  397. button.setElementClass('item-button', true);
  398. }
  399. });
  400. },
  401. enumerable: true,
  402. configurable: true
  403. });
  404. Object.defineProperty(Item.prototype, "_icons", {
  405. /**
  406. * @hidden
  407. */
  408. set: function (icons) {
  409. icons.forEach(function (icon) {
  410. icon.setElementClass('item-icon', true);
  411. });
  412. },
  413. enumerable: true,
  414. configurable: true
  415. });
  416. Item.decorators = [
  417. { type: core_1.Component, args: [{
  418. selector: 'ion-list-header,ion-item,[ion-item],ion-item-divider',
  419. template: '<ng-content select="[item-start],[item-left],ion-checkbox:not([item-end]):not([item-right])"></ng-content>' +
  420. '<div class="item-inner">' +
  421. '<div class="input-wrapper">' +
  422. '<ng-content select="ion-label"></ng-content>' +
  423. '<ion-label *ngIf="_viewLabel">' +
  424. '<ng-content></ng-content>' +
  425. '</ion-label>' +
  426. '<ng-content select="ion-select,ion-input,ion-textarea,ion-datetime,ion-range,[item-content]"></ng-content>' +
  427. '</div>' +
  428. '<ng-content select="[item-end],[item-right],ion-radio,ion-toggle"></ng-content>' +
  429. '<ion-reorder *ngIf="_hasReorder"></ion-reorder>' +
  430. '</div>' +
  431. '<div class="button-effect"></div>',
  432. host: {
  433. 'class': 'item'
  434. },
  435. changeDetection: core_1.ChangeDetectionStrategy.OnPush,
  436. encapsulation: core_1.ViewEncapsulation.None,
  437. },] },
  438. ];
  439. /** @nocollapse */
  440. Item.ctorParameters = function () { return [
  441. { type: form_1.Form, },
  442. { type: config_1.Config, },
  443. { type: core_1.ElementRef, },
  444. { type: core_1.Renderer, },
  445. { type: item_reorder_1.ItemReorder, decorators: [{ type: core_1.Optional },] },
  446. ]; };
  447. Item.propDecorators = {
  448. 'contentLabel': [{ type: core_1.ContentChild, args: [label_1.Label,] },],
  449. 'viewLabel': [{ type: core_1.ViewChild, args: [label_1.Label,] },],
  450. '_buttons': [{ type: core_1.ContentChildren, args: [button_1.Button,] },],
  451. '_icons': [{ type: core_1.ContentChildren, args: [icon_1.Icon,] },],
  452. };
  453. return Item;
  454. }(ion_1.Ion));
  455. exports.Item = Item;
  456. });
  457. //# sourceMappingURL=item.js.map