src/app/core/basic-datatypes/entity/display-entity/display-entity.component.ts
ViewDirective<
string[] | string,
string
>
| changeDetection | ChangeDetectionStrategy.OnPush |
| selector | app-display-entity |
| standalone | true |
| imports | |
| styleUrls | ./display-entity.component.scss |
| templateUrl | ./display-entity.component.html |
No results matching.
Properties |
|
Inputs |
| config | |
Type : C
|
|
Default value : undefined
|
|
|
Inherited from
ViewDirective
|
|
| entity | |
Type : Entity
|
|
|
Inherited from
ViewDirective
|
|
| formFieldConfig | |
Type : FormFieldConfig
|
|
|
Inherited from
ViewDirective
|
|
| id | |
Type : string
|
|
|
Inherited from
ViewDirective
|
|
| tooltip | |
Type : string
|
|
|
Inherited from
ViewDirective
|
|
| value | |
Type : T
|
|
|
Inherited from
ViewDirective
|
|
| Readonly aggregationThreshold |
Type : number
|
Default value : 5
|
| Readonly entityIds |
Type : unknown
|
Default value : computed(() =>
this.value() ? asArray(this.value()) : [],
)
|
| Readonly config |
Type : unknown
|
Default value : computed<C>(() => {
const ffc = this.formFieldConfig();
return ffc !== undefined ? (ffc.additional as C) : this._directConfig();
})
|
|
Inherited from
ViewDirective
|
| Readonly isPartiallyAnonymized |
Type : unknown
|
Default value : computed<boolean>(() => {
const entity = this.entity();
const id = this.id();
return (
(entity?.anonymized &&
entity?.getSchema()?.get(id)?.anonymize === "retain-anonymized") ??
false
);
})
|
|
Inherited from
ViewDirective
|
import { Component, computed, ChangeDetectionStrategy } from "@angular/core";
import { ViewDirective } from "#src/app/core/entity/default-datatype/view.directive";
import { DynamicComponent } from "../../../config/dynamic-components/dynamic-component.decorator";
import { EntityBlockComponent } from "../entity-block/entity-block.component";
import { asArray } from "app/utils/asArray";
@DynamicComponent("DisplayEntity")
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: "app-display-entity",
templateUrl: "./display-entity.component.html",
styleUrls: ["./display-entity.component.scss"],
imports: [EntityBlockComponent],
})
export class DisplayEntityComponent extends ViewDirective<
string[] | string,
string
> {
readonly aggregationThreshold = 5;
readonly entityIds = computed(() =>
this.value() ? asArray(this.value()) : [],
);
}
@if (entityIds()?.length < aggregationThreshold) {
<!-- Display each entity -->
@for (e of entityIds(); track e) {
<app-entity-block class="display-entity" [entityId]="e"></app-entity-block>
}
} @else {
<!-- Only display summary -->
<span i18n="Displaying the amount of involved entities|context 10 in total">
{{ entityIds()?.length }} in total
</span>
}
./display-entity.component.scss
@use "variables/sizes";
.display-entity {
display: inline-block;
margin-right: sizes.$small;
vertical-align: middle;
}