Skip to content

@jimka/typescript-ui / data / Field

Class: Field

Defined in: src/typescript/lib/data/Field.ts:36

Represents a single typed field in a model's schema. Encapsulates the field's name, type, default value, raw-data mapping, description, and display order.

Constructors

new Field()

ts
new Field(options: FieldOptions): Field

Defined in: src/typescript/lib/data/Field.ts:50

Constructs a Field from a FieldOptions object.

Parameters

options

FieldOptions

The options object describing the field's properties.

Returns

Field

Methods

getDefaultValue()

ts
getDefaultValue(): any

Defined in: src/typescript/lib/data/Field.ts:82

Returns the value used when raw data does not contain this field.

Returns

any

The configured default value, or undefined if none was specified.


getDescription()

ts
getDescription(): string

Defined in: src/typescript/lib/data/Field.ts:100

Returns the human-readable description, falling back to the field name.

Returns

string

The description string if configured, otherwise the field name.


getMapping()

ts
getMapping(): string

Defined in: src/typescript/lib/data/Field.ts:91

Returns the raw-data property name that maps to this field.

Returns

string

The mapping key string; defaults to the field name when not explicitly configured.


getName()

ts
getName(): string

Defined in: src/typescript/lib/data/Field.ts:64

Returns the field's logical name used as the record property key.

Returns

string

The logical name string for this field.


getOrder()

ts
getOrder(): number

Defined in: src/typescript/lib/data/Field.ts:109

Returns the display order index; -1 means unspecified.

Returns

number

The configured order value, or -1 if no order was specified.


getType()

ts
getType(): FieldType

Defined in: src/typescript/lib/data/Field.ts:73

Returns the field's data type.

Returns

FieldType

The FieldType value for this field.