src/app/features/template-export/template-export-file-datatype/edit-template-export-file.component.ts
An edit component that allows to manage template files stored in the PDF Generator API.
CustomFormControlDirective<string>
| changeDetection | ChangeDetectionStrategy.OnPush |
| providers |
TemplateExportApiService
EditTemplateExportFileComponent
|
| selector | app-template-export-file |
| standalone | true |
| imports | |
| styleUrls | ../../file/edit-file/edit-file.component.scss, |
| templateUrl | ./edit-template-export-file.component.html |
No results matching.
Properties |
|
Methods |
Inputs |
Outputs |
| entity | |
Type : Entity
|
|
| formFieldConfig | |
Type : FormFieldConfig
|
|
| aria-describedby | |
Type : string
|
|
|
Inherited from
CustomFormControlDirective
|
|
| disabled | |
Type : boolean
|
|
|
Inherited from
CustomFormControlDirective
|
|
| ngControl | |
Type : any
|
|
Default value : inject(NgControl, { optional: true, self: true })
|
|
|
Inherited from
CustomFormControlDirective
|
|
| placeholder | |
Type : string
|
|
|
Inherited from
CustomFormControlDirective
|
|
| required | |
Type : boolean
|
|
|
Inherited from
CustomFormControlDirective
|
|
| value | |
Type : T
|
|
|
Inherited from
CustomFormControlDirective
|
|
| valueChange | |
Type : EventEmitter
|
|
|
Inherited from
CustomFormControlDirective
|
|
| blur |
blur()
|
|
Inherited from
CustomFormControlDirective
|
|
Returns :
void
|
| focus |
focus()
|
|
Inherited from
CustomFormControlDirective
|
|
Returns :
void
|
| onContainerClick | ||||||
onContainerClick(event: MouseEvent)
|
||||||
|
Inherited from
CustomFormControlDirective
|
||||||
|
Parameters :
Returns :
void
|
| registerOnChange | ||||||
registerOnChange(fn: any)
|
||||||
|
Inherited from
CustomFormControlDirective
|
||||||
|
Parameters :
Returns :
void
|
| registerOnTouched | ||||||
registerOnTouched(fn: any)
|
||||||
|
Inherited from
CustomFormControlDirective
|
||||||
|
Parameters :
Returns :
void
|
| setDescribedByIds | ||||||
setDescribedByIds(ids: string[])
|
||||||
|
Inherited from
CustomFormControlDirective
|
||||||
|
Parameters :
Returns :
void
|
| setDisabledState | ||||||
setDisabledState(isDisabled: boolean)
|
||||||
|
Inherited from
CustomFormControlDirective
|
||||||
|
Parameters :
Returns :
void
|
| writeValue | |||||||||||||||
writeValue(value: T, notifyFormControl: unknown)
|
|||||||||||||||
|
Inherited from
CustomFormControlDirective
|
|||||||||||||||
|
Implementation for Angular ControlValueAccessor interface that links the form control value to the component value
Parameters :
Returns :
void
|
| exportServerEnabled |
Type : unknown
|
Default value : resource({
loader: () =>
this.templateExportService.isExportServerEnabled().catch(() => false),
})
|
| controlType |
Type : string
|
Default value : "custom-control"
|
|
Inherited from
CustomFormControlDirective
|
| elementRef |
Type : unknown
|
Default value : inject<ElementRef<HTMLElement>>(ElementRef)
|
|
Inherited from
CustomFormControlDirective
|
| Readonly enabled |
Type : Signal<boolean>
|
Default value : computed(() => !this._disabled())
|
|
Inherited from
CustomFormControlDirective
|
|
Whether the control is currently enabled, as a signal (tracks disabled). |
| errorStateMatcher |
Type : unknown
|
Default value : inject(ErrorStateMatcher)
|
|
Inherited from
CustomFormControlDirective
|
| id |
Type : unknown
|
Default value : `custom-form-control-${CustomFormControlDirective.nextId++}`
|
|
Inherited from
CustomFormControlDirective
|
| Static nextId |
Type : number
|
Default value : 0
|
|
Inherited from
CustomFormControlDirective
|
| onChange |
Type : unknown
|
Default value : () => {...}
|
|
Inherited from
CustomFormControlDirective
|
| onTouched |
Type : unknown
|
Default value : () => {...}
|
|
Inherited from
CustomFormControlDirective
|
| parentForm |
Type : unknown
|
Default value : inject(NgForm, { optional: true })
|
|
Inherited from
CustomFormControlDirective
|
| parentFormGroup |
Type : unknown
|
Default value : inject(FormGroupDirective, { optional: true })
|
|
Inherited from
CustomFormControlDirective
|
| stateChanges |
Type : unknown
|
Default value : new Subject<void>()
|
|
Inherited from
CustomFormControlDirective
|
| Readonly valueSignal |
Type : Signal<T>
|
Default value : computed(() => this._value())
|
|
Inherited from
CustomFormControlDirective
|
|
The current value of the control as a signal.
Authoritative in both modes: it reflects the bound |
import { CustomFormControlDirective } from "#src/app/core/common-components/basic-autocomplete/custom-form-control.directive";
import { FormFieldConfig } from "#src/app/core/common-components/entity-form/FormConfig";
import { EditComponent } from "#src/app/core/entity/entity-field-edit/dynamic-edit/edit-component.interface";
import { Entity } from "#src/app/core/entity/model/entity";
import { TemplateExportApiService } from "#src/app/features/template-export/template-export-api/template-export-api.service";
import {
Component,
ChangeDetectionStrategy,
inject,
input,
resource,
} from "@angular/core";
import { ReactiveFormsModule } from "@angular/forms";
import { MatFormFieldControl } from "@angular/material/form-field";
import { FeatureDisabledInfoComponent } from "../../../core/common-components/feature-disabled-info/feature-disabled-info.component";
import { DynamicComponent } from "../../../core/config/dynamic-components/dynamic-component.decorator";
import { EditFileComponent } from "../../file/edit-file/edit-file.component";
import { FileService } from "../../file/file.service";
import { TemplateExportService } from "../template-export-service/template-export.service";
/**
* An edit component that allows to manage template files stored in the PDF Generator API.
*/
@DynamicComponent("EditTemplateExportFile")
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: "app-template-export-file",
templateUrl: "./edit-template-export-file.component.html",
styleUrls: [
"../../file/edit-file/edit-file.component.scss",
"./edit-template-export-file.component.scss",
],
imports: [
EditFileComponent,
ReactiveFormsModule,
FeatureDisabledInfoComponent,
],
providers: [
{ provide: FileService, useClass: TemplateExportApiService },
{
provide: MatFormFieldControl,
useExisting: EditTemplateExportFileComponent,
},
],
})
export class EditTemplateExportFileComponent
extends CustomFormControlDirective<string>
implements EditComponent
{
private readonly templateExportService = inject(TemplateExportService);
entity = input<Entity>();
formFieldConfig = input<FormFieldConfig>();
exportServerEnabled = resource({
loader: () =>
this.templateExportService.isExportServerEnabled().catch(() => false),
});
}
@if (exportServerEnabled.value() !== true) {
<app-feature-disabled-info
[featureEnabled]="exportServerEnabled.value()"
[compactView]="true"
></app-feature-disabled-info>
}
<app-edit-file
[formControl]="formControl"
[entity]="entity()"
[formFieldConfig]="formFieldConfig()"
[style.display]="exportServerEnabled.value() ? 'initial' : 'none'"
></app-edit-file>
../../file/edit-file/edit-file.component.scss
/* let click events on disabled input be handled by parent element (because browsers completely eat them up otherwise)
https://stackoverflow.com/a/32925830/1473411 */
input[disabled] {
pointer-events: none;
}
.clickable,
.clickable * {
cursor: pointer;
}
.filename {
font-style: italic;
}
./edit-template-export-file.component.scss