{"version":3,"file":"codefoxui-inputtext.dialog.component-c12c80d5.mjs","sources":["../../../projects/codefoxui/src/lib/shared/components/inputtext.dialog.component.ts"],"sourcesContent":["import { AfterViewInit, ChangeDetectorRef, Component, inject, OnInit, ViewChild } from \"@angular/core\";\r\nimport { InputTextComponent } from \"../../features\";\r\nimport { CfDialog } from \"../classes\";\r\nimport { ButtonDirective } from \"../directives\";\r\nimport { FormControl, ReactiveFormsModule } from \"@angular/forms\";\r\nimport { takeUntilDestroyed } from \"@angular/core/rxjs-interop\";\r\nimport { NgIf } from \"@angular/common\";\r\nimport { CfSafeHtmlPipe, TranslationPipe } from \"../pipes\";\r\nimport { TranslationsService } from \"../services\";\r\nimport { INPUT_TEXT_DIALOG_EN, INPUT_TEXT_DIALOG_HU } from \"../consts/translations\";\r\n\r\n@Component({\r\n    standalone: true,\r\n    template: `\r\n        <div class=\"cf-dialog-title\">{{title}}</div>\r\n        <p *ngIf=\"description !== null\" [innerHTML]=\"description|cfsafehtml\"></p>\r\n        <div class=\"cf-grid cf-cols-12\">\r\n            <cf-inputtext #input [label]=\"inputLabel\" [formControl]=\"formControl\" class=\"cf-col-12\"></cf-inputtext>\r\n        </div>\r\n        <div class=\"cf-flex cf-flex-spacer-2 cf-flex-right\">\r\n            <button cfButton [severity]=\"'success'\" [disabled]=\"!formControl.valid\" [label]=\"saveButtonLabel|translation\" (click)=\"save()\"></button>\r\n            <button cfButton [severity]=\"'danger'\" [label]=\"closeButtonLabel|translation\" (click)=\"close()\"></button>\r\n        </div>\r\n    `,\r\n    imports: [\r\n        InputTextComponent,\r\n        ButtonDirective,\r\n        ReactiveFormsModule,\r\n        NgIf,\r\n        CfSafeHtmlPipe,\r\n        TranslationPipe\r\n    ]\r\n})\r\nexport class InputTextDialogComponent extends CfDialog implements OnInit, AfterViewInit {\r\n\r\n    cdr: ChangeDetectorRef = inject(ChangeDetectorRef);\r\n    translationsService: TranslationsService = inject(TranslationsService);\r\n\r\n    title: string = this.config.getData('title', '');\r\n    saveButtonLabel: string = this.config.getData('saveButtonLabel', 'inputtextdialog.save');\r\n    closeButtonLabel: string = this.config.getData('closeButtonLabel', 'inputtextdialog.cancel');\r\n    description: string | null = this.config.getData('description', null);\r\n    inputLabel: string = this.config.getData('inputLabel', '');\r\n    formControl: FormControl<string> = this.config.getData('formControl', new FormControl(''));\r\n\r\n    @ViewChild('input') input: InputTextComponent | undefined = undefined;\r\n\r\n    save(): void {\r\n        this.ref.close(this.formControl.value);\r\n    }\r\n\r\n    ngAfterViewInit(): void {\r\n        if (this.input !== undefined) {\r\n            this.input.focus();\r\n        }\r\n    }\r\n\r\n    ngOnInit(): void {\r\n        this.cdr.detectChanges();\r\n    }\r\n\r\n    constructor() {\r\n        super();\r\n\r\n        this.formControl.valueChanges.pipe(takeUntilDestroyed()).subscribe(() => {\r\n            this.cdr.detectChanges();\r\n        });\r\n\r\n\t\tthis.translationsService.initModuleTranslation('inputtextdialog', 'hu', INPUT_TEXT_DIALOG_HU);\r\n\t\tthis.translationsService.initModuleTranslation('inputtextdialog', 'en-us', INPUT_TEXT_DIALOG_EN);\r\n\r\n        this.cdr.detach();\r\n    }\r\n\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAiCM,MAAO,wBAAyB,SAAQ,QAAQ,CAAA;IAclD,IAAI,GAAA;QACA,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;KAC1C;IAED,eAAe,GAAA;AACX,QAAA,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE;AAC1B,YAAA,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;AACtB,SAAA;KACJ;IAED,QAAQ,GAAA;AACJ,QAAA,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;KAC5B;AAED,IAAA,WAAA,GAAA;AACI,QAAA,KAAK,EAAE,CAAC;AA3BZ,QAAA,IAAA,CAAA,GAAG,GAAsB,MAAM,CAAC,iBAA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