    import Field from 'pvbid-sdk/src/domain/Field.js'

public class | source

# Field

#### Extends:

eventemitter3~EventEmitter → AdvanceEventEmitter → BidEntity → Field

Field Class

## Constructor Summary

Public Constructor
public | constructor(fieldData: object, bid: Bid) Creates an instance of Field. |

## Member Summary

Public Members
public get | actualValue: string Returns the actual value of the field after the project has been completed and reviewed for reconciliation. |
public set | actualValue: string Sets the actual value for reconciliation. |
public get | anchor: string | null Returns the anchor identifier of the field |
public | bid: Bid Reference to the bid that the field belongs to. |
public get | config: object Gets the configuration information for the bid entity. |
public get | definitionId: number this get was deprecated. Definition ids will become obsolete in planned data structure upgrade. Gets the field's definition id. |
public get | fieldType: string Gets the field type. |
public get | isAutoSelected: boolean Determines if the current value is the result of being auto populated due to the field's ruleset. |
public get | value: string | number | boolean Gets value of the field. |
public set | value: string Sets the field value. |

## Method Summary

Public Methods
public | assess(dependency: BidEntity) Assess the field, determining if it should be auto populated. |
public | bind() Binds the "updated" event for all dependant bid entities. |
public | dependants(): BidEntity[] Gets all the bid entities that relay on the field instance. |
public | dependencies(): BidEntity[] Returns all the dependencies that the field relies on. |
public | dirty() Flags the field and corresponding bid as dirty and to be saved. |
public | exportData(): object Exports internal data |
public | getDatatable(): Datatable If the field has a fieldType of "list", getDatatable will return the datatable instance that it relies on, otherwise will return null. |
public | getListOptions(): object[] Gets a list of options bound to a datatable. |
public | getSelectedOption(): object Gets the selected list option. |
public | getSelectedOptionValue(datatableColumnId: string): string | number | boolean Gets the value of the selected field list based on the datatable column id. |
public | hasNullDependency(): * Determines if the field has any null or undefined dependencies |
public | isDirty(): boolean Determines if instance is dirty. |

## Inherited Summary

From class AdvanceEventEmitter
public | maxEvents: number Maximum number of events fired for the requester before events stop. |
public | on(eventName: string, requesterId: string, callback: function) |
public | onDelay(eventName: string, ms: number, requesterId: string, callback: function) |
public | removeListenerByRequester(eventName: string, requesterId: string) Removes event listeners by event and requesterId. |

From class BidEntity
public get | id: number Gets the id of the bid entity. |
public get | title: string Gets the bid entity title. |
public set | title: string Sets the bid entity title. |
public get | type: string Gets the bid entity type. |
public abstract | assess(dependency: BidEntity) Assesses bid entity. |
public | dependants(): BidEntity[] Gets an array of depndants that rely on the bid entity. |
public | dependencies(): BidEntity[] Gets all the dependencies that the bid entity relies on. |
public | dirty() Flags the bid entity as dirty and to be saved. |
public | exportData(): object Exports the internal data for the bid entity. |
public | hasNullDependency(field: string): boolean Determines if bid entity relies on a null or undefined dependency value |
public | isDirty(): boolean Determines of bid entity is dirty. |
public | pristine() Marks the bid entity as clean. |

## Public Constructors

### public constructor(fieldData: object, bid: Bid) source

Creates an instance of Field.

#### Override:

BidEntity#constructor

#### Params:

Name | Type | Attribute | Description
fieldData | object |  |
bid | Bid |  |

## Public Members

### public get actualValue: string source

Returns the actual value of the field after the project has been completed and reviewed for reconciliation.

### public set actualValue: string source

Sets the actual value for reconciliation. Marks field as dirty.

### public get anchor: string | null source

Returns the anchor identifier of the field

### public bid: Bid source

Reference to the bid that the field belongs to.

### public get config: object source

Gets the configuration information for the bid entity.

### public get definitionId: number source

this get was deprecated. Definition ids will become obsolete in planned data structure upgrade.

Gets the field's definition id.

### public get fieldType: string source

Gets the field type. Options: text, boolean, number, list

### public get isAutoSelected: boolean source

Determines if the current value is the result of being auto populated due to the field's ruleset.

### public get value: string | number | boolean source

Gets value of the field. If the field is of a list type, will return the associated datatable row id.

### public set value: string source

Sets the field value. Marks field as dirty

#### Emit:

updated

## Public Methods

### public assess(dependency: BidEntity) source

Assess the field, determining if it should be auto populated.

#### Override:

BidEntity#assess

#### Params:

Name | Type | Attribute | Description

dependency

BidEntity

- nullable: true

The calling dependency.

#### Emit:

assessing | Fires event before assessment.
assessed | Fires event after assessment.
updated | Fires event if the field has been changed during assessment.

### public bind() source

Binds the "updated" event for all dependant bid entities.

### public dependants(): BidEntity[] source

Gets all the bid entities that relay on the field instance.

#### Override:

BidEntity#dependants

#### Return:

BidEntity[]

### public dependencies(): BidEntity[] source

Returns all the dependencies that the field relies on.

#### Override:

BidEntity#dependencies

#### Return:

BidEntity[]

### public dirty() source

Flags the field and corresponding bid as dirty and to be saved.

#### Override:

BidEntity#dirty

### public exportData(): object source

Exports internal data

#### Override:

BidEntity#exportData

#### Return:

object

### public getDatatable(): Datatable source

If the field has a fieldType of "list", getDatatable will return the datatable instance that it relies on, otherwise will return null.

#### Return:

Datatable (nullable: true)

### public getListOptions(): object[] source

Gets a list of options bound to a datatable.

#### Return:

object[]

#### Return Properties:

Name | Type | Attribute | Description
title | string |  |
row_id | string |  | The id of a datatable row. This value should to be applied to the Field.value to selelect specific row.

### public getSelectedOption(): object source

Gets the selected list option.

#### Return:

object

#### Return Properties:

Name | Type | Attribute | Description
title | string |  |
row_id | string |  | The id of a datatable row.

### public getSelectedOptionValue(datatableColumnId: string): string | number | boolean source

Gets the value of the selected field list based on the datatable column id.

#### Params:

Name | Type | Attribute | Description
datatableColumnId | string |  |

#### Return:

string | number | boolean (nullable: true)

### public hasNullDependency(): * source

Determines if the field has any null or undefined dependencies

#### Override:

BidEntity#hasNullDependency

#### Return:

*

### public isDirty(): boolean source

Determines if instance is dirty.

#### Override:

BidEntity#isDirty

#### Return:

boolean