"use strict";
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var _ = require("lodash");
var filterGroupOld_service_1 = require("../filterGroupOld.service");
var ModeFilterGroupOld = (function (_super) {
    __extends(ModeFilterGroupOld, _super);
    function ModeFilterGroupOld(settings, object, transformService) {
        var _this = _super.call(this, settings, object) || this;
        _this.transformService = transformService;
        _this.getValue = settings.getValue;
        settings.options = _.map(settings.options, _this.buildModeOption.bind(_this));
        _this.initOptions();
        return _this;
    }
    ModeFilterGroupOld.prototype.serialize = function () {
        var activeOption = this.activeOption;
        if (activeOption.displayAll) {
            return null;
        }
        return activeOption.value;
    };
    ModeFilterGroupOld.prototype.buildModeOption = function (option) {
        var _this = this;
        var modeOption = option;
        modeOption.filter = function (item) {
            if (modeOption.displayAll) {
                return true;
            }
            return _this.transformService.getValue(item, _this.getValue) === modeOption.value;
        };
        return modeOption;
    };
    return ModeFilterGroupOld;
}(filterGroupOld_service_1.FilterGroupOld));
exports.ModeFilterGroupOld = ModeFilterGroupOld;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kZUZpbHRlckdyb3VwT2xkLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJtb2RlRmlsdGVyR3JvdXBPbGQuc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQSwwQkFBNEI7QUFNNUIsb0VBQThGO0FBeUI5RjtJQUF3QyxzQ0FBYztJQUtyRCw0QkFBWSxRQUEwQyxFQUNsRCxNQUErQixFQUMvQixnQkFBK0M7UUFGbkQsWUFHQyxrQkFBVyxRQUFRLEVBQUUsTUFBTSxDQUFDLFNBTTVCO1FBTEEsS0FBSSxDQUFDLGdCQUFnQixHQUFHLGdCQUFnQixDQUFDO1FBRXpDLE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