src/app/core/entity/default-datatype/view.directive.ts

Index

Properties
Inputs

Inputs

config
Type : C
Default value : undefined
entity
Type : Entity
formFieldConfig
Type : FormFieldConfig
id
Type : string
tooltip
Type : string
value
Type : T

Properties

Readonly config
Type : unknown
Default value : computed<C>(() => { const ffc = this.formFieldConfig(); return ffc !== undefined ? (ffc.additional as C) : this._directConfig(); })
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 ); })
import { computed, Directive, input } from "@angular/core";
import { FormFieldConfig } from "../../common-components/entity-form/FormConfig";
import { Entity } from "../model/entity";

@Directive()
export abstract class ViewDirective<T, C = any> {
  entity = input<Entity>();
  id = input<string>();
  tooltip = input<string>();
  value = input<T>();

  formFieldConfig = input<FormFieldConfig>();
  // eslint-disable-next-line @angular-eslint/no-input-rename -- alias required: "config" is already the name of the computed that merges formFieldConfig.additional with the direct input
  readonly _directConfig = input<C>(undefined, { alias: "config" });

  readonly config = computed<C>(() => {
    const ffc = this.formFieldConfig();
    return ffc !== undefined ? (ffc.additional as C) : this._directConfig();
  });

  readonly isPartiallyAnonymized = computed<boolean>(() => {
    const entity = this.entity();
    const id = this.id();
    return (
      (entity?.anonymized &&
        entity?.getSchema()?.get(id)?.anonymize === "retain-anonymized") ??
      false
    );
  });
}

results matching ""

    No results matching ""