a zip code crypto-currency system good for red ONLY

slides.js 35KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003
  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", "../../config/config", "./swiper/swiper-keyboard", "../ion", "../../util/util", "./swiper/swiper-events", "./swiper/swiper-zoom", "../../platform/platform", "./swiper/swiper", "./swiper/swiper-effects", "../../navigation/view-controller"], 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 config_1 = require("../../config/config");
  24. var swiper_keyboard_1 = require("./swiper/swiper-keyboard");
  25. var ion_1 = require("../ion");
  26. var util_1 = require("../../util/util");
  27. var swiper_events_1 = require("./swiper/swiper-events");
  28. var swiper_zoom_1 = require("./swiper/swiper-zoom");
  29. var platform_1 = require("../../platform/platform");
  30. var swiper_1 = require("./swiper/swiper");
  31. var swiper_effects_1 = require("./swiper/swiper-effects");
  32. var view_controller_1 = require("../../navigation/view-controller");
  33. /**
  34. * @name Slides
  35. * @description
  36. * The Slides component is a multi-section container. Each section can be swiped
  37. * or dragged between. It contains any number of [Slide](../Slide) components.
  38. *
  39. *
  40. * ### Creating
  41. * You should use a template to create slides and listen to slide events. The template
  42. * should contain the slide container, an `<ion-slides>` element, and any number of
  43. * [Slide](../Slide) components, written as `<ion-slide>`. Basic configuration
  44. * values can be set as input properties, which are listed below. Slides events
  45. * can also be listened to such as the slide changing by placing the event on the
  46. * `<ion-slides>` element. See [Usage](#usage) below for more information.
  47. *
  48. *
  49. * ### Navigating
  50. * After creating and configuring the slides, you can navigate between them
  51. * by swiping or calling methods on the `Slides` instance. You can call `slideTo()` to
  52. * navigate to a specific slide, or `slideNext()` to change to the slide that follows
  53. * the active slide. All of the [methods](#instance-members) provided by the `Slides`
  54. * instance are listed below. See [Usage](#usage) below for more information on
  55. * navigating between slides.
  56. *
  57. *
  58. * @usage
  59. *
  60. * You can add slides to a `@Component` using the following template:
  61. *
  62. * ```html
  63. * <ion-slides>
  64. * <ion-slide>
  65. * <h1>Slide 1</h1>
  66. * </ion-slide>
  67. * <ion-slide>
  68. * <h1>Slide 2</h1>
  69. * </ion-slide>
  70. * <ion-slide>
  71. * <h1>Slide 3</h1>
  72. * </ion-slide>
  73. * </ion-slides>
  74. * ```
  75. *
  76. * Next, we can use `ViewChild` to assign the Slides instance to
  77. * your `slides` property. Now we can call any of the `Slides`
  78. * [methods](#instance-members), for example we can use the Slide's
  79. * `slideTo()` method in order to navigate to a specific slide on
  80. * a button click. Below we call the `goToSlide()` method and it
  81. * navigates to the 3rd slide:
  82. *
  83. * ```ts
  84. * import { ViewChild } from '@angular/core';
  85. * import { Slides } from 'ionic-angular';
  86. *
  87. * class MyPage {
  88. * @ViewChild(Slides) slides: Slides;
  89. *
  90. * goToSlide() {
  91. * this.slides.slideTo(2, 500);
  92. * }
  93. * }
  94. * ```
  95. *
  96. * We can also add events to listen to on the `<ion-slides>` element.
  97. * Let's add the `ionSlideDidChange` event and call a method when the slide changes:
  98. *
  99. * ```html
  100. * <ion-slides (ionSlideDidChange)="slideChanged()">
  101. * ```
  102. *
  103. * In our class, we add the `slideChanged()` method which gets the active
  104. * index and prints it:
  105. *
  106. * ```ts
  107. * class MyPage {
  108. * ...
  109. *
  110. * slideChanged() {
  111. * let currentIndex = this.slides.getActiveIndex();
  112. * console.log('Current index is', currentIndex);
  113. * }
  114. * }
  115. * ```
  116. *
  117. * ### Zooming
  118. * If your slides contain images, you can enable zooming on them by setting `zoom="true" and
  119. * wrapping each image in a `div` with the class `swiper-zoom-container`. Zoom supports
  120. * `img`, `svg`, `canvas`, and `ion-img`.
  121. *
  122. * ```html
  123. * <ion-slides zoom="true">
  124. * <ion-slide>
  125. * <div class="swiper-zoom-container">
  126. * <img src="assets/img/dog.jpg">
  127. * </div>
  128. * <ion-label>Woof</ion-label>
  129. * </ion-slide>
  130. * <ion-slide>
  131. * <div class="swiper-zoom-container">
  132. * <img src="assets/img/cat.jpg">
  133. * </div>
  134. * <ion-label>Meow</ion-label>
  135. * </ion-slide>
  136. * <ion-slide>
  137. * <div class="swiper-zoom-container">
  138. * <img src="assets/img/fish.jpg">
  139. * </div>
  140. * <ion-label>Just keep swimming</ion-label>
  141. * </ion-slide>
  142. * </ion-slides>
  143. * ```
  144. *
  145. * @advanced
  146. *
  147. * There are several options available to create customized slides. Ionic exposes
  148. * the most commonly used options as [inputs](http://learnangular2.com/inputs/).
  149. * In order to use an option that isn't exposed as an input the following code
  150. * should be used, where `freeMode` is the option to change:
  151. *
  152. * ```ts
  153. * import { ViewChild } from '@angular/core';
  154. * import { Slides } from 'ionic-angular';
  155. * class MyPage {
  156. * @ViewChild(Slides) slides: Slides;
  157. *
  158. * ngAfterViewInit() {
  159. * this.slides.freeMode = true;
  160. * }
  161. * }
  162. *
  163. * ```
  164. *
  165. * To see all of the available options, take a look at the
  166. * [source for slides](https://github.com/ionic-team/ionic/blob/master/src/components/slides/slides.ts).
  167. *
  168. * @demo /docs/demos/src/slides/
  169. * @see {@link /docs/components#slides Slides Component Docs}
  170. *
  171. * Adopted from Swiper.js:
  172. * The most modern mobile touch slider and framework with
  173. * hardware accelerated transitions.
  174. *
  175. * http://www.idangero.us/swiper/
  176. *
  177. * Copyright 2016, Vladimir Kharlampidi
  178. * The iDangero.us
  179. * http://www.idangero.us/
  180. *
  181. * Licensed under MIT
  182. */
  183. var Slides = (function (_super) {
  184. __extends(Slides, _super);
  185. function Slides(config, _plt, zone, viewCtrl, elementRef, renderer) {
  186. var _this = _super.call(this, config, elementRef, renderer, 'slides') || this;
  187. _this._plt = _plt;
  188. _this._control = null;
  189. _this._effectName = 'slide';
  190. _this._direction = 'horizontal';
  191. _this._initialSlide = 0;
  192. _this._isLoop = false;
  193. _this._pager = false;
  194. _this._paginationType = 'bullets';
  195. /** @hidden */
  196. _this.paginationBulletRender = null;
  197. _this._isParallax = false;
  198. _this._speedMs = 300;
  199. _this._isZoom = false;
  200. /**
  201. * @hidden
  202. * Enabled this option and swiper will be operated as usual except it will
  203. * not move, real translate values on wrapper will not be set. Useful when
  204. * you may need to create custom slide transition.
  205. */
  206. _this.virtualTranslate = false;
  207. /**
  208. * @hidden
  209. * Set to true to round values of slides width and height to prevent blurry
  210. * texts on usual resolution screens (if you have such)
  211. */
  212. _this.roundLengths = false;
  213. _this._spaceBetween = 0;
  214. _this._slidesPerView = 1;
  215. _this._centeredSlides = false;
  216. /**
  217. * @hidden
  218. */
  219. _this.slidesPerColumn = 1;
  220. /**
  221. * @hidden
  222. */
  223. _this.slidesPerColumnFill = 'column';
  224. /**
  225. * @hidden
  226. */
  227. _this.slidesPerGroup = 1;
  228. /**
  229. * @hidden
  230. */
  231. _this.slidesOffsetBefore = 0;
  232. /**
  233. * @hidden
  234. */
  235. _this.slidesOffsetAfter = 0;
  236. // autoplay
  237. /**
  238. * @hidden
  239. */
  240. _this.autoplayDisableOnInteraction = true;
  241. /**
  242. * @hidden
  243. */
  244. _this.autoplayStopOnLast = false;
  245. // Free mode
  246. /**
  247. * @hidden
  248. */
  249. _this.freeMode = false;
  250. /**
  251. * @hidden
  252. */
  253. _this.freeModeMomentum = true;
  254. /**
  255. * @hidden
  256. */
  257. _this.freeModeMomentumRatio = 1;
  258. /**
  259. * @hidden
  260. */
  261. _this.freeModeMomentumBounce = true;
  262. /**
  263. * @hidden
  264. */
  265. _this.freeModeMomentumBounceRatio = 1;
  266. /**
  267. * @hidden
  268. */
  269. _this.freeModeMomentumVelocityRatio = 1;
  270. /**
  271. * @hidden
  272. */
  273. _this.freeModeSticky = false;
  274. /**
  275. * @hidden
  276. */
  277. _this.freeModeMinimumVelocity = 0.02;
  278. // Autoheight
  279. /**
  280. * @hidden
  281. */
  282. _this.autoHeight = false;
  283. // Set wrapper width
  284. /**
  285. * @hidden
  286. */
  287. _this.setWrapperSize = false;
  288. // Zoom
  289. /**
  290. * @hidden
  291. */
  292. _this.zoomMax = 3;
  293. /**
  294. * @hidden
  295. */
  296. _this.zoomMin = 1;
  297. /**
  298. * @hidden
  299. */
  300. _this.zoomToggle = true;
  301. // Touches
  302. /**
  303. * @hidden
  304. */
  305. _this.touchRatio = 1;
  306. /**
  307. * @hidden
  308. */
  309. _this.touchAngle = 45;
  310. /**
  311. * @hidden
  312. */
  313. _this.simulateTouch = true;
  314. /**
  315. * @hidden
  316. */
  317. _this.shortSwipes = true;
  318. /**
  319. * @hidden
  320. */
  321. _this.longSwipes = true;
  322. /**
  323. * @hidden
  324. */
  325. _this.longSwipesRatio = 0.5;
  326. /**
  327. * @hidden
  328. */
  329. _this.longSwipesMs = 300;
  330. /**
  331. * @hidden
  332. */
  333. _this.followFinger = true;
  334. /**
  335. * @hidden
  336. */
  337. _this.onlyExternal = false;
  338. /**
  339. * @hidden
  340. */
  341. _this.threshold = 0;
  342. /**
  343. * @hidden
  344. */
  345. _this.touchMoveStopPropagation = true;
  346. /**
  347. * @hidden
  348. */
  349. _this.touchReleaseOnEdges = false;
  350. // To support iOS's swipe-to-go-back gesture (when being used in-app, with UIWebView).
  351. /**
  352. * @hidden
  353. */
  354. _this.iOSEdgeSwipeDetection = false;
  355. /**
  356. * @hidden
  357. */
  358. _this.iOSEdgeSwipeThreshold = 20;
  359. // Pagination
  360. /**
  361. * @hidden
  362. */
  363. _this.paginationClickable = false;
  364. /**
  365. * @hidden
  366. */
  367. _this.paginationHide = false;
  368. // Resistance
  369. /** @hidden */
  370. _this.resistance = true;
  371. /** @hidden */
  372. _this.resistanceRatio = 0.85;
  373. // Progress
  374. /** @hidden */
  375. _this.watchSlidesProgress = false;
  376. /** @hidden */
  377. _this.watchSlidesVisibility = false;
  378. // Clicks
  379. /**
  380. * @hidden
  381. */
  382. _this.preventClicks = true;
  383. /**
  384. * @hidden
  385. */
  386. _this.preventClicksPropagation = true;
  387. /**
  388. * @hidden
  389. */
  390. _this.slideToClickedSlide = false;
  391. // loop
  392. /**
  393. * @hidden
  394. */
  395. _this.loopAdditionalSlides = 0;
  396. /**
  397. * @hidden
  398. */
  399. _this.loopedSlides = null;
  400. // Swiping/no swiping
  401. /**
  402. * @hidden
  403. */
  404. _this.swipeHandler = null;
  405. /**
  406. * @hidden
  407. */
  408. _this.noSwiping = true;
  409. // Callbacks
  410. /** @hidden */
  411. _this.runCallbacksOnInit = true;
  412. // Controller
  413. _this.controlBy = 'slide';
  414. _this.controlInverse = false;
  415. // Keyboard
  416. /**
  417. * @hidden
  418. */
  419. _this.keyboardControl = true;
  420. // Effects
  421. /**
  422. * @hidden
  423. */
  424. _this.coverflow = {
  425. rotate: 50,
  426. stretch: 0,
  427. depth: 100,
  428. modifier: 1,
  429. slideShadows: true
  430. };
  431. /**
  432. * @hidden
  433. */
  434. _this.flip = {
  435. slideShadows: true,
  436. limitRotation: true
  437. };
  438. /**
  439. * @hidden
  440. */
  441. _this.cube = {
  442. slideShadows: true,
  443. shadow: true,
  444. shadowOffset: 20,
  445. shadowScale: 0.94
  446. };
  447. /**
  448. * @hidden
  449. */
  450. _this.fade = {
  451. crossFade: false
  452. };
  453. // Accessibility
  454. /**
  455. * @hidden
  456. */
  457. _this.prevSlideMessage = 'Previous slide';
  458. /**
  459. * @hidden
  460. */
  461. _this.nextSlideMessage = 'Next slide';
  462. /**
  463. * @hidden
  464. */
  465. _this.firstSlideMessage = 'This is the first slide';
  466. /**
  467. * @hidden
  468. */
  469. _this.lastSlideMessage = 'This is the last slide';
  470. /**
  471. * @output {Slides} Emitted when a slide change starts.
  472. */
  473. _this.ionSlideWillChange = new core_1.EventEmitter();
  474. /**
  475. * @output {Slides} Emitted when a slide change ends.
  476. */
  477. _this.ionSlideDidChange = new core_1.EventEmitter();
  478. /**
  479. * @output {Slides} Emitted when a slide moves.
  480. */
  481. _this.ionSlideDrag = new core_1.EventEmitter();
  482. /**
  483. * @output {Slides} Emitted when slides reaches its beginning (initial position).
  484. */
  485. _this.ionSlideReachStart = new core_1.EventEmitter();
  486. /**
  487. * @output {Slides} Emitted when slides reaches its last slide.
  488. */
  489. _this.ionSlideReachEnd = new core_1.EventEmitter();
  490. /**
  491. * @output {Slides} Emitted when a slide moves.
  492. */
  493. _this.ionSlideAutoplay = new core_1.EventEmitter();
  494. /**
  495. * @output {Slides} Emitted when a autoplay starts.
  496. */
  497. _this.ionSlideAutoplayStart = new core_1.EventEmitter();
  498. /**
  499. * @output {Slides} Emitted when a autoplay stops.
  500. */
  501. _this.ionSlideAutoplayStop = new core_1.EventEmitter();
  502. /**
  503. * @output {Slides} Emitted when a slide change starts with the "forward" direction.
  504. */
  505. _this.ionSlideNextStart = new core_1.EventEmitter();
  506. /**
  507. * @output {Slides} Emitted when a slide change starts with the "backward" direction.
  508. */
  509. _this.ionSlidePrevStart = new core_1.EventEmitter();
  510. /**
  511. * @output {Slides} Emitted when a slide change ends with the "forward" direction.
  512. */
  513. _this.ionSlideNextEnd = new core_1.EventEmitter();
  514. /**
  515. * @output {Slides} Emitted when a slide change ends with the "backward" direction.
  516. */
  517. _this.ionSlidePrevEnd = new core_1.EventEmitter();
  518. /**
  519. * @output {Slides} Emitted when the user taps/clicks on the slide's container.
  520. */
  521. _this.ionSlideTap = new core_1.EventEmitter();
  522. /**
  523. * @output {Slides} Emitted when the user double taps on the slide's container.
  524. */
  525. _this.ionSlideDoubleTap = new core_1.EventEmitter();
  526. /** @hidden */
  527. _this.ionSlideProgress = new core_1.EventEmitter();
  528. /** @hidden */
  529. _this.ionSlideTransitionStart = new core_1.EventEmitter();
  530. /** @hidden */
  531. _this.ionSlideTransitionEnd = new core_1.EventEmitter();
  532. /** @hidden */
  533. _this.ionSlideTouchStart = new core_1.EventEmitter();
  534. /** @hidden */
  535. _this.ionSlideTouchEnd = new core_1.EventEmitter();
  536. _this._unregs = [];
  537. /** @internal */
  538. _this._allowSwipeToNext = true;
  539. /** @internal */
  540. _this._allowSwipeToPrev = true;
  541. _this._zone = zone;
  542. _this.id = ++slidesId;
  543. _this.slideId = 'slides-' + _this.id;
  544. _this.setElementClass(_this.slideId, true);
  545. // only initialize the slides whent the content is ready
  546. if (viewCtrl) {
  547. var subscription = viewCtrl.readReady.subscribe(function () {
  548. subscription.unsubscribe();
  549. _this._initSlides();
  550. });
  551. }
  552. return _this;
  553. }
  554. Object.defineProperty(Slides.prototype, "autoplay", {
  555. /**
  556. * @input {number} Delay between transitions (in milliseconds). If this
  557. * parameter is not passed, autoplay is disabled. Default does
  558. * not have a value and does not autoplay.
  559. * Default: `null`.
  560. */
  561. get: function () {
  562. return this._autoplayMs;
  563. },
  564. set: function (val) {
  565. this._autoplayMs = parseInt(val, 10);
  566. },
  567. enumerable: true,
  568. configurable: true
  569. });
  570. Object.defineProperty(Slides.prototype, "control", {
  571. /**
  572. * @input {Slides} Pass another Slides instance or array of Slides instances
  573. * that should be controlled by this Slides instance.
  574. * Default: `null`.
  575. */
  576. get: function () {
  577. return this._control;
  578. },
  579. set: function (val) {
  580. if (val instanceof Slides || Array.isArray(val)) {
  581. this._control = val;
  582. }
  583. },
  584. enumerable: true,
  585. configurable: true
  586. });
  587. Object.defineProperty(Slides.prototype, "effect", {
  588. /**
  589. * @input {string} The animation effect of the slides.
  590. * Possible values are: `slide`, `fade`, `cube`, `coverflow` or `flip`.
  591. * Default: `slide`.
  592. */
  593. get: function () {
  594. return this._effectName;
  595. },
  596. set: function (effectName) {
  597. if (swiper_effects_1.SWIPER_EFFECTS[effectName]) {
  598. this._effectName = effectName;
  599. }
  600. },
  601. enumerable: true,
  602. configurable: true
  603. });
  604. Object.defineProperty(Slides.prototype, "direction", {
  605. /**
  606. * @input {string} Swipe direction: 'horizontal' or 'vertical'.
  607. * Default: `horizontal`.
  608. */
  609. get: function () {
  610. return this._direction;
  611. },
  612. set: function (val) {
  613. if (val === 'horizontal' || val === 'vertical') {
  614. this._direction = val;
  615. }
  616. },
  617. enumerable: true,
  618. configurable: true
  619. });
  620. Object.defineProperty(Slides.prototype, "initialSlide", {
  621. /**
  622. * @input {number} Index number of initial slide. Default: `0`.
  623. */
  624. get: function () {
  625. return this._initialSlide;
  626. },
  627. set: function (val) {
  628. this._initialSlide = parseInt(val, 10);
  629. },
  630. enumerable: true,
  631. configurable: true
  632. });
  633. Object.defineProperty(Slides.prototype, "loop", {
  634. /**
  635. * @input {boolean} If true, continuously loop from the last slide to the
  636. * first slide.
  637. */
  638. get: function () {
  639. return this._isLoop;
  640. },
  641. set: function (val) {
  642. this._isLoop = util_1.isTrueProperty(val);
  643. },
  644. enumerable: true,
  645. configurable: true
  646. });
  647. Object.defineProperty(Slides.prototype, "pager", {
  648. /**
  649. * @input {boolean} If true, show the pager.
  650. */
  651. get: function () {
  652. return this._pager;
  653. },
  654. set: function (val) {
  655. this._pager = util_1.isTrueProperty(val);
  656. },
  657. enumerable: true,
  658. configurable: true
  659. });
  660. Object.defineProperty(Slides.prototype, "dir", {
  661. /**
  662. * @input {string} If dir attribute is equal to rtl, set interal _rtl to true;
  663. */
  664. set: function (val) {
  665. this._rtl = (val.toLowerCase() === 'rtl');
  666. },
  667. enumerable: true,
  668. configurable: true
  669. });
  670. Object.defineProperty(Slides.prototype, "paginationType", {
  671. /**
  672. * @input {string} Type of pagination. Possible values are:
  673. * `bullets`, `fraction`, `progress`. Default: `bullets`.
  674. * (Note that the pager will not show unless `pager` input
  675. * is set to true).
  676. */
  677. get: function () {
  678. return this._paginationType;
  679. },
  680. set: function (val) {
  681. if (val === 'bullets' || val === 'fraction' || val === 'progress') {
  682. this._paginationType = val;
  683. }
  684. },
  685. enumerable: true,
  686. configurable: true
  687. });
  688. Object.defineProperty(Slides.prototype, "parallax", {
  689. /**
  690. * @input {boolean} If true, allows you to use "parallaxed" elements inside of
  691. * slider.
  692. */
  693. get: function () {
  694. return this._isParallax;
  695. },
  696. set: function (val) {
  697. this._isParallax = util_1.isTrueProperty(val);
  698. },
  699. enumerable: true,
  700. configurable: true
  701. });
  702. Object.defineProperty(Slides.prototype, "speed", {
  703. /**
  704. * @input {number} Duration of transition between slides
  705. * (in milliseconds). Default: `300`.
  706. */
  707. get: function () {
  708. return this._speedMs;
  709. },
  710. set: function (val) {
  711. this._speedMs = parseInt(val, 10);
  712. },
  713. enumerable: true,
  714. configurable: true
  715. });
  716. Object.defineProperty(Slides.prototype, "zoom", {
  717. /**
  718. * @input {boolean} If true, enables zooming functionality.
  719. */
  720. get: function () {
  721. return this._isZoom;
  722. },
  723. set: function (val) {
  724. this._isZoom = util_1.isTrueProperty(val);
  725. },
  726. enumerable: true,
  727. configurable: true
  728. });
  729. Object.defineProperty(Slides.prototype, "spaceBetween", {
  730. // Slides grid
  731. /**
  732. * @input {number} Distance between slides in px. Default: `0`.
  733. */
  734. get: function () {
  735. return this._spaceBetween;
  736. },
  737. set: function (val) {
  738. this._spaceBetween = parseInt(val, 10);
  739. },
  740. enumerable: true,
  741. configurable: true
  742. });
  743. Object.defineProperty(Slides.prototype, "slidesPerView", {
  744. /**
  745. * @input {number} Slides per view. Slides visible at the same time. Default: `1`.
  746. */
  747. get: function () {
  748. return this._slidesPerView;
  749. },
  750. set: function (val) {
  751. this._slidesPerView = val === 'auto' ? 'auto' : parseFloat(val);
  752. },
  753. enumerable: true,
  754. configurable: true
  755. });
  756. Object.defineProperty(Slides.prototype, "centeredSlides", {
  757. /**
  758. * @input {boolean} Center a slide in the middle of the screen.
  759. */
  760. get: function () {
  761. return this._centeredSlides;
  762. },
  763. set: function (val) {
  764. this._centeredSlides = util_1.isTrueProperty(val);
  765. },
  766. enumerable: true,
  767. configurable: true
  768. });
  769. Slides.prototype._initSlides = function () {
  770. if (!this._init) {
  771. (void 0) /* console.debug */;
  772. var s = this;
  773. var plt = s._plt;
  774. s.container = this.getNativeElement().children[0];
  775. // init swiper core
  776. swiper_1.initSwiper(s, plt);
  777. // init core event listeners
  778. this._unregs.push(swiper_events_1.initEvents(s, plt));
  779. if (this.zoom) {
  780. // init zoom event listeners
  781. this._unregs.push(swiper_zoom_1.initZoom(s, plt));
  782. }
  783. if (this.keyboardControl) {
  784. // init keyboard event listeners
  785. s.enableKeyboardControl(true);
  786. }
  787. this._init = true;
  788. }
  789. };
  790. /**
  791. * @hidden
  792. */
  793. Slides.prototype.ngAfterContentInit = function () {
  794. var _this = this;
  795. this._plt.timeout(function () {
  796. _this._initSlides();
  797. }, 300);
  798. };
  799. /**
  800. * Update the underlying slider implementation. Call this if you've added or removed
  801. * child slides.
  802. */
  803. Slides.prototype.update = function (debounce) {
  804. var _this = this;
  805. if (debounce === void 0) { debounce = 300; }
  806. if (this._init) {
  807. this._plt.cancelTimeout(this._tmr);
  808. this._tmr = this._plt.timeout(function () {
  809. swiper_1.update(_this, _this._plt);
  810. // Don't allow pager to show with > 10 slides
  811. if (_this.length() > 10) {
  812. _this.paginationType = undefined;
  813. }
  814. }, debounce);
  815. }
  816. };
  817. Slides.prototype.resize = function () {
  818. if (this._init) {
  819. }
  820. };
  821. /**
  822. * Transition to the specified slide.
  823. *
  824. * @param {number} index The index number of the slide.
  825. * @param {number} [speed] Transition duration (in ms).
  826. * @param {boolean} [runCallbacks] Whether or not to emit the `ionSlideWillChange`/`ionSlideDidChange` events. Default true.
  827. */
  828. Slides.prototype.slideTo = function (index, speed, runCallbacks) {
  829. swiper_1.slideTo(this, this._plt, index, speed, runCallbacks);
  830. };
  831. /**
  832. * Transition to the next slide.
  833. *
  834. * @param {number} [speed] Transition duration (in ms).
  835. * @param {boolean} [runCallbacks] Whether or not to emit the `ionSlideWillChange`/`ionSlideDidChange` events. Default true.
  836. */
  837. Slides.prototype.slideNext = function (speed, runCallbacks) {
  838. swiper_1.slideNext(this, this._plt, runCallbacks, speed, true);
  839. };
  840. /**
  841. * Transition to the previous slide.
  842. *
  843. * @param {number} [speed] Transition duration (in ms).
  844. * @param {boolean} [runCallbacks] Whether or not to emit the `ionSlideWillChange`/`ionSlideDidChange` events. Default true.
  845. */
  846. Slides.prototype.slidePrev = function (speed, runCallbacks) {
  847. swiper_1.slidePrev(this, this._plt, runCallbacks, speed, true);
  848. };
  849. /**
  850. * Get the index of the active slide.
  851. *
  852. * @returns {number} The index number of the current slide.
  853. */
  854. Slides.prototype.getActiveIndex = function () {
  855. return this._activeIndex;
  856. };
  857. /**
  858. * Get the index of the previous slide.
  859. *
  860. * @returns {number} The index number of the previous slide.
  861. */
  862. Slides.prototype.getPreviousIndex = function () {
  863. return this._previousIndex;
  864. };
  865. /**
  866. * Get the total number of slides.
  867. *
  868. * @returns {number} The total number of slides.
  869. */
  870. Slides.prototype.length = function () {
  871. return this._slides.length;
  872. };
  873. /**
  874. * Get whether or not the current slide is the last slide.
  875. *
  876. * @returns {boolean} If the slide is the last slide or not.
  877. */
  878. Slides.prototype.isEnd = function () {
  879. return this._isEnd;
  880. };
  881. /**
  882. * Get whether or not the current slide is the first slide.
  883. *
  884. * @returns {boolean} If the slide is the first slide or not.
  885. */
  886. Slides.prototype.isBeginning = function () {
  887. return this._isBeginning;
  888. };
  889. /**
  890. * Start auto play.
  891. */
  892. Slides.prototype.startAutoplay = function () {
  893. swiper_1.startAutoplay(this, this._plt);
  894. };
  895. /**
  896. * Stop auto play.
  897. */
  898. Slides.prototype.stopAutoplay = function () {
  899. swiper_1.stopAutoplay(this);
  900. };
  901. /**
  902. * Lock or unlock the ability to slide to the next slides.
  903. * @param {boolean} shouldLockSwipeToNext If set to true the user will not be able to swipe to the next slide.
  904. * Set to false to unlock this behaviour.
  905. */
  906. Slides.prototype.lockSwipeToNext = function (shouldLockSwipeToNext) {
  907. this._allowSwipeToNext = !shouldLockSwipeToNext;
  908. };
  909. /**
  910. * Lock or unlock the ability to slide to the previous slides.
  911. * @param {boolean} shouldLockSwipeToPrev If set to true the user will not be able to swipe to the previous slide.
  912. * Set to false to unlock this behaviour.
  913. */
  914. Slides.prototype.lockSwipeToPrev = function (shouldLockSwipeToPrev) {
  915. this._allowSwipeToPrev = !shouldLockSwipeToPrev;
  916. };
  917. /**
  918. * Lock or unlock the ability to slide to change slides.
  919. * @param {boolean} shouldLockSwipes If set to true user can not swipe in either direction on slide.
  920. * False allows swiping in both directions.
  921. */
  922. Slides.prototype.lockSwipes = function (shouldLockSwipes) {
  923. this._allowSwipeToNext = this._allowSwipeToPrev = !shouldLockSwipes;
  924. };
  925. /**
  926. * Enable or disable keyboard control.
  927. * @param {boolean} shouldEnableKeyboard If set to true the slider can be controled by a keyboard.
  928. */
  929. Slides.prototype.enableKeyboardControl = function (shouldEnableKeyboard) {
  930. swiper_keyboard_1.enableKeyboardControl(this, this._plt, shouldEnableKeyboard);
  931. };
  932. /**
  933. * @hidden
  934. */
  935. Slides.prototype.ngOnDestroy = function () {
  936. this._init = false;
  937. this._unregs.forEach(function (unReg) {
  938. unReg();
  939. });
  940. this._unregs.length = 0;
  941. swiper_1.destroySwiper(this);
  942. this.enableKeyboardControl(false);
  943. };
  944. Slides.decorators = [
  945. { type: core_1.Component, args: [{
  946. selector: 'ion-slides',
  947. template: '<div class="swiper-container" [attr.dir]="_rtl? \'rtl\' : null">' +
  948. '<div class="swiper-wrapper">' +
  949. '<ng-content></ng-content>' +
  950. '</div>' +
  951. '<div [class.hide]="!pager" class="swiper-pagination"></div>' +
  952. '</div>',
  953. changeDetection: core_1.ChangeDetectionStrategy.OnPush,
  954. encapsulation: core_1.ViewEncapsulation.None,
  955. },] },
  956. ];
  957. /** @nocollapse */
  958. Slides.ctorParameters = function () { return [
  959. { type: config_1.Config, },
  960. { type: platform_1.Platform, },
  961. { type: core_1.NgZone, },
  962. { type: view_controller_1.ViewController, decorators: [{ type: core_1.Optional },] },
  963. { type: core_1.ElementRef, },
  964. { type: core_1.Renderer, },
  965. ]; };
  966. Slides.propDecorators = {
  967. 'autoplay': [{ type: core_1.Input },],
  968. 'control': [{ type: core_1.Input },],
  969. 'effect': [{ type: core_1.Input },],
  970. 'direction': [{ type: core_1.Input },],
  971. 'initialSlide': [{ type: core_1.Input },],
  972. 'loop': [{ type: core_1.Input },],
  973. 'pager': [{ type: core_1.Input },],
  974. 'dir': [{ type: core_1.Input },],
  975. 'paginationType': [{ type: core_1.Input },],
  976. 'parallax': [{ type: core_1.Input },],
  977. 'speed': [{ type: core_1.Input },],
  978. 'zoom': [{ type: core_1.Input },],
  979. 'spaceBetween': [{ type: core_1.Input },],
  980. 'slidesPerView': [{ type: core_1.Input },],
  981. 'centeredSlides': [{ type: core_1.Input },],
  982. 'ionSlideWillChange': [{ type: core_1.Output },],
  983. 'ionSlideDidChange': [{ type: core_1.Output },],
  984. 'ionSlideDrag': [{ type: core_1.Output },],
  985. 'ionSlideReachStart': [{ type: core_1.Output },],
  986. 'ionSlideReachEnd': [{ type: core_1.Output },],
  987. 'ionSlideAutoplay': [{ type: core_1.Output },],
  988. 'ionSlideAutoplayStart': [{ type: core_1.Output },],
  989. 'ionSlideAutoplayStop': [{ type: core_1.Output },],
  990. 'ionSlideNextStart': [{ type: core_1.Output },],
  991. 'ionSlidePrevStart': [{ type: core_1.Output },],
  992. 'ionSlideNextEnd': [{ type: core_1.Output },],
  993. 'ionSlidePrevEnd': [{ type: core_1.Output },],
  994. 'ionSlideTap': [{ type: core_1.Output },],
  995. 'ionSlideDoubleTap': [{ type: core_1.Output },],
  996. };
  997. return Slides;
  998. }(ion_1.Ion));
  999. exports.Slides = Slides;
  1000. var slidesId = -1;
  1001. });
  1002. //# sourceMappingURL=slides.js.map