UI for Zipcoin Blue

picker.js 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 { EventEmitter, Output } from '@angular/core';
  12. import { isPresent } from '../../util/util';
  13. import { PickerCmp } from './picker-component';
  14. import { PickerSlideIn, PickerSlideOut } from './picker-transitions';
  15. import { ViewController } from '../../navigation/view-controller';
  16. /**
  17. * @hidden
  18. */
  19. var Picker = (function (_super) {
  20. __extends(Picker, _super);
  21. function Picker(app, opts, config) {
  22. if (opts === void 0) { opts = {}; }
  23. var _this = this;
  24. if (!opts) {
  25. opts = {};
  26. }
  27. opts.columns = opts.columns || [];
  28. opts.buttons = opts.buttons || [];
  29. opts.enableBackdropDismiss = isPresent(opts.enableBackdropDismiss) ? Boolean(opts.enableBackdropDismiss) : true;
  30. _this = _super.call(this, PickerCmp, opts, null) || this;
  31. _this._app = app;
  32. _this.isOverlay = true;
  33. _this.ionChange = new EventEmitter();
  34. config.setTransition('picker-slide-in', PickerSlideIn);
  35. config.setTransition('picker-slide-out', PickerSlideOut);
  36. return _this;
  37. }
  38. /**
  39. * @hidden
  40. */
  41. Picker.prototype.getTransitionName = function (direction) {
  42. var key = (direction === 'back' ? 'pickerLeave' : 'pickerEnter');
  43. return this._nav && this._nav.config.get(key);
  44. };
  45. /**
  46. * @param {any} button Picker toolbar button
  47. */
  48. Picker.prototype.addButton = function (button) {
  49. this.data.buttons.push(button);
  50. };
  51. /**
  52. * @param {PickerColumn} column Picker toolbar button
  53. */
  54. Picker.prototype.addColumn = function (column) {
  55. this.data.columns.push(column);
  56. };
  57. Picker.prototype.getColumns = function () {
  58. return this.data.columns;
  59. };
  60. Picker.prototype.getColumn = function (name) {
  61. return this.getColumns().find(function (column) { return column.name === name; });
  62. };
  63. Picker.prototype.refresh = function () {
  64. (void 0) /* assert */;
  65. (void 0) /* assert */;
  66. this._cmp && this._cmp.instance.refresh && this._cmp.instance.refresh();
  67. };
  68. /**
  69. * @param {string} cssClass CSS class name to add to the picker's outer wrapper.
  70. */
  71. Picker.prototype.setCssClass = function (cssClass) {
  72. this.data.cssClass = cssClass;
  73. };
  74. /**
  75. * Present the picker instance.
  76. *
  77. * @param {NavOptions} [navOptions={}] Nav options to go with this transition.
  78. * @returns {Promise} Returns a promise which is resolved when the transition has completed.
  79. */
  80. Picker.prototype.present = function (navOptions) {
  81. if (navOptions === void 0) { navOptions = {}; }
  82. return this._app.present(this, navOptions);
  83. };
  84. Picker.propDecorators = {
  85. 'ionChange': [{ type: Output },],
  86. };
  87. return Picker;
  88. }(ViewController));
  89. export { Picker };
  90. //# sourceMappingURL=picker.js.map