"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 core_1 = require("@angular/core");
var lodash_1 = require("lodash");
var typescript_angular_utilities_1 = require("typescript-angular-utilities");
var __number = typescript_angular_utilities_1.services.number;
var simpleCard_1 = require("./simpleCard");
var SimpleCardListComponent = (function () {
    function SimpleCardListComponent(numberUtility) {
        this.numberUtility = numberUtility;
    }
    Object.defineProperty(SimpleCardListComponent.prototype, "cards", {
        get: function () {
            return this.cardChildren != null
                ? this.cardChildren.toArray()
                : [];
        },
        enumerable: true,
        configurable: true
    });
    SimpleCardListComponent.prototype.openCard = function () {
        return lodash_1.every(this.cards, function (card) { return card.close(); });
    };
    SimpleCardListComponent.prototype.ngOnChanges = function (changes) {
        if (changes.alwaysOpen) {
            lodash_1.each(this.cards, function (card) { card.alwaysOpen = changes.alwaysOpen.currentValue; });
        }
    };
    SimpleCardListComponent.prototype.ngAfterViewChecked = function () {
        var _this = this;
        lodash_1.each(this.cards, function (card, index) {
            // mark the even indexed cards as 'odd', since they are the first, third, etc in the view
            card.alternatingClass = _this.numberUtility.isEven(index)
                ? 'card-odd'
                : '';
            if (_this.alwaysOpen != null) {
                card.alwaysOpen = _this.alwaysOpen;
            }
        });
    };
    return SimpleCardListComponent;
}());
__decorate([
    core_1.Input(),
    __metadata("design:type", Boolean)
], SimpleCardListComponent.prototype, "alwaysOpen", void 0);
__decorate([
    core_1.ContentChildren(simpleCard_1.SimpleCardComponent),
    __metadata("design:type", core_1.QueryList)
], SimpleCardListComponent.prototype, "cardChildren", void 0);
SimpleCardListComponent = __decorate([
    core_1.Component({
        selector: 'rlSimpleCardList,[rlSimpleCardList]',
        template: "\n\t\t\t<span class=\"card-list\">\n\t\t\t\t<ng-content></ng-content>\n\t\t\t</span>",
    }),
    __metadata("design:paramtypes", [__number.NumberUtility])
], SimpleCardListComponent);
exports.SimpleCardListComponent = SimpleCardListComponent;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2ltcGxlQ2FyZExpc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzaW1wbGVDYXJkTGlzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsc0NBQXdIO0FBQ3hILGlDQUFxQztBQUVyQyw2RUFBd0Q7QUFDeEQsSUFBTyxRQUFRLEdBQUcsdUNBQVEsQ0FBQyxNQUFNLENBQUM7QUFFbEMsMkNBQW1EO0FBY25ELElBQWEsdUJBQXVCO0lBYW5DLGlDQUFZLGFBQXFDO1FBQ2hELElBQUksQ0FBQyxhQUFhLEdBQUcsYUFBYSxDQUFDO0lBQ3BDLENBQUM7SUFWRCxzQkFBSSwwQ0FBSzthQUFUO1lBQ0MsTUFBTSxDQUFDLElBQUksQ0FBQyxZQUFZLElBQUksSUFBSTtrQkFDN0IsSUFBSSxDQUFDLFlBQVksQ0FBQyxPQUFPLEVBQUU7a0JBQzNCLEVBQUUsQ0FBQztRQUNQLENBQUM7OztPQUFBO0lBUUQsMENBQVEsR0FBUjtRQUNDLE1BQU0sQ0FBQyxjQUFLLENBQUMsSUFBSSxDQUFDLEtBQUssRUFBRSxVQUFBLElBQUksSUFBSSxPQUFBLElBQUksQ0FBQyxLQUFLLEVBQUUsRUFBWixDQUFZLENBQUMsQ0FBQztJQUNoRCxDQUFDO0lBRUQsNkNBQVcsR0FBWCxVQUFZLE9BQXFC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