"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var core_1 = require("@angular/core");
var selectableCardContainer_1 = require("../../selectableCardContainer");
var SelectionComponent = (function () {
    function SelectionComponent(cardContainer) {
        this.cardContainer = cardContainer;
    }
    Object.defineProperty(SelectionComponent.prototype, "selectedItems$", {
        get: function () {
            return this.cardContainer.numberSelected$;
        },
        enumerable: true,
        configurable: true
    });
    SelectionComponent.prototype.ngOnInit = function () {
        this.pagingEnabled = !!this.cardContainer.dataSource.pager;
    };
    SelectionComponent.prototype.selectPage = function () {
        var _this = this;
        this.cardContainer.selectionData$.take(1).subscribe(function (data) {
            _this.cardContainer.setSelected(data, true);
        });
    };
    SelectionComponent.prototype.selectAll = function () {
        var _this = this;
        this.cardContainer.selectionFilteredData$.take(1).subscribe(function (data) {
            _this.cardContainer.setSelected(data, true);
        });
    };
    SelectionComponent.prototype.clearPage = function () {
        var _this = this;
        this.cardContainer.selectionData$.take(1).subscribe(function (data) {
            _this.cardContainer.setSelected(data, false);
        });
    };
    SelectionComponent.prototype.clearAll = function () {
        var _this = this;
        this.cardContainer.selectionFilteredData$.take(1).subscribe(function (data) {
            _this.cardContainer.setSelected(data, false);
        });
    };
    return SelectionComponent;
}());
SelectionComponent = __decorate([
    core_1.Component({
        selector: 'rlSelection',
        template: require('./selectionControl.html'),
        changeDetection: core_1.ChangeDetectionStrategy.OnPush,
    }),
    __param(0, core_1.Inject(core_1.forwardRef(function () { return selectableCardContainer_1.SelectableCardContainerComponent; }))),
    __metadata("design:paramtypes", [selectableCardContainer_1.SelectableCardContainerComponent])
], SelectionComponent);
exports.SelectionComponent = SelectionComponent;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VsZWN0aW9uQ29udHJvbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInNlbGVjdGlvbkNvbnRyb2wudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7OztBQUFBLHNDQUErRjtBQUsvRix5RUFBd0c7QUFPeEcsSUFBYSxrQkFBa0I7SUFLOUIsNEJBQXdFLGFBQWtEO1FBQ3pILElBQUksQ0FBQyxhQUFhLEdBQUcsYUFBYSxDQUFDO0lBQ3BDLENBQUM7SUFFRCxzQkFBSSw4Q0FBYzthQUFsQjtZQUNDLE1BQU0sQ0FBQyxJQUFJLENBQUMsYUFBYSxDQUFDLGVBQWUsQ0FBQztRQUMzQyxDQUFDOzs7T0FBQTtJQUVELHFDQUFRLEdBQVI7UUFDQyxJQUFJLENBQUMsYUFBYSxHQUFHLENBQUMsQ0FBQyxJQUFJLENBQUMsYUFBYSxDQUFDLFVBQVUsQ0FBQyxLQUFLLENBQUM7SUFDNUQsQ0FBQztJQUVELHVDQUFVLEdBQVY7UUFBQSxpQkFJQztRQUhBLElBQUksQ0FBQyxhQUFhLENBQUMsY0FBYyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQyxTQUFTLENBQUMsVUFBQSxJQUFJO1lBQ3ZELEtBQUksQ0FBQyxhQUFhLENBQUMsV0FBVyxDQUFDLElBQUksRUFBRSxJQUFJLENBQUMsQ0FBQztRQUM1QyxDQUFDLENBQUMsQ0FBQztJQUNKLENBQUM7SUFFRCxzQ0FBUyxHQUFUO1FBQ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