Generator

new Generator(htmlContent)

Represents the logic of the genarate controller view
Parameters:
NameTypeDescription
htmlContentHTMLElementThe HTML template of the generator view
Example
const generator = new Generator(htmlTemplate);

Members

btnConverter :HTMLElement

Type:
  • HTMLElement

htmlContent :HTMLElement

Type:
  • HTMLElement

outputOption :HTMLElement

Type:
  • HTMLElement

outputPlace :HTMLElement

Type:
  • HTMLElement

Methods

convertJsonToCsv() → {void}

Convert the JSON text into an array of properties and items
Returns:
Type: 
void

copyIntoClipboard() → {void}

Copy into the clipboard the csv text result
Returns:
Type: 
void

init() → {void}

Init the Generator and add some lsiteners
Returns:
Type: 
void

renderCells(data) → {String}

Render the cells of the table of the csv information
Parameters:
NameTypeDescription
dataArray.<String>The data of each cell
Returns:
Each cell in a HTML div but all in one and single string
Type: 
String

renderOutput(properties, items) → {void}

Render the information input in the arrays into a csv format, it coould be in a table way or just the csv text format
Parameters:
NameTypeDescription
propertiesArray.<String>List of properties of the json file
itemsArray.<Array.<String>>List of the values of each item according to the properties list
Returns:
Type: 
void

renderRows(data) → {String}

Render the rows of the table of the csv information
Parameters:
NameTypeDescription
dataArray.<Array.<String>>The data of each row
Returns:
Each row in a HTML div but all in one and single string
Type: 
String

renderTable(headerData, contentData) → {HTMLElement}

Render the table of the csv information
Parameters:
NameTypeDescription
headerDataArray.<String>The array of teh properties
contentDataArray.<Array.<String>>The array of array of the items
Returns:
The table representation of the csv data
Type: 
HTMLElement