File

src/app/core/basic-datatypes/string/long-text.datatype.ts

Description

Datatype for multi-line string fields.

Extends

StringDatatype

Index

Properties
Methods

Methods

Async anonymize
anonymize(value: string, schemaField: EntitySchemaField, parent: any)
Inherited from DefaultDatatype
Defined in DefaultDatatype:53
Parameters :
Name Type Optional
value string No
schemaField EntitySchemaField No
parent any No
Returns : Promise<string>
transformToDatabaseFormat
transformToDatabaseFormat(value: unknown)
Inherited from DefaultDatatype
Defined in DefaultDatatype:39
Parameters :
Name Type Optional
value unknown No
Returns : any
transformToObjectFormat
transformToObjectFormat(value: unknown)
Inherited from DefaultDatatype
Defined in DefaultDatatype:46
Parameters :
Name Type Optional
value unknown No
Returns : any
Static detectAllFieldsInEntity
detectAllFieldsInEntity(entityOrType: Entity | EntityConstructor, dataTypes: string | string[])
Inherited from DefaultDatatype
Defined in DefaultDatatype:99

Detect all fields of the given datatype(s) in an entity's schema.

Parameters :
Name Type Optional Description
entityOrType Entity | EntityConstructor No

An entity instance or entity constructor to inspect.

dataTypes string | string[] No

One or more datatype identifiers to match against.

Returns : literal type[]

Array of matching fields with their id and schema definition.

Static detectFieldInEntity
detectFieldInEntity(entityOrType: Entity | EntityConstructor, dataTypes: string | string[])
Inherited from DefaultDatatype
Defined in DefaultDatatype:84

Detect the first field of the given datatype(s) in an entity's schema.

Scans the schema for a field whose dataType matches one of the provided strings and returns its property name.

Subclasses typically override this without the extra dataTypes parameter, forwarding their own relevant datatype identifiers.

Parameters :
Name Type Optional Description
entityOrType Entity | EntityConstructor No

An entity instance or entity constructor to inspect.

dataTypes string | string[] No

One or more datatype identifiers to match against.

Returns : string | undefined

The field name of the first matching field, or undefined if none is found.

getExportColumns
getExportColumns(schemaField: EntitySchemaField)
Inherited from DefaultDatatype

Export columns for a field using this datatype.

Each returned column contributes a CSV header and its own value resolver. The returned keySuffix is appended to the field id to form the exported column key.

The default implementation returns a single column with the raw field value. Readable formatting can be applied by callers during CSV transformation. Override this to provide custom or additional columns (e.g. entity references can add a human-readable name column alongside the ID column).

Parameters :
Name Type Optional
schemaField EntitySchemaField No
Returns : ExportColumnMapping[]
importIncompleteAdditionalConfigBadge
importIncompleteAdditionalConfigBadge(col: ColumnMapping)
Inherited from DefaultDatatype

Output a label indicating whether the given column mapping needs user configuration for the "additional" config or has a valid, complete "additional" config. returns "undefined" if no user action is required.

Parameters :
Name Type Optional
col ColumnMapping No
Returns : string
Async importMapFunction
importMapFunction(val: any, schemaField: EntitySchemaField, additional?: any, importProcessingContext?: any)
Inherited from DefaultDatatype

The function used to map values from the import data to values in the entities to be created. to share information across processing of multiple columns and rows.

Parameters :
Name Type Optional Description
val any No

The value from an imported cell to be mapped

schemaField EntitySchemaField No

The schema field definition for the target property into which the value is mapped

additional any Yes

config as returned by the configComponent

importProcessingContext any Yes

an object that the datatype can use to store any relevant context across multiple calls to share information across processing of multiple columns and rows.

normalizeSchemaField
normalizeSchemaField(schemaField: EntitySchemaField)
Inherited from DefaultDatatype

Return the (potentially adjusted) schema field for this datatype.

Called when schema fields are set up (e.g. from config), allowing the datatype to normalize or fill in required settings.

Override this in a subclass to enforce constraints (e.g. always setting isArray: true).

Parameters :
Name Type Optional Description
schemaField EntitySchemaField No

The current schema field definition

Returns : EntitySchemaField

The schema field to use (default: unchanged)

Properties

Static dataType
Type : string
Default value : "long-text"
Inherited from DefaultDatatype
Defined in DefaultDatatype:9
editComponent
Type : string
Default value : "EditLongText"
Inherited from DefaultDatatype
Defined in DefaultDatatype:13
Static label
Type : string
Default value : $localize`:datatype-label:text (long)`
Inherited from DefaultDatatype
Defined in DefaultDatatype:10
viewComponent
Type : string
Default value : "DisplayLongText"
Inherited from DefaultDatatype
Defined in DefaultDatatype:12
Readonly importAllowsMultiMapping
Type : boolean
Default value : false
Inherited from DefaultDatatype

Whether this datatype allows multiple values to be mapped to the same entity field during import.

Optional importConfigComponent
Type : string
Inherited from DefaultDatatype

A component to be display as a dialog to configure the transformation function (e.g. defining a format or mapping)

import { Injectable } from "@angular/core";
import { StringDatatype } from "./string.datatype";

/**
 * Datatype for multi-line string fields.
 */
@Injectable()
export class LongTextDatatype extends StringDatatype {
  static override dataType = "long-text";
  static override label: string = $localize`:datatype-label:text (long)`;

  override viewComponent = "DisplayLongText";
  override editComponent = "EditLongText";
}

results matching ""

    No results matching ""