"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 filter_1 = require("../filter");
var SelectFilter = (function (_super) {
    __extends(SelectFilter, _super);
    function SelectFilter(settings, objectUtility, transformService) {
        var _this = _super.call(this) || this;
        _this.type = 'selectFilter';
        _this.predicate = function (item, selectedValue) {
            if (!selectedValue) {
                return true;
            }
            if (_this.comparer) {
                return _this.comparer(_this.getValue(item), selectedValue);
            }
            return _this.objectUtility.areEqual(_this.getValue(item), selectedValue);
        };
        _this.objectUtility = objectUtility;
        _this.transformService = transformService;
        _this.valueSelector = settings.valueSelector;
        _this.comparer = settings.comparer;
        return _this;
        // this.options = settings.options;
        // this.getOptions = settings.getOptions;
        // this.label = settings.label;
        // this.displayNameSelector = settings.displayNameSelector;
        // this.nullOption = settings.nullOption;
        // this.template = `<rl-select-filter filter="filter" source="dataSource" options="filter.options" get-options="filter.getOptions()"
        // 								   label="{{filter.label}}" selector="filter.displayNameSelector" null-option="{{filter.nullOption}}"></rl-select-filter>`;
    }
    Object.defineProperty(SelectFilter.prototype, "selectedValue$", {
        get: function () {
            return this.value$.asObservable();
        },
        enumerable: true,
        configurable: true
    });
    SelectFilter.prototype.select = function (value) {
        this.value$.next(value);
    };
    SelectFilter.prototype.getValue = function (item) {
        return this.transformService.getValue(item, this.valueSelector);
    };
    return SelectFilter;
}(filter_1.Filter));
exports.SelectFilter = SelectFilter;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VsZWN0RmlsdGVyLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzZWxlY3RGaWx0ZXIuc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFNQSxvQ0FBNEM7QUFrQjVDO0lBQTBELGdDQUE4QjtJQX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