UNPKG

ionic-angular

Version:

A powerful framework for building mobile and progressive web apps with JavaScript and Angular 2

199 lines 6.54 kB
(function (factory) { if (typeof module === 'object' && typeof module.exports === 'object') { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === 'function' && define.amd) { define(["require", "exports", '@angular/core', '../../util/util'], factory); } })(function (require, exports) { "use strict"; var core_1 = require('@angular/core'); var util_1 = require('../../util/util'); /** * \@name Scroll * \@description * Scroll is a non-flexboxed scroll area that can scroll horizontally or vertically. `ion-Scroll` Can be used in places where you may not need a full page scroller, but a highly customized one, such as image scubber or comment scroller. * \@usage * ```html * <ion-scroll scrollX="true"> * </ion-scroll> * * <ion-scroll scrollY="true"> * </ion-scroll> * * <ion-scroll scrollX="true" scrollY="true"> * </ion-scroll> * ``` * \@demo /docs/v2/demos/src/scroll/ */ var Scroll = (function () { /** * @param {?} _elementRef */ function Scroll(_elementRef) { this._elementRef = _elementRef; this._scrollX = false; this._scrollY = false; this._zoom = false; this._maxZoom = 1; /** * @private */ this.maxScale = 3; /** * @private */ this.zoomDuration = 250; } Object.defineProperty(Scroll.prototype, "scrollX", { /** * \@input {boolean} If true, scrolling along the X axis is enabled. * @return {?} */ get: function () { return this._scrollX; }, /** * @param {?} val * @return {?} */ set: function (val) { this._scrollX = util_1.isTrueProperty(val); }, enumerable: true, configurable: true }); Object.defineProperty(Scroll.prototype, "scrollY", { /** * \@input {boolean} If true, scrolling along the Y axis is enabled; requires the following CSS declaration: ion-scroll { white-space: nowrap; } * @return {?} */ get: function () { return this._scrollY; }, /** * @param {?} val * @return {?} */ set: function (val) { this._scrollY = util_1.isTrueProperty(val); }, enumerable: true, configurable: true }); Object.defineProperty(Scroll.prototype, "zoom", { /** * \@input {boolean} If true, zooming is enabled. * @return {?} */ get: function () { return this._zoom; }, /** * @param {?} val * @return {?} */ set: function (val) { this._zoom = util_1.isTrueProperty(val); }, enumerable: true, configurable: true }); Object.defineProperty(Scroll.prototype, "maxZoom", { /** * \@input {number} Set the max zoom amount. * @return {?} */ get: function () { return this._maxZoom; }, /** * @param {?} val * @return {?} */ set: function (val) { this._maxZoom = val; }, enumerable: true, configurable: true }); /** * @return {?} */ Scroll.prototype.ngOnInit = function () { this.scrollElement = this._elementRef.nativeElement.children[0]; }; /** * Add a scroll event handler to the scroll element if it exists. * undefined if the scroll element doesn't exist. * @param {?} handler * @return {?} */ Scroll.prototype.addScrollEventListener = function (handler) { var _this = this; if (!this.scrollElement) { return; } this.scrollElement.addEventListener('scroll', handler); return function () { _this.scrollElement.removeEventListener('scroll', handler); }; }; Scroll.decorators = [ { type: core_1.Component, args: [{ selector: 'ion-scroll', template: '<div class="scroll-content">' + '<div class="scroll-zoom-wrapper">' + '<ng-content></ng-content>' + '</div>' + '</div>', host: { '[class.scroll-x]': 'scrollX', '[class.scroll-y]': 'scrollY' }, changeDetection: core_1.ChangeDetectionStrategy.OnPush, encapsulation: core_1.ViewEncapsulation.None, },] }, ]; /** @nocollapse */ Scroll.ctorParameters = function () { return [ { type: core_1.ElementRef, }, ]; }; Scroll.propDecorators = { 'scrollX': [{ type: core_1.Input },], 'scrollY': [{ type: core_1.Input },], 'zoom': [{ type: core_1.Input },], 'maxZoom': [{ type: core_1.Input },], }; return Scroll; }()); exports.Scroll = Scroll; function Scroll_tsickle_Closure_declarations() { /** @type {?} */ Scroll.decorators; /** * @nocollapse * @type {?} */ Scroll.ctorParameters; /** @type {?} */ Scroll.propDecorators; /** @type {?} */ Scroll.prototype._scrollX; /** @type {?} */ Scroll.prototype._scrollY; /** @type {?} */ Scroll.prototype._zoom; /** @type {?} */ Scroll.prototype._maxZoom; /** @type {?} */ Scroll.prototype.maxScale; /** @type {?} */ Scroll.prototype.zoomDuration; /** @type {?} */ Scroll.prototype.scrollElement; /** @type {?} */ Scroll.prototype._elementRef; } }); //# sourceMappingURL=scroll.js.map