import { A11yModule } from '@angular/cdk/a11y';
import { DragDropModule } from '@angular/cdk/drag-drop';
import { CommonModule } from '@angular/common';
import { Component, HostBinding, inject } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { ButtonGroupDirective } from '@metad/ocap-angular/core';
import { TranslateModule } from '@ngx-translate/core';
import { isString } from 'lodash-es';
import * as i0 from "@angular/core";
import * as i1 from "@angular/cdk/a11y";
import * as i2 from "@angular/forms";
import * as i3 from "@angular/cdk/drag-drop";
import * as i4 from "@angular/material/dialog";
import * as i5 from "@angular/material/button";
import * as i6 from "@angular/material/form-field";
import * as i7 from "@angular/material/input";
import * as i8 from "@ngx-translate/core";
export class NgmConfirmUniqueComponent {
    constructor() {
        this.isDialogContainer = true;
        this.data = inject(MAT_DIALOG_DATA);
        this._dialogRef = inject((MatDialogRef));
    }
    ngOnInit() {
        this.reset();
    }
    reset() {
        if (isString(this.data)) {
            this.value = this.data;
        }
        else {
            this.value = this.data?.value;
            this.title = this.data?.title;
        }
    }
    onSubmit() {
        this._dialogRef.close(this.value);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: NgmConfirmUniqueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.10", type: NgmConfirmUniqueComponent, isStandalone: true, selector: "ngm-confirm-unique", host: { properties: { "class.ngm-dialog-container": "this.isDialogContainer" } }, ngImport: i0, template: "<header mat-dialog-title cdkDrag cdkDragRootElement=\".cdk-overlay-pane\" cdkDragHandle>\n    <h4 style=\"pointer-events: none;\">\n        {{ title || ('COMPONENTS.CONFIRM.INPUT_UNIQUE_VALUE' | translate: {Default: 'Input Unique Value'}) }}\n    </h4>\n</header>\n\n<mat-dialog-content class=\"mat-typography\" cdkTrapFocus [cdkTrapFocusAutoCapture]=\"true\">\n    <form (ngSubmit)=\"onSubmit()\">\n        <mat-form-field appearance=\"fill\" class=\"w-full\">\n            <mat-label>{{ 'COMPONENTS.CONFIRM.NAME' | translate: {Default: 'Name'} }}</mat-label>\n            <input cdkFocusInitial matInput name=\"value\" [(ngModel)]=\"value\" />\n        </mat-form-field>\n    </form>\n</mat-dialog-content>\n\n<mat-dialog-actions >\n    <button mat-button (click)=\"reset()\">\n        {{ 'COMPONENTS.COMMON.RESET' | translate: {Default: 'Reset'} }}\n    </button>\n\n    <div ngmButtonGroup class=\"ml-8\">\n        <button mat-flat-button mat-dialog-close>\n            {{ 'COMPONENTS.COMMON.CANCEL' | translate: {Default: 'Cancel'} }}\n        </button>\n        <button mat-raised-button color=\"accent\" cdkFocusInitial [mat-dialog-close]=\"value\">\n            {{ 'COMPONENTS.COMMON.APPLY' | translate: {Default: 'Apply'} }}\n        </button>\n    </div>\n</mat-dialog-actions>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i3.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i3.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i4.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i4.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i4.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i4.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i5.MatButton, selector: "    button[mat-button], button[mat-raised-button], button[mat-flat-button],    button[mat-stroked-button]  ", exportAs: ["matButton"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i6.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i8.TranslatePipe, name: "translate" }, { kind: "directive", type: ButtonGroupDirective, selector: "[ngmButtonGroup]" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: NgmConfirmUniqueComponent, decorators: [{
            type: Component,
            args: [{ standalone: true, imports: [
                        CommonModule,
                        A11yModule,
                        FormsModule,
                        DragDropModule,
                        MatDialogModule,
                        MatButtonModule,
                        MatFormFieldModule,
                        MatInputModule,
                        TranslateModule,
                        ButtonGroupDirective
                    ], selector: 'ngm-confirm-unique', template: "<header mat-dialog-title cdkDrag cdkDragRootElement=\".cdk-overlay-pane\" cdkDragHandle>\n    <h4 style=\"pointer-events: none;\">\n        {{ title || ('COMPONENTS.CONFIRM.INPUT_UNIQUE_VALUE' | translate: {Default: 'Input Unique Value'}) }}\n    </h4>\n</header>\n\n<mat-dialog-content class=\"mat-typography\" cdkTrapFocus [cdkTrapFocusAutoCapture]=\"true\">\n    <form (ngSubmit)=\"onSubmit()\">\n        <mat-form-field appearance=\"fill\" class=\"w-full\">\n            <mat-label>{{ 'COMPONENTS.CONFIRM.NAME' | translate: {Default: 'Name'} }}</mat-label>\n            <input cdkFocusInitial matInput name=\"value\" [(ngModel)]=\"value\" />\n        </mat-form-field>\n    </form>\n</mat-dialog-content>\n\n<mat-dialog-actions >\n    <button mat-button (click)=\"reset()\">\n        {{ 'COMPONENTS.COMMON.RESET' | translate: {Default: 'Reset'} }}\n    </button>\n\n    <div ngmButtonGroup class=\"ml-8\">\n        <button mat-flat-button mat-dialog-close>\n            {{ 'COMPONENTS.COMMON.CANCEL' | translate: {Default: 'Cancel'} }}\n        </button>\n        <button mat-raised-button color=\"accent\" cdkFocusInitial [mat-dialog-close]=\"value\">\n            {{ 'COMPONENTS.COMMON.APPLY' | translate: {Default: 'Apply'} }}\n        </button>\n    </div>\n</mat-dialog-actions>\n" }]
        }], propDecorators: { isDialogContainer: [{
                type: HostBinding,
                args: ['class.ngm-dialog-container']
            }] } });
//# sourceMappingURL=data:application/json;base64, 