Home Manual Reference Source
import Component from 'pvbid-sdk/src/domain/Component.js'
public class | source

Component

Extends:

eventemitter3~EventEmitterAdvanceEventEmitterBidEntity → Component

Component Class

Constructor Summary

Public Constructor
public

constructor(componentData: object, bid: Bid)

Creates an instance of Component.

Member Summary

Public Members
public get
public set
public get
public get
public set
public get
public get
public

bid: Bid

Reference to the bid that the component belongs to.

public get
public get

Gets the component's group id.

public get
public get

The summed cost from the nested line items.

public set
public get

Cost per watt

public set
public get

Cost With Markup

public get

Cost With Tax

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

Gets the component's definition id.

public get

Gets the included status of the component.

public get
public get
public set
public get
public set
public get
public set
public get
public get
public get

Price Property

public set
public get

Price per watt

public set
public get
public get
public set
public get

The average tax percentage from the nested line items.

public set
public get

The summed taxable cost from the nested line items.

public get

Method Summary

Public Methods
public

assess()

Assess the component instance.

public

bind()

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

public

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(alwaysIncludeConfig: boolean): object

Exports component internal data structure.

public

getLineItems(includeSubComponents: boolean): array

Gets an array of nested line items.

public

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

public

Gets the component's parent component, if exists.

public

Gets the predicted value of the component by calculating the sum total of the predicted values for all line items

public

Gets an array of nested of subcomponents.

public

Get the value for the key in the component's properties object

public

getWeightedNormalValue(distributionIndex: *): T | null

For each line item, get all of its weightedNormalValues return the sum of all line item's weightedNormalValues at distributionIndex

public

Calculates the weighted normal value given a set of distribution ranges.

public

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

public

Determine if any of the components children have been overridden

public

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

public

Check whether a given value is predicted or not

public

removeLineItem(lineItemId: string | 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

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

Determine if the entity is in an assembly

public get

Gets the id of the bid entity.

public get

Gets the bid entity title.

public set

Sets the bid entity title.

public get

Gets the bid entity type.

public abstract

assess(dependency: BidEntity)

Assesses bid entity.

public

Gets an array of depndants that rely on the bid entity.

public

Gets all the dependencies that the bid entity relies on.

public

dirty()

Flags the bid entity as dirty and to be saved.

public

Exports the internal data for the bid entity.

public

Determines if bid entity relies on a null or undefined dependency value

public

async initSaveChangeLog(originalValue: *, newValue: *, valueType: *, entityProperty: *, metaData: *): *

public

Determines of bid entity is dirty.

public

Marks the bid entity as clean.

Public Constructors

public constructor(componentData: object, bid: Bid) source

Creates an instance of Component.

Override:

BidEntity#constructor

Params:

NameTypeAttributeDescription
componentData object

structured component data

bid Bid

The bid in which the component belongs to.

Public Members

public get actualCost: number source

public set actualCost: number source

public get actualCostConfidenceFactor: * source

public get actualHours: number source

public set actualHours: number source

public get actualHoursConfidenceFactor: * 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 get cost: number source

The summed cost from the nested line items.

public set cost: number source

public get costWatt: number source

Cost per watt

public set costWatt: number source

public get costWithMarkup: number source

Cost With Markup

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 isIncluded: boolean source

Gets the included status of the component. A component is included if it has included line items.

public get laborCost: number source

public get laborHours: number source

public set laborHours: number source

public get markup: number source

public set markup: number source

public get markupPercent: number source

public set 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 get taxableCost: number source

The summed taxable cost from the nested line items.

public get wageAvg: number source

Public Methods

public assess() source

Assess the component instance.

Override:

BidEntity#assess

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(alwaysIncludeConfig: boolean): object source

Exports component internal data structure.

Override:

BidEntity#exportData

Params:

NameTypeAttributeDescription
alwaysIncludeConfig boolean
  • optional
  • default: false

Will include config object in export regardless of changed status.

Return:

object

public getLineItems(includeSubComponents: boolean): array source

Gets an array of nested line items.

Params:

NameTypeAttributeDescription
includeSubComponents boolean
  • optional
  • default: false

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 getPredictedValue(): sum | null source

Gets the predicted value of the component by calculating the sum total of the predicted values for all line items

Return:

sum | null

public getSubComponents(): Component[] source

Gets an array of nested of subcomponents.

Return:

Component[]

public getVirtualPropertyValue(key: string): number source

Get the value for the key in the component's properties object

Params:

NameTypeAttributeDescription
key string

Return:

number

public getWeightedNormalValue(distributionIndex: *): T | null source

For each line item, get all of its weightedNormalValues return the sum of all line item's weightedNormalValues at distributionIndex

Params:

NameTypeAttributeDescription
distributionIndex *

Return:

T | null

weighted normal value

public getWeightedNormalValues(): array source

Calculates the weighted normal value given a set of distribution ranges.

Return:

array

Array of weighted normal values

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:

NameTypeAttributeDescription
value string

The property to check

Return:

boolean

public isOverridden(property: string): boolean source

Determine if any of the components children have been overridden

Params:

NameTypeAttributeDescription
property string
  • optional
  • default: null

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:

NameTypeAttributeDescription
value string

The value to check the prediction status of

Return:

boolean

public removeLineItem(lineItemId: string | number) source

Removes a line item from the component.

Params:

NameTypeAttributeDescription
lineItemId string | number

public reset() source

Resets all nested line items.

public setIncludeStatus(isIncluded: boolean) source

Sets the include status for all nested line items.

Params:

NameTypeAttributeDescription
isIncluded boolean