a zip code crypto-currency system good for red ONLY

action-sheet-controller.js 9.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. (function (factory) {
  2. if (typeof module === "object" && typeof module.exports === "object") {
  3. var v = factory(require, exports);
  4. if (v !== undefined) module.exports = v;
  5. }
  6. else if (typeof define === "function" && define.amd) {
  7. define(["require", "exports", "@angular/core", "./action-sheet", "../app/app", "../../config/config"], factory);
  8. }
  9. })(function (require, exports) {
  10. "use strict";
  11. Object.defineProperty(exports, "__esModule", { value: true });
  12. var core_1 = require("@angular/core");
  13. var action_sheet_1 = require("./action-sheet");
  14. var app_1 = require("../app/app");
  15. var config_1 = require("../../config/config");
  16. /**
  17. * @name ActionSheetController
  18. * @description
  19. * An Action Sheet is a dialog that lets the user choose from a set of
  20. * options. It appears on top of the app's content, and must be manually
  21. * dismissed by the user before they can resume interaction with the app.
  22. * Dangerous (destructive) options are made obvious in `ios` mode. There are easy
  23. * ways to cancel out of the action sheet, such as tapping the backdrop or
  24. * hitting the escape key on desktop.
  25. *
  26. * An action sheet is created from an array of `buttons`, with each button
  27. * including properties for its `text`, and optionally a `handler` and `role`.
  28. * If a handler returns `false` then the action sheet will not be dismissed. An
  29. * action sheet can also optionally have a `title`, `subTitle` and an `icon`.
  30. *
  31. * A button's `role` property can either be `destructive` or `cancel`. Buttons
  32. * without a role property will have the default look for the platform. Buttons
  33. * with the `cancel` role will always load as the bottom button, no matter where
  34. * they are in the array. All other buttons will be displayed in the order they
  35. * have been added to the `buttons` array. Note: We recommend that `destructive`
  36. * buttons are always the first button in the array, making them the top button.
  37. * Additionally, if the action sheet is dismissed by tapping the backdrop, then
  38. * it will fire the handler from the button with the cancel role.
  39. *
  40. * You can pass all of the action sheet's options in the first argument of
  41. * the create method: `ActionSheet.create(opts)`. Otherwise the action sheet's
  42. * instance has methods to add options, like `setTitle()` or `addButton()`.
  43. *
  44. * @usage
  45. * ```ts
  46. * import { ActionSheetController } from 'ionic-angular'
  47. *
  48. * export class MyClass{
  49. *
  50. * constructor(public actionSheetCtrl: ActionSheetController) { }
  51. *
  52. * presentActionSheet() {
  53. * const actionSheet = this.actionSheetCtrl.create({
  54. * title: 'Modify your album',
  55. * buttons: [
  56. * {
  57. * text: 'Destructive',
  58. * role: 'destructive',
  59. * handler: () => {
  60. * console.log('Destructive clicked');
  61. * }
  62. * },
  63. * {
  64. * text: 'Archive',
  65. * handler: () => {
  66. * console.log('Archive clicked');
  67. * }
  68. * },
  69. * {
  70. * text: 'Cancel',
  71. * role: 'cancel',
  72. * handler: () => {
  73. * console.log('Cancel clicked');
  74. * }
  75. * }
  76. * ]
  77. * });
  78. *
  79. * actionSheet.present();
  80. * }
  81. * }
  82. * ```
  83. *
  84. * @advanced
  85. *
  86. * ActionSheet create options
  87. *
  88. * | Option | Type | Description |
  89. * |-----------------------|------------|--------------------------------------------------------------------|
  90. * | title |`string` | The title for the Action Sheet. |
  91. * | subTitle |`string` | The sub-title for the Action Sheet. |
  92. * | cssClass |`string` | Additional classes for custom styles, separated by spaces. |
  93. * | enableBackdropDismiss |`boolean` | If the Action Sheet should close when the user taps the backdrop. |
  94. * | buttons |`array<any>`| An array of buttons to display. |
  95. *
  96. * ActionSheet button options
  97. *
  98. * | Option | Type | Description |
  99. * |----------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------|
  100. * | text | `string` | The buttons text. |
  101. * | icon | `icon` | The buttons icons. |
  102. * | handler | `any` | An express the button should evaluate. |
  103. * | cssClass | `string` | Additional classes for custom styles, separated by spaces. |
  104. * | role | `string` | How the button should be displayed, `destructive` or `cancel`. If not role is provided, it will display the button without any additional styles.|
  105. *
  106. *
  107. * ### Dismissing And Async Navigation
  108. *
  109. * After an action sheet has been dismissed, the app may need to also transition
  110. * to another page depending on the handler's logic. However, because multiple
  111. * transitions were fired at roughly the same time, it's difficult for the
  112. * nav controller to cleanly animate multiple transitions that may
  113. * have been kicked off asynchronously. This is further described in the
  114. * [`Nav Transition Promises`](../../nav/NavController/#nav-transition-promises) section. For action sheets,
  115. * this means it's best to wait for the action sheet to finish its transition
  116. * out before starting a new transition on the same nav controller.
  117. *
  118. * In the example below, after the button has been clicked, its handler
  119. * waits on async operation to complete, *then* it uses `pop` to navigate
  120. * back a page in the same stack. The potential problem is that the async operation
  121. * may have been completed before the action sheet has even finished its transition
  122. * out. In this case, it's best to ensure the action sheet has finished its transition
  123. * out first, *then* start the next transition.
  124. *
  125. * ```ts
  126. * const actionSheet = this.actionSheetCtrl.create({
  127. * title: 'Hello',
  128. * buttons: [{
  129. * text: 'Ok',
  130. * handler: () => {
  131. * // user has clicked the action sheet button
  132. * // begin the action sheet's dimiss transition
  133. * let navTransition = actionSheet.dismiss();
  134. *
  135. * // start some async method
  136. * someAsyncOperation().then(() => {
  137. * // once the async operation has completed
  138. * // then run the next nav transition after the
  139. * // first transition has finished animating out
  140. *
  141. * navTransition.then(() => {
  142. * this.nav.pop();
  143. * });
  144. * });
  145. * return false;
  146. * }
  147. * }]
  148. * });
  149. *
  150. * actionSheet.present();
  151. * ```
  152. *
  153. * It's important to note that the handler returns `false`. A feature of
  154. * button handlers is that they automatically dismiss the action sheet when their button
  155. * was clicked, however, we'll need more control regarding the transition. Because
  156. * the handler returns `false`, then the action sheet does not automatically dismiss
  157. * itself. Instead, you now have complete control of when the action sheet has finished
  158. * transitioning, and the ability to wait for the action sheet to finish transitioning
  159. * out before starting a new transition.
  160. *
  161. *
  162. * @demo /docs/demos/src/action-sheet/
  163. * @see {@link /docs/components#action-sheets ActionSheet Component Docs}
  164. */
  165. var ActionSheetController = (function () {
  166. function ActionSheetController(_app, config) {
  167. this._app = _app;
  168. this.config = config;
  169. }
  170. /**
  171. * Open an action sheet with a title, subTitle, and an array of buttons
  172. * @param {ActionSheetOptions} opts Action sheet options
  173. */
  174. ActionSheetController.prototype.create = function (opts) {
  175. if (opts === void 0) { opts = {}; }
  176. return new action_sheet_1.ActionSheet(this._app, opts, this.config);
  177. };
  178. ActionSheetController.decorators = [
  179. { type: core_1.Injectable },
  180. ];
  181. /** @nocollapse */
  182. ActionSheetController.ctorParameters = function () { return [
  183. { type: app_1.App, },
  184. { type: config_1.Config, },
  185. ]; };
  186. return ActionSheetController;
  187. }());
  188. exports.ActionSheetController = ActionSheetController;
  189. });
  190. //# sourceMappingURL=action-sheet-controller.js.map