import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core';
import { AbstractDbxActionHandlerDirective, FilterSourceDirective, provideActionStoreSource } from '@dereekb/dbx-core';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { DbxButtonModule } from '../../button/button.module';
import { FlexLayoutModule } from '@ngbracket/ngx-layout';
import * as i0 from "@angular/core";
import * as i1 from "@dereekb/dbx-core";
import * as i2 from "../../button/button.component";
import * as i3 from "@angular/material/button";
import * as i4 from "@angular/material/icon";
import * as i5 from "@ngbracket/ngx-layout/flex";
/**
 * Action component used to simplify creating a filter form.
 *
 * Provides a DbxAction and configures the action to set the filter on a FilterSourceDirective when triggered.
 */
export class DbxFilterWrapperComponent extends AbstractDbxActionHandlerDirective {
    filterSourceDirective = inject((FilterSourceDirective));
    showButtons = input(true);
    applyRaised = input(true);
    applyIcon = input('filter_list');
    applyText = input('Filter');
    constructor() {
        super();
        // configure handler function
        this._dbxActionHandlerInstance.setHandlerFunction((filter, instance) => {
            this.filterSourceDirective.setFilter(filter);
            instance.success(true);
        });
    }
    applyFilter() {
        this.source.setIsModified(true); // Force setting modified.
        this.source.trigger();
    }
    resetFilter() {
        this.filterSourceDirective.resetFilter();
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxFilterWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: DbxFilterWrapperComponent, isStandalone: true, selector: "dbx-filter-wrapper", inputs: { showButtons: { classPropertyName: "showButtons", publicName: "showButtons", isSignal: true, isRequired: false, transformFunction: null }, applyRaised: { classPropertyName: "applyRaised", publicName: "applyRaised", isSignal: true, isRequired: false, transformFunction: null }, applyIcon: { classPropertyName: "applyIcon", publicName: "applyIcon", isSignal: true, isRequired: false, transformFunction: null }, applyText: { classPropertyName: "applyText", publicName: "applyText", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideActionStoreSource(null)], usesInheritance: true, ngImport: i0, template: "<div class=\"dbx-filter-wrapper\">\n  <div class=\"dbx-filter-wrapper-content\">\n    <ng-content></ng-content>\n  </div>\n  @if (showButtons()) {\n    <div fxLayout=\"row\">\n      <dbx-button dbxActionButton [raised]=\"applyRaised()\" [text]=\"applyText()\" [icon]=\"applyIcon()\"></dbx-button>\n      <div class=\"spacer\"></div>\n      <button mat-icon-button (click)=\"resetFilter()\">\n        <mat-icon>clear</mat-icon>\n      </button>\n    </div>\n  }\n</div>\n", dependencies: [{ kind: "ngmodule", type: DbxButtonModule }, { kind: "directive", type: i1.DbxActionButtonDirective, selector: "[dbxActionButton]" }, { kind: "component", type: i2.DbxButtonComponent, selector: "dbx-button", inputs: ["bar", "type", "buttonStyle", "color", "spinnerColor", "customButtonColor", "customTextColor", "customSpinnerColor", "basic", "raised", "stroked", "flat", "iconOnly", "fab", "mode"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: FlexLayoutModule }, { kind: "directive", type: i5.DefaultLayoutDirective, selector: "  [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md],  [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md],  [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm],  [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DbxFilterWrapperComponent, decorators: [{
            type: Component,
            args: [{ selector: 'dbx-filter-wrapper', providers: [provideActionStoreSource(null)], standalone: true, imports: [DbxButtonModule, MatButtonModule, MatIconModule, FlexLayoutModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"dbx-filter-wrapper\">\n  <div class=\"dbx-filter-wrapper-content\">\n    <ng-content></ng-content>\n  </div>\n  @if (showButtons()) {\n    <div fxLayout=\"row\">\n      <dbx-button dbxActionButton [raised]=\"applyRaised()\" [text]=\"applyText()\" [icon]=\"applyIcon()\"></dbx-button>\n      <div class=\"spacer\"></div>\n      <button mat-icon-button (click)=\"resetFilter()\">\n        <mat-icon>clear</mat-icon>\n      </button>\n    </div>\n  }\n</div>\n" }]
        }], ctorParameters: () => [] });
//# sourceMappingURL=data:application/json;base64, 