import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { from, merge, of, Subject, switchMap } from 'rxjs';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "../localized-text/localized-text.component";
import * as i3 from "@ngx-translate/core";
import * as i4 from "../../pipes/locale-date.pipe";
import * as i5 from "../../pipes/locale-currency.pipe";
export class DataTableFilterLabelComponent {
    ngOnInit() {
        const filterValueUpdate$ = new Subject();
        this.filterWithValue.onUpdate(() => filterValueUpdate$.next());
        this.customFilterLabel$ = merge(of(this.filterWithValue), filterValueUpdate$).pipe(switchMap(() => {
            if (this.filterWithValue?.filter.type.kind === 'custom') {
                const labelResult = this.filterWithValue.filter.type.getLabel(this.filterWithValue.value);
                return typeof labelResult === 'string' ? of(labelResult) : from(labelResult);
            }
            else {
                return of('');
            }
        }));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: DataTableFilterLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: DataTableFilterLabelComponent, selector: "vdr-data-table-filter-label", inputs: { filterWithValue: "filterWithValue" }, ngImport: i0, template: "<span><vdr-localized-text [text]=\"filterWithValue.filter.label\" />:</span>\n<div>\n    <ng-container *ngIf=\"filterWithValue.isSelect()\">\n        {{ filterWithValue.value?.join(', ') }}\n    </ng-container>\n    <ng-container *ngIf=\"filterWithValue.isId()\">\n        <span *ngIf=\"filterWithValue.value?.operator === 'eq'\">{{ 'common.operator-eq' | translate }}</span>\n        <span *ngIf=\"filterWithValue.value?.operator === 'notEq'\">{{\n            'common.operator-not-eq' | translate\n        }}</span>\n        <span> \"{{ filterWithValue.value?.term }}\"</span>\n    </ng-container>\n    <ng-container *ngIf=\"filterWithValue.isText()\">\n        <span *ngIf=\"filterWithValue.value?.operator === 'contains'\">{{\n            'common.operator-contains' | translate\n        }}</span>\n        <span *ngIf=\"filterWithValue.value?.operator === 'eq'\">{{ 'common.operator-eq' | translate }}</span>\n        <span *ngIf=\"filterWithValue.value?.operator === 'notContains'\">{{\n            'common.operator-notContains' | translate\n        }}</span>\n        <span *ngIf=\"filterWithValue.value?.operator === 'notEq'\">{{\n            'common.operator-not-eq' | translate\n        }}</span>\n        <span *ngIf=\"filterWithValue.value?.operator === 'regex'\">{{\n            'common.operator-regex' | translate\n        }}</span>\n        <span> \"{{ filterWithValue.value?.term }}\"</span>\n    </ng-container>\n    <ng-container *ngIf=\"filterWithValue.isBoolean()\">\n        <span *ngIf=\"filterWithValue?.value\">{{ 'common.boolean-true' | translate }}</span>\n        <span *ngIf=\"!filterWithValue?.value\">{{ 'common.boolean-false' | translate }}</span>\n    </ng-container>\n    <ng-container *ngIf=\"filterWithValue.isDateRange()\">\n        <ng-container *ngIf=\"filterWithValue.value.mode === 'relative'\">\n            <span *ngIf=\"filterWithValue.value.relativeUnit === 'day'\">\n                {{ 'datetime.relative-past-days' | translate: { count: filterWithValue.value.relativeValue } }}\n            </span>\n            <span *ngIf=\"filterWithValue.value.relativeUnit === 'month'\">\n                {{ 'datetime.relative-past-months' | translate: { count: filterWithValue.value.relativeValue } }}\n            </span>\n            <span *ngIf=\"filterWithValue.value.relativeUnit === 'year'\">\n                {{ 'datetime.relative-past-years' | translate: { count: filterWithValue.value.relativeValue } }}\n            </span>\n        </ng-container>\n        <ng-container *ngIf=\"filterWithValue.value.mode === 'range'\">\n            <span *ngIf=\"filterWithValue.value?.start && filterWithValue.value?.end\">\n                {{ filterWithValue.value?.start | localeDate : 'shortDate' }} -\n                {{ filterWithValue.value?.end | localeDate : 'shortDate' }}\n            </span>\n            <span *ngIf=\"filterWithValue.value?.start && !filterWithValue.value?.end\">\n                > {{ filterWithValue.value?.start | localeDate : 'shortDate' }}\n            </span>\n            <span *ngIf=\"filterWithValue.value?.end && !filterWithValue.value?.start\">\n                < {{ filterWithValue.value?.end | localeDate : 'shortDate' }}\n            </span>\n        </ng-container>\n    </ng-container>\n    <ng-container *ngIf=\"filterWithValue.isNumber()\">\n        <span *ngIf=\"filterWithValue.value?.operator === 'eq'\"> = </span>\n        <span *ngIf=\"filterWithValue.value?.operator === 'gt'\"> > </span>\n        <span *ngIf=\"filterWithValue.value?.operator === 'lt'\"> < </span>\n        <span *ngIf=\"$any(filterWithValue.filter.type).inputType === 'currency'\">{{\n            +filterWithValue.value?.amount | localeCurrency\n        }}</span>\n        <span *ngIf=\"$any(filterWithValue.filter.type).inputType !== 'currency'\">{{\n            +filterWithValue.value?.amount\n        }}</span>\n    </ng-container>\n    <ng-container *ngIf=\"filterWithValue.isCustom()\">\n        <span>{{ customFilterLabel$ | async }}</span>\n    </ng-container>\n</div>\n", styles: [":host{display:flex;gap:calc(var(--space-unit) / 2)}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.LocalizedTextComponent, selector: "vdr-localized-text", inputs: ["text"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }, { kind: "pipe", type: i4.LocaleDatePipe, name: "localeDate" }, { kind: "pipe", type: i5.LocaleCurrencyPipe, name: "localeCurrency" }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: DataTableFilterLabelComponent, decorators: [{
            type: Component,
            args: [{ selector: 'vdr-data-table-filter-label', changeDetection: ChangeDetectionStrategy.Default, template: "<span><vdr-localized-text [text]=\"filterWithValue.filter.label\" />:</span>\n<div>\n    <ng-container *ngIf=\"filterWithValue.isSelect()\">\n        {{ filterWithValue.value?.join(', ') }}\n    </ng-container>\n    <ng-container *ngIf=\"filterWithValue.isId()\">\n        <span *ngIf=\"filterWithValue.value?.operator === 'eq'\">{{ 'common.operator-eq' | translate }}</span>\n        <span *ngIf=\"filterWithValue.value?.operator === 'notEq'\">{{\n            'common.operator-not-eq' | translate\n        }}</span>\n        <span> \"{{ filterWithValue.value?.term }}\"</span>\n    </ng-container>\n    <ng-container *ngIf=\"filterWithValue.isText()\">\n        <span *ngIf=\"filterWithValue.value?.operator === 'contains'\">{{\n            'common.operator-contains' | translate\n        }}</span>\n        <span *ngIf=\"filterWithValue.value?.operator === 'eq'\">{{ 'common.operator-eq' | translate }}</span>\n        <span *ngIf=\"filterWithValue.value?.operator === 'notContains'\">{{\n            'common.operator-notContains' | translate\n        }}</span>\n        <span *ngIf=\"filterWithValue.value?.operator === 'notEq'\">{{\n            'common.operator-not-eq' | translate\n        }}</span>\n        <span *ngIf=\"filterWithValue.value?.operator === 'regex'\">{{\n            'common.operator-regex' | translate\n        }}</span>\n        <span> \"{{ filterWithValue.value?.term }}\"</span>\n    </ng-container>\n    <ng-container *ngIf=\"filterWithValue.isBoolean()\">\n        <span *ngIf=\"filterWithValue?.value\">{{ 'common.boolean-true' | translate }}</span>\n        <span *ngIf=\"!filterWithValue?.value\">{{ 'common.boolean-false' | translate }}</span>\n    </ng-container>\n    <ng-container *ngIf=\"filterWithValue.isDateRange()\">\n        <ng-container *ngIf=\"filterWithValue.value.mode === 'relative'\">\n            <span *ngIf=\"filterWithValue.value.relativeUnit === 'day'\">\n                {{ 'datetime.relative-past-days' | translate: { count: filterWithValue.value.relativeValue } }}\n            </span>\n            <span *ngIf=\"filterWithValue.value.relativeUnit === 'month'\">\n                {{ 'datetime.relative-past-months' | translate: { count: filterWithValue.value.relativeValue } }}\n            </span>\n            <span *ngIf=\"filterWithValue.value.relativeUnit === 'year'\">\n                {{ 'datetime.relative-past-years' | translate: { count: filterWithValue.value.relativeValue } }}\n            </span>\n        </ng-container>\n        <ng-container *ngIf=\"filterWithValue.value.mode === 'range'\">\n            <span *ngIf=\"filterWithValue.value?.start && filterWithValue.value?.end\">\n                {{ filterWithValue.value?.start | localeDate : 'shortDate' }} -\n                {{ filterWithValue.value?.end | localeDate : 'shortDate' }}\n            </span>\n            <span *ngIf=\"filterWithValue.value?.start && !filterWithValue.value?.end\">\n                > {{ filterWithValue.value?.start | localeDate : 'shortDate' }}\n            </span>\n            <span *ngIf=\"filterWithValue.value?.end && !filterWithValue.value?.start\">\n                < {{ filterWithValue.value?.end | localeDate : 'shortDate' }}\n            </span>\n        </ng-container>\n    </ng-container>\n    <ng-container *ngIf=\"filterWithValue.isNumber()\">\n        <span *ngIf=\"filterWithValue.value?.operator === 'eq'\"> = </span>\n        <span *ngIf=\"filterWithValue.value?.operator === 'gt'\"> > </span>\n        <span *ngIf=\"filterWithValue.value?.operator === 'lt'\"> < </span>\n        <span *ngIf=\"$any(filterWithValue.filter.type).inputType === 'currency'\">{{\n            +filterWithValue.value?.amount | localeCurrency\n        }}</span>\n        <span *ngIf=\"$any(filterWithValue.filter.type).inputType !== 'currency'\">{{\n            +filterWithValue.value?.amount\n        }}</span>\n    </ng-container>\n    <ng-container *ngIf=\"filterWithValue.isCustom()\">\n        <span>{{ customFilterLabel$ | async }}</span>\n    </ng-container>\n</div>\n", styles: [":host{display:flex;gap:calc(var(--space-unit) / 2)}\n"] }]
        }], propDecorators: { filterWithValue: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 