import { __decorate } from "tslib";
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { DeviceDetectorService } from 'ngx-device-detector';
var GridDesktopInlineFilterComponent = /** @class */ (function () {
    function GridDesktopInlineFilterComponent(deviceService) {
        var _this = this;
        this.deviceService = deviceService;
        this.externalFilters = [];
        this.columns = [];
        this.externalFilter = {};
        this.filter = {};
        this.showInlineFilter = false;
        this.showColumnInlineFilter = false;
        this.sdChange = new EventEmitter();
        this.displayKey = 'SDCUSTOM';
        this.onUpdateFilter = function () {
            _this.sdChange.emit();
        };
        this.isDesktop = this.deviceService.isDesktop();
    }
    GridDesktopInlineFilterComponent.ctorParameters = function () { return [
        { type: DeviceDetectorService }
    ]; };
    __decorate([
        Input()
    ], GridDesktopInlineFilterComponent.prototype, "externalFilters", void 0);
    __decorate([
        Input()
    ], GridDesktopInlineFilterComponent.prototype, "columns", void 0);
    __decorate([
        Input()
    ], GridDesktopInlineFilterComponent.prototype, "externalFilter", void 0);
    __decorate([
        Input()
    ], GridDesktopInlineFilterComponent.prototype, "filter", void 0);
    __decorate([
        Input()
    ], GridDesktopInlineFilterComponent.prototype, "showInlineFilter", void 0);
    __decorate([
        Input()
    ], GridDesktopInlineFilterComponent.prototype, "showColumnInlineFilter", void 0);
    __decorate([
        Output()
    ], GridDesktopInlineFilterComponent.prototype, "sdChange", void 0);
    GridDesktopInlineFilterComponent = __decorate([
        Component({
            selector: 'sd-grid-desktop-inline-filter',
            template: "<ng-container *ngIf=\"isDesktop && showInlineFilter\">\r\n  <div *ngIf=\"externalFilters?.length\" class=\"row\">\r\n    <ng-container *ngFor=\"let item of externalFilters\">\r\n      <div *ngIf=\"item.type !=='daterange' && item.type !=='numberrange';else elseFilterRange\"\r\n        class=\"col-lg-2 col-md-3 col-sm-6\">\r\n        <sd-input-control [label]=\"item.title\" *ngIf=\"item.type === 'string'\" type=\"text\"\r\n          [(model)]=\"externalFilter[item.field]\" (keyupEnter)=\"onUpdateFilter()\">\r\n        </sd-input-control>\r\n        <sd-input-control [label]=\"item.title\" *ngIf=\"item.type === 'number'\" type=\"number\"\r\n          [(model)]=\"externalFilter[item.field]\" (keyupEnter)=\"onUpdateFilter()\">\r\n        </sd-input-control>\r\n        <sd-select-control [label]=\"item.title\" *ngIf=\"item.type === 'bool'\" [items]=\"[{value:'1',display:item.trueValue || 'True' },\r\n          {value:'0',display:item.falseValue || 'False' }]\" valueField=\"value\" displayField=\"display\"\r\n          [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onUpdateFilter()\">\r\n        </sd-select-control>\r\n        <sd-radio-control [label]=\"item.title\" *ngIf=\"item.type === 'radio'\" [items]=\"item.values\"\r\n          [valueField]=\"item.valueField\" [displayField]=\"item.displayField\" [(model)]=\"externalFilter[item.field]\"\r\n          (sdChange)=\"onUpdateFilter()\">\r\n        </sd-radio-control>\r\n        <sd-input-control [label]=\"item.title\" *ngIf=\"item.type === 'custom'\"\r\n          [(model)]=\"externalFilter[displayKey + item.field]\"\r\n          (sdClick)=\"item?.onClick(externalFilter, item.field, displayKey + item.field)\" (sdChange)=\"onUpdateFilter()\">\r\n        </sd-input-control>\r\n        <ng-container *ngIf=\"item.type === 'values'\">\r\n          <sd-select-control *ngIf=\"item.selection === 'MULTIPLE'\" [label]=\"item.title\" [items]=\"item.values\"\r\n            [valueField]=\"item.valueField\" [displayField]=\"item.displayField\" [(model)]=\"externalFilter[item.field]\"\r\n            (sdChange)=\"onUpdateFilter()\" multiple=\"true\">\r\n          </sd-select-control>\r\n          <sd-autocomplete-control *ngIf=\"item.selection === 'AUTOCOMPLETE'\" [label]=\"item.title\" [items]=\"item.values\"\r\n            [valueField]=\"item.valueField\" [displayField]=\"item.displayField\" [(model)]=\"externalFilter[item.field]\"\r\n            (sdChange)=\"onUpdateFilter()\">\r\n          </sd-autocomplete-control>\r\n          <sd-chip-control *ngIf=\"item.selection === 'MULTIPLEAUTOCOMPLETE'\" [label]=\"item.title\" [items]=\"item.values\"\r\n            [valueField]=\"item.valueField\" [displayField]=\"item.displayField\" [(model)]=\"externalFilter[item.field]\"\r\n            (sdChange)=\"onUpdateFilter()\">\r\n          </sd-chip-control>\r\n          <sd-select-control *ngIf=\"!item.selection\" [label]=\"item.title\" [items]=\"item.values\"\r\n            [valueField]=\"item.valueField\" [displayField]=\"item.displayField\" [(model)]=\"externalFilter[item.field]\"\r\n            (sdChange)=\"onUpdateFilter()\">\r\n          </sd-select-control>\r\n        </ng-container>\r\n        <sd-date-picker-control [label]=\"item.title\" *ngIf=\"item.type ==='date'\" [(model)]=\"externalFilter[item.field]\"\r\n          type=\"date\" (sdChange)=\"onUpdateFilter()\">\r\n        </sd-date-picker-control>\r\n        <sd-date-range-picker-control [label]=\"item.title\" *ngIf=\"item.type ==='daterangefull'\"\r\n          [(fromDate)]=\"externalFilter[item.field].from\" [(toDate)]=\"externalFilter[item.field].to\"\r\n          [minDate]=\"item.minDate\" [maxDate]=\"item.maxDate\" type=\"date\"\r\n          (sdChange)=\"onUpdateFilter()\">\r\n        </sd-date-range-picker-control>\r\n      </div>\r\n      <ng-template #elseFilterRange>\r\n        <ng-container *ngIf=\"item.type ==='daterange' && externalFilter[item.field]\">\r\n          <div class=\"col-lg-2 col-md-3 col-sm-6\">\r\n            <sd-date-picker-control [label]=\"item.fromTitle\" [(model)]=\"externalFilter[item.field].from\"\r\n              [type]=\"item.enableTime ? 'datetime' : 'date'\" [minDate]=\"item.minDate\"\r\n              [maxDate]=\"externalFilter[item.field].to || item.maxDate\" (sdChange)=\"onUpdateFilter()\">\r\n            </sd-date-picker-control>\r\n          </div>\r\n          <div class=\"col-lg-2 col-md-3 col-sm-6\">\r\n            <sd-date-picker-control [label]=\"item.toTitle\" [(model)]=\"externalFilter[item.field].to\"\r\n              [type]=\"item.enableTime ? 'datetime' : 'date'\" [minDate]=\"item.minDate || externalFilter[item.field].from\"\r\n              [maxDate]=\"item.maxDate\" (sdChange)=\"onUpdateFilter()\">\r\n            </sd-date-picker-control>\r\n          </div>\r\n        </ng-container>\r\n        <ng-container *ngIf=\"item.type ==='numberrange' && externalFilter[item.field]\">\r\n          <div class=\"col-lg-2 col-md-3 col-sm-6\">\r\n            <sd-input-control [label]=\"item.fromTitle\" type=\" number\" [(model)]=\"externalFilter[item.field].from\"\r\n              (sdChange)=\"onUpdateFilter()\">\r\n            </sd-input-control>\r\n          </div>\r\n          <div class=\"col-lg-2 col-md-3 col-sm-6\">\r\n            <sd-input-control [label]=\"item.toTitle\" type=\" number\" [(model)]=\"externalFilter[item.field].to\"\r\n              (sdChange)=\"onUpdateFilter()\">\r\n            </sd-input-control>\r\n          </div>\r\n        </ng-container>\r\n      </ng-template>\r\n    </ng-container>\r\n  </div>\r\n\r\n  <div *ngIf=\"columns?.length && showColumnInlineFilter\" class=\"row\">\r\n    <ng-container *ngFor=\"let item of columns\">\r\n      <div class=\"col-lg-2 col-md-3 col-sm-6\">\r\n        <sd-input-control [label]=\"item.title\" *ngIf=\"item.type === 'string'\" type=\"text\" [(model)]=\"filter[item.field]\"\r\n          (keyupEnter)=\"onUpdateFilter()\">\r\n        </sd-input-control>\r\n        <sd-input-control [label]=\"item.title\" *ngIf=\"item.type === 'number'\" type=\"number\"\r\n          [(model)]=\"filter[item.field]\" (keyupEnter)=\"onUpdateFilter()\">\r\n        </sd-input-control>\r\n        <sd-select-control [label]=\"item.title\" *ngIf=\"item.type === 'bool'\" [items]=\"[{value:'1',display:item.trueValue || 'True' },\r\n          {value:'0',display:item.falseValue || 'False' }]\" valueField=\"value\" displayField=\"display\"\r\n          [(model)]=\"filter[item.field]\" (sdChange)=\"onUpdateFilter()\">\r\n        </sd-select-control>\r\n        <sd-radio-control [label]=\"item.title\" *ngIf=\"item.type === 'radio'\" [items]=\"item.values\"\r\n          [valueField]=\"item.valueField\" [displayField]=\"item.displayField\" [(model)]=\"externalFilter[item.field]\"\r\n          (sdChange)=\"onUpdateFilter()\">\r\n        </sd-radio-control>\r\n        <sd-select-control *ngIf=\"item.type === 'values'\" [label]=\"item.title\" [items]=\"item.values\"\r\n          [valueField]=\"item.valueField\" [displayField]=\"item.displayField\" [(model)]=\"externalFilter[item.field]\"\r\n          (sdChange)=\"onUpdateFilter()\">\r\n        </sd-select-control>\r\n        <sd-date-picker-control [label]=\"item.title\" *ngIf=\"item.type ==='date'\" [(model)]=\"externalFilter[item.field]\"\r\n          type=\"date\" (sdChange)=\"onUpdateFilter()\">\r\n        </sd-date-picker-control>\r\n      </div>\r\n    </ng-container>\r\n  </div>\r\n</ng-container>",
            styles: [""]
        })
    ], GridDesktopInlineFilterComponent);
    return GridDesktopInlineFilterComponent;
}());
export { GridDesktopInlineFilterComponent };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3JpZC1kZXNrdG9wLWlubGluZS1maWx0ZXIuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vc3VwZXJkZXYtYW5ndWxhci1jb3JlLyIsInNvdXJjZXMiOlsibGliL2NvbnRyb2xzL2dyaWQtY29udHJvbC9jb21wb25lbnRzL2dyaWQtZGVza3RvcC1pbmxpbmUtZmlsdGVyL2dyaWQtZGVza3RvcC1pbmxpbmUtZmlsdGVyLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLFlBQVksRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUd2RSxPQUFPLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQU81RDtJQVVFLDBDQUNVLGFBQW9DO1FBRDlDLGlCQUlDO1FBSFMsa0JBQWEsR0FBYixhQUFhLENBQXVCO1FBVnJDLG9CQUFlLEdBQXlCLEVBQUUsQ0FBQztRQUMzQyxZQUFPLEdBQWlCLEVBQUUsQ0FBQztRQUMzQixtQkFBYyxHQUFRLEVBQUUsQ0FBQztRQUN6QixXQUFNLEdBQVEsRUFBRSxDQUFDO1FBQ2pCLHFC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