src/app/core/admin/admin-entity-details/admin-entity-field/anonymize-options/anonymize-options.component.ts
Simple form field for admins to select the "anonymize" mode for an entity field. Displays tooltips as descriptions also.
| changeDetection | ChangeDetectionStrategy.OnPush |
| selector | app-anonymize-options |
| standalone | true |
| imports |
MatOptionModule
MatSelectModule
MatTooltipModule
|
| styleUrls | ./anonymize-options.component.scss |
| templateUrl | ./anonymize-options.component.html |
| styleUrl | ./anonymize-options.component.scss |
MatOptionModule
MatSelectModule
MatTooltipModule
Inputs |
Outputs |
| value | |
Type : string
|
|
Default value : ""
|
|
| valueChange | |
Type : string
|
|
import {
Component,
input,
output,
ChangeDetectionStrategy,
} from "@angular/core";
import { MatOptionModule } from "@angular/material/core";
import { MatSelectModule } from "@angular/material/select";
import { MatTooltipModule } from "@angular/material/tooltip";
/**
* Simple form field for admins to select the "anonymize" mode for an entity field.
* Displays tooltips as descriptions also.
*/
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: "app-anonymize-options",
imports: [MatOptionModule, MatSelectModule, MatTooltipModule],
templateUrl: "./anonymize-options.component.html",
styleUrl: "./anonymize-options.component.scss",
})
export class AnonymizeOptionsComponent {
value = input("", { transform: (v: string | undefined) => v ?? "" });
valueChange = output<string>();
}
<mat-form-field appearance="fill">
<mat-label>
<ng-content></ng-content>
</mat-label>
<mat-select [value]="value()" (valueChange)="valueChange.emit($event)">
<mat-option
value=""
matTooltip="Completely remove the value from the record during anonymization."
i18n-matTooltip
matTooltipPosition="before"
i18n
>Remove</mat-option
>
<mat-option
value="retain"
matTooltip="Keep the original value without any anonymization."
i18n-matTooltip
matTooltipPosition="before"
i18n
>Retain</mat-option
>
<mat-option
value="retain-anonymized"
matTooltip="Anonymize the value, but retain some generalized information. For dates, this removes the day and only keeps the year for statistical reporting. For text fields, this keeps only the first character (e.g. as an initial) and masks the rest. If a datatype does not support partial anonymization, the value will instead be removed completely."
i18n-matTooltip
matTooltipPosition="before"
i18n
>Partially Anonymize</mat-option
>
</mat-select>
</mat-form-field>
./anonymize-options.component.scss
mat-form-field {
width: 100%;
}