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

public class | source

# Component

#### Extends:

eventemitter3~EventEmitter → AdvanceEventEmitter → BidEntity → Component

Component Class

## Constructor Summary

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

## Member Summary

Public Members
public set | actualCost: number |
public get | actualCost: number |
public get | actualHours: number |
public set | actualHours: number |
public get | baseAvg: number |
public | bid: Bid Reference to the bid that the component belongs to. |
public get | burdenAvg: number |
public get | componentGroupId: number Gets the component's group id. |
public get | config: object |
public set | cost: number |
public get | cost: number The summed cost from the nested line items. |
public set | costWatt: number |
public get | costWatt: number Cost per watt |
public get | costWithTax: number Cost With Tax |
public get | definitionId: number this get was deprecated. Definition ids will become obsolete in planned data structure upgrade. Gets the component's definition id. |
public get | laborCost: number |
public set | laborHours: number |
public get | laborHours: number |
public get | markup: number |
public set | markup: number |
public set | markupPercent: number |
public get | markupPercent: number |
public get | nonLaborCost: number |
public get | perQuantityAvg: number |
public get | price: number Price Property |
public set | price: number |
public get | priceWatt: number Price per watt |
public set | priceWatt: number |
public get | quantityAvg: number |
public get | tax: number |
public set | tax: number |
public get | taxPercent: number The average tax percentage from the nested line items. |
public set | taxPercent: number |
public set | taxableCost: number Overrides taxable cost by proportionally distributing the component value to the included nested line items. |
public get | taxableCost: number The summed taxable cost from the nested line items. |
public get | wageAvg: number |

## Method Summary

Public Methods
public | assess(dependency: BidEntity) Assess the component instance. |
public | bind() Binds the "updated" event for all dependant bid entities. |
public | dependants(): BidEntity[] Gets a list of bid entities that relies on the component instance. |
public | dirty() Flags the component and corresponding bid as dirty and to be saved. |
public | exportData(): object Exports component internal data structure. |
public | getLineItems(includeSubComponents: boolean): array Gets an array of nested line items. |
public | getNestedLevel(): number Gets the level at which the component is nested: 0, 1, 2. |
public | getParent(): Component Gets the component's parent component, if exists. |
public | getSubComponents(): Component[] Gets an array of nested of subcomponents. |
public | hasNullDependency(value: string): boolean Checks if a component property relied on a null dependency at any point in calculation |
public | isParent(): boolean Determines of component is a top parent component, in which is not nested. |
public | isPredicted(value: string): boolean Check whether a given value is predicted or not |
public | removeLineItem(lineItemId: number) Removes a line item from the component. |
public | reset() Resets all nested line items. |
public | setIncludeStatus(isIncluded: boolean) Sets the include status for all nested line items. |

## 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(componentData: object, bid: Bid) source

Creates an instance of Component.

#### Override:

BidEntity#constructor

#### Params:

Name | Type | Attribute | Description
componentData | object |  | structured component data
bid | Bid |  | The bid in which the component belongs to.

## Public Members

### public set actualCost: number source

### public get actualCost: number source

### public get actualHours: number source

### public set actualHours: number source

### public get baseAvg: number source

### public bid: Bid source

Reference to the bid that the component belongs to.

### public get burdenAvg: number source

### public get componentGroupId: number source

Gets the component's group id.

### public get config: object source

### public set cost: number source

### public get cost: number source

The summed cost from the nested line items.

### public set costWatt: number source

### public get costWatt: number source

Cost per watt

### public get costWithTax: number source

Cost With Tax

### public get definitionId: number source

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

Gets the component's definition id.

### public get laborCost: number source

### public set laborHours: number source

### public get laborHours: number source

### public get markup: number source

### public set markup: number source

### public set markupPercent: number source

### public get markupPercent: number source

### public get nonLaborCost: number source

### public get perQuantityAvg: number source

### public get price: number source

Price Property

### public set price: number source

### public get priceWatt: number source

Price per watt

### public set priceWatt: number source

### public get quantityAvg: number source

### public get tax: number source

### public set tax: number source

### public get taxPercent: number source

The average tax percentage from the nested line items.

### public set taxPercent: number source

### public set taxableCost: number source

Overrides taxable cost by proportionally distributing the component value to the included nested line items.

### public get taxableCost: number source

The summed taxable cost from the nested line items.

### public get wageAvg: number source

## Public Methods

### public assess(dependency: BidEntity) source

Assess the component instance.

#### Override:

BidEntity#assess

#### Params:

Name | Type | Attribute | Description

dependency

BidEntity

- nullable: true

The calling dependency.

#### Emit:

assessing
assessed
updated

### public bind() source

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

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

Gets a list of bid entities that relies on the component instance.

#### Override:

BidEntity#dependants

#### Return:

BidEntity[]

### public dirty() source

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

#### Override:

BidEntity#dirty

### public exportData(): object source

Exports component internal data structure.

#### Override:

BidEntity#exportData

#### Return:

object

### public getLineItems(includeSubComponents: boolean): array source

Gets an array of nested line items.

#### Params:

Name | Type | Attribute | Description
includeSubComponents | boolean |  |

#### Return:

array | Returns an array of line items in component.

### public getNestedLevel(): number source

Gets the level at which the component is nested: 0, 1, 2.

#### Return:

number

### public getParent(): Component source

Gets the component's parent component, if exists.

#### Return:

Component (nullable: true)

### public getSubComponents(): Component[] source

Gets an array of nested of subcomponents.

#### Return:

Component[]

### public hasNullDependency(value: string): boolean source

Checks if a component property relied on a null dependency at any point in calculation

#### Override:

BidEntity#hasNullDependency

#### Params:

Name | Type | Attribute | Description
value | string |  | The property to check

#### Return:

boolean

### public isParent(): boolean source

Determines of component is a top parent component, in which is not nested.

#### Return:

boolean

### public isPredicted(value: string): boolean source

Check whether a given value is predicted or not

#### Params:

Name | Type | Attribute | Description
value | string |  | The value to check the prediction status of

#### Return:

boolean

### public removeLineItem(lineItemId: number) source

Removes a line item from the component.

#### Params:

Name | Type | Attribute | Description
lineItemId | number |  |

### public reset() source

Resets all nested line items.

### public setIncludeStatus(isIncluded: boolean) source

Sets the include status for all nested line items.

#### Params:

Name | Type | Attribute | Description
isIncluded | boolean |  |