File

src/lib/shared/classes/dataItems.class.ts

Description

DataItemClass necessary to check:

  • if a string value is contained in all the string attributes of a data item
  • if a data item is a duplicate
  • to create the notes from a data item
  • to get a property from a data item
  • to format a date to MM/DD/YYYY
  • to check if a date is invalid

Index

Methods

Methods

createNotesFromDataItem
createNotesFromDataItem(dataItem: any, iconAttributes: IIconInput[])

This method is used to create the notes from a data item.

Parameters :
Name Type Optional Description
dataItem any No

The data item to create the notes from.

iconAttributes IIconInput[] No

The icon attributes to create the notes from.

Returns : INoteBoxItem[]
formatDate
formatDate(date: any)

Format a date to MM/DD/YYYY from DD.MM.YYYY.

Parameters :
Name Type Optional Description
date any No

The date to format.

Returns : any
getElemFromDataItemDisplayed
getElemFromDataItemDisplayed(specificDataItem: object, label: string)

This method is used to get a property from a data item.

Parameters :
Name Type Optional Description
specificDataItem object No

The data item to get the property from.

label string No

The label of the property to get.

Returns : string
getElemFromDataItemValue
getElemFromDataItemValue(specificDataItem: any, label: string)

Auxiliary method to get the value of a property from a data item. Returns null, Number, Date or string values.

Parameters :
Name Type Optional Description
specificDataItem any No

The data item to get the property from.

label string No

The label of the property to get.

Returns : any
getLabelFromAttributes
getLabelFromAttributes(attributesItems: IAttributeItemInput[], identifier: string)

Auxiliary method to get the label from the attributes.

Parameters :
Name Type Optional Description
attributesItems IAttributeItemInput[] No

The attributes items to get the label from.

identifier string No

The identifier of the attribute to get the label from.

Returns : string
getProp
getProp(object: any, keys: string[])

This method is used to get a property from a data item.

Example :
const dataItem = {
  name: 'John',
  address: {
    city: 'New York',
    zip: '10001'
  }
};
const city = this.getProp(dataItem, ['address', 'city']); // 'New York'
Parameters :
Name Type Optional Description
object any No

The object to get the property from.

keys string[] No

The keys of the property to get.

Returns : any
isDateInvalid
isDateInvalid(dateString: string)

Check if a date is invalid.

Parameters :
Name Type Optional Description
dateString string No

The date to check.

Returns : any
setElemFromDataItemValue
setElemFromDataItemValue(specificDataItem: any, label: string, value: any)

This method is used to set a property from a data item.

Parameters :
Name Type Optional Description
specificDataItem any No

The data item to set the property from.

label string No

The label of the property to set.

value any No

The value to set.

Returns : void
setProp
setProp(object: any, keys: string[], value: any)

This method is used to set a property from a data item.

Parameters :
Name Type Optional
object any No
keys string[] No
value any No
Returns : void
Static startBeforeEnd
startBeforeEnd(startId: string, endId: string, allowSame: boolean)
Parameters :
Name Type Optional Default value
startId string No
endId string No
allowSame boolean No false
Returns : ValidatorFn

results matching ""

    No results matching ""