import { Directive, ElementRef, Input, Renderer } from '@angular/core';
import { Config } from '../../config/config';
import { Ion } from '../ion';
import { isTrueProperty } from '../../util/util';
import { ItemSlidingGesture } from '../item/item-sliding-gesture';
import { GestureController } from '../../gestures/gesture-controller';
import { DomController } from '../../util/dom-controller';
export class List extends Ion {
    constructor(config, elementRef, renderer, _gestureCtrl, _domCtrl) {
        super(config, elementRef, renderer, 'list');
        this._gestureCtrl = _gestureCtrl;
        this._domCtrl = _domCtrl;
        this._enableSliding = true;
        this._containsSlidingItems = false;
    }
    set mode(val) {
        this._setMode(val);
    }
    get sliding() {
        return this._enableSliding;
    }
    set sliding(val) {
        this._enableSliding = isTrueProperty(val);
        this._updateSlidingState();
    }
    containsSlidingItem(contains) {
        this._containsSlidingItems = contains;
        this._updateSlidingState();
    }
    _updateSlidingState() {
        let shouldSlide = this._enableSliding && this._containsSlidingItems;
        if (!shouldSlide) {
            this._slidingGesture && this._slidingGesture.destroy();
            this._slidingGesture = null;
        }
        else if (!this._slidingGesture) {
            (void 0);
            this._slidingGesture = new ItemSlidingGesture(this, this._gestureCtrl, this._domCtrl);
            this._slidingGesture.listen();
        }
    }
    closeSlidingItems() {
        this._slidingGesture && this._slidingGesture.closeOpened();
    }
    destroy() {
        this._slidingGesture && this._slidingGesture.destroy();
    }
}
List.decorators = [
    { type: Directive, args: [{
                selector: 'ion-list',
            },] },
];
List.ctorParameters = [
    { type: Config, },
    { type: ElementRef, },
    { type: Renderer, },
    { type: GestureController, },
    { type: DomController, },
];
List.propDecorators = {
    'mode': [{ type: Input },],
    'sliding': [{ type: Input },],
};
//# sourceMappingURL=list.js.map