src/app/core/common-components/entity-form/FormConfig.ts

Description

The general configuration for fields in tables and forms. This defines which property is displayed and how it should be displayed.

You can just provide the id as string or overwrite any EntitySchemaField property here as necessary.

Extends

EntitySchemaField

Relationships

Used by

No results matching.

Depends on

Index

Properties

Properties

forTable
forTable: boolean
Type : boolean
Optional

An internal flag that will be automatically set in the entity subrecord in order to adapt the view/edit components.

hideFromForm
hideFromForm: boolean
Type : boolean
Optional

If true, the field will only be shown in tables and excluded from forms and popups. You can also use this to include a hidden form in a Public Form.

The form field is still generated but hidden in the UI, so default values can be applied to such hidden fields.

hideFromTable
hideFromTable: boolean
Type : boolean
Optional

If true, the field will only be shown in forms and popups, but not in tables.

id
id: string
Type : string

The id of the entity which should be accessed

noSorting
noSorting: boolean
Type : boolean
Optional

When set to true, the sorting of this column will be disabled. Should be used when the sorting will not work correctly/does not make sense. E.g. when displaying a list of entities

visibleFrom
visibleFrom: "xs" | "sm" | "md" | "lg" | "xl"
Type : "xs" | "sm" | "md" | "lg" | "xl"
Optional

visibleFrom The minimal screen size where the column is shown. screen size classes: xs 'screen and (max-width: 599px)' sm 'screen and (min-width: 600px) and (max-width: 959px)' md 'screen and (min-width: 960px) and (max-width: 1279px)' lg 'screen and (min-width: 1280px) and (max-width: 1919px)' xl 'screen and (min-width: 1920px) and (max-width: 5000px)'

additional
additional: any
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.

anonymize
anonymize: "retain" | "retain-anonymized"
Type : "retain" | "retain-anonymized"
Optional

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.

dataType
dataType: string
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: DefaultValueConfig
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: string
Type : string
Optional

A further description of the property which can be displayed in tooltips.

displayFullLengthLabel
displayFullLengthLabel: boolean
Type : boolean
Optional

If set to true, the full length label should be displayed (even if it spans multiple lines).

displayFullLengthOptionLabel
displayFullLengthOptionLabel: boolean
Type : boolean
Optional

If set to true, dropdown options should show full labels in the expanded list (wrapping to multiple lines instead of truncating with ellipsis).

editComponent
editComponent: string
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 DynamicComponent decorator If nothing is defined, the default component for this datatype will be used.

entityReferenceRole
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 EntityReferenceRole type

generateIndex
generateIndex: boolean
Type : boolean
Optional

Set to true to make the framework automatically create an index to retrieve/filter Entities quickly based on this field

not implemented yet

isArray
isArray: boolean
Type : boolean
Optional

If the dataType can hold multiple values, as an array of the given dataType.

isInternalField
isInternalField: boolean
Type : boolean
Optional

If true, this field is an internal system field (e.g., _id, _rev, created, updated) that should not be shown in the admin form builder or saved to config.

label
label: string
Type : string
Optional

A label which explains this value in a human-readable way

labelShort
labelShort: string
Type : string
Optional

A short label which can be used in tables. If nothing is specified, the long name will be used.

searchable
searchable: boolean
Type : boolean
Optional

If set to true, the entity can be found in the global search by entering this value

showInDetailsView
showInDetailsView: boolean
Type : boolean
Optional

whether to show this field in the default details view

trim
trim: boolean
Type : boolean
Optional

If set to false, leading/trailing whitespace will NOT be automatically trimmed when saving this field. Defaults to true (trimming enabled) for string fields.

validators
validators: FormValidatorConfig
Type : FormValidatorConfig
Optional
viewComponent
viewComponent: string
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 DynamicComponent decorator If nothing is defined, the default component for this datatype will be used.

import { EntitySchemaField } from "../../entity/schema/entity-schema-field";

/**
 * The general configuration for fields in tables and forms.
 * This defines which property is displayed and how it should be displayed.
 *
 * You can just provide the id as string or overwrite any EntitySchemaField property here as necessary.
 */
export interface FormFieldConfig extends EntitySchemaField {
  /**
   * The id of the entity which should be accessed
   */
  id: string;

  /**
   * When set to true, the sorting of this column will be disabled.
   * Should be used when the sorting will not work correctly/does not make sense.
   * E.g. when displaying a list of entities
   */
  noSorting?: boolean;

  /**
   * visibleFrom The minimal screen size where the column is shown.
   *           screen size classes: xs  'screen and (max-width: 599px)'
   *           sm  'screen and (min-width: 600px) and (max-width: 959px)'
   *           md  'screen and (min-width: 960px) and (max-width: 1279px)'
   *           lg  'screen and (min-width: 1280px) and (max-width: 1919px)'
   *           xl  'screen and (min-width: 1920px) and (max-width: 5000px)'
   */
  visibleFrom?: "xs" | "sm" | "md" | "lg" | "xl";

  /**
   * If true, the field will only be shown in forms and popups, but not in tables.
   */
  hideFromTable?: boolean;

  /**
   * If true, the field will only be shown in tables and excluded from forms and popups.
   * You can also use this to include a hidden form in a Public Form.
   *
   * The form field is still generated but hidden in the UI,
   * so default values can be applied to such hidden fields.
   */
  hideFromForm?: boolean;

  /**
   * An internal flag that will be automatically set in the entity subrecord in order to adapt the view/edit components.
   */
  forTable?: boolean;
}

/**
 * Type for the definition of a single column in the EntitySubrecord
 */
export type ColumnConfig = string | FormFieldConfig;

export function toFormFieldConfig(column: ColumnConfig): FormFieldConfig {
  if (typeof column === "string") {
    return { id: column };
  } else {
    return column;
  }
}

results matching ""

    No results matching ""