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 __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
    if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
        if (ar || !(i in from)) {
            if (!ar) ar = Array.prototype.slice.call(from, 0, i);
            ar[i] = from[i];
        }
    }
    return to.concat(ar || Array.prototype.slice.call(from));
};
import { autoinject } from "aurelia-framework";
import { Config } from "../config";
import * as breeze from 'breeze-client';
export var PredicateUtils = (function () {
    function PredicateUtils(config) {
        this.config = config;
    }
    PredicateUtils.prototype.getPredicates = function (filterText, filterProperty, propType, queryOp) {
        var _a, _b, _c;
        var predicates = new Array();
        var filterTexts = filterText.split((_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.agGridConfig) === null || _b === void 0 ? void 0 : _b.stringSeparatorAgGridFilter) !== null && _c !== void 0 ? _c : '');
        if (filterTexts.length > 0) {
            var predicatesTemp = filterTexts
                .filter(function (filterText) { var _a; return filterText.length > 0 && false == (((_a = propType === null || propType === void 0 ? void 0 : propType.isNumeric) !== null && _a !== void 0 ? _a : false) && isNaN(filterText)); })
                .map(function (filterText) { return new breeze.Predicate(filterProperty, queryOp, { value: filterText, isLiteral: true, dataType: propType }); });
            if (predicatesTemp.length > 0) {
                predicates.push.apply(predicates, __spreadArray([], __read(predicatesTemp), false));
            }
        }
        return predicates;
    };
    PredicateUtils = __decorate([
        autoinject,
        __metadata("design:paramtypes", [Config])
    ], PredicateUtils);
    return PredicateUtils;
}());

//# sourceMappingURL=predicate-utils.js.map
