src/app/core/entity/schema/entity-schema-field.ts
Interface for additional configuration about a DatabaseField schema.
This is used as parameter for the DatabaseField annotation:
@DatabaseField(fieldConfig: EntitySchemaField)
Properties |
|
additional |
additional:
|
Type : any
|
Optional |
(Optional) Assign any custom "extension" configuration you need for a specific datatype extension. You can pass any kind of value here to allow complex custom datatype transformations that are not part of the core datatypes and therefore not included in this core interface. |
dataType |
dataType:
|
Type : string
|
Optional |
The datatype of this field. This will trigger to matching datatype transformer when saving/loading the entity. If you don't set this explicitly, the dataType is inferred from the TypeScript type of the property that is annotated. |
defaultValue |
defaultValue:
|
Type : DefaultValueConfig
|
Optional |
Configure the default value mode of this field. Default values are applied to form fields, if field is empty The form will be disabled, until all default value configs are applied |
description |
description:
|
Type : string
|
Optional |
A further description of the property which can be displayed in tooltips. |
editComponent |
editComponent:
|
Type : string
|
Optional |
(Optional) Define using which component this property should be editable in lists and forms. The edit component has to be a registered component. Components that are registered contain the |
entityReferenceRole |
entityReferenceRole:
|
Type : EntityReferenceRole
|
Optional |
(Optional) If the dataType of this field references another entity, define the role of this relationship for the entity containing this field. i.e. how "important" is the entity this field is referencing? Does this the entity containing this field (not the referenced entity) still have meaning after the referenced entity has been deleted? see options of the |
generateIndex |
generateIndex:
|
Type : boolean
|
Optional |
Set to true to make the framework automatically create an index to retrieve/filter Entities quickly based on this field |
isArray |
isArray:
|
Type : boolean
|
Optional |
If the dataType can hold multiple values, as an array of the given dataType. |
label |
label:
|
Type : string
|
Optional |
A label which explains this value in a human-readable way |
labelShort |
labelShort:
|
Type : string
|
Optional |
A short label which can be used in tables. If nothing is specified, the long name will be used. |
searchable |
searchable:
|
Type : boolean
|
Optional |
If set to |
showInDetailsView |
showInDetailsView:
|
Type : boolean
|
Optional |
whether to show this field in the default details view |
validators |
validators:
|
Type : FormValidatorConfig
|
Optional |
viewComponent |
viewComponent:
|
Type : string
|
Optional |
(Optional) Define using which component this property should be displayed in lists and forms. The edit component has to be a registered component. Components that are registered contain the |
import { FormValidatorConfig } from "../../common-components/entity-form/dynamic-form-validators/form-validator-config";
import { EntityReferenceRole } from "../../basic-datatypes/entity/entity-reference-role";
import { DefaultValueConfig } from "./default-value-config";
/**
* Interface for additional configuration about a DatabaseField schema.
*
* This is used as parameter for the DatabaseField annotation:
*
* `@DatabaseField(fieldConfig: EntitySchemaField)`
*/
export interface EntitySchemaField {
/**
* The datatype of this field. This will trigger to matching datatype transformer when saving/loading the entity.
*
* If you don't set this explicitly, the dataType is inferred from the TypeScript type of the property that is annotated.
*/
dataType?: string;
/**
* If the dataType can hold multiple values, as an array of the given dataType.
*/
isArray?: boolean;
/**
* Set to true to make the framework automatically create an index to retrieve/filter Entities quickly based on this field
*
* @todo not implemented yet
*/
generateIndex?: boolean;
/**
* If set to `true`, the entity can be found in the global search by entering this value
*/
searchable?: boolean;
/**
* Configure the default value mode of this field.
* Default values are applied to form fields, if field is empty
* The form will be disabled, until all default value configs are applied
*
*/
defaultValue?: DefaultValueConfig;
/**
* (Optional) Assign any custom "extension" configuration you need for a specific datatype extension.
*
* You can pass any kind of value here to allow complex custom datatype transformations
* that are not part of the core datatypes and therefore not included in this core interface.
*/
additional?: any;
/**
* (Optional) If the dataType of this field references another entity,
* define the role of this relationship for the entity containing this field.
*
* i.e. how "important" is the entity this field is referencing?
* Does this the entity containing this field (not the referenced entity) still have meaning after the referenced entity has been deleted?
*
* see options of the `EntityReferenceRole` type
*/
entityReferenceRole?: EntityReferenceRole;
// TODO: possibly remove viewComponent + editComponent from schema and only infer via dataType (or overwrite in FormFieldConfig)
/**
* (Optional) Define using which component this property should be displayed in lists and forms.
*
* The edit component has to be a registered component. Components that are registered contain the `DynamicComponent`
* decorator
* If nothing is defined, the default component for this datatype will be used.
*/
viewComponent?: string;
/**
* (Optional) Define using which component this property should be editable in lists and forms.
*
* The edit component has to be a registered component. Components that are registered contain the `DynamicComponent`
* decorator
* If nothing is defined, the default component for this datatype will be used.
*/
editComponent?: string;
/**
* A label which explains this value in a human-readable way
*/
label?: string;
/**
* A short label which can be used in tables.
* If nothing is specified, the long name will be used.
*/
labelShort?: string;
/**
* A further description of the property which can be displayed in tooltips.
*/
description?: string;
validators?: FormValidatorConfig;
/** whether to show this field in the default details view */
showInDetailsView?: boolean;
/**
* whether the field will be retained when the entity is "anonymized".
*
* By default, fields are removed (data minimization by default).
*
* "retain-anonymized" triggers a special dataType action to retain the data partially in a special, anonymized form.
*/
anonymize?: "retain" | "retain-anonymized";
}
/**
* Available placeholder variables that can be used to configure a dynamic default value.
* (e.g. "$now" to set to current date)
*/
export enum PLACEHOLDERS {
NOW = "$now",
CURRENT_USER = "$current_user",
}