Helper, Utils for all Qrvey Projects
dist/format/format.js
isValidDateString(bytes)
Apply to the given date format to a date value
Parameters
Returns
formatFileSize(bytes)
Set convert Bytes into MB
Parameters
Returns
isValidTimeString([timeString])
It returns true if the given string is a valid time string, and false otherwise
Parameters
| timeString | string | - The time string to validate. | Optional |
Returns
formatTime(timeString, format)
It takes a time string and a format string and returns a formatted time string
Parameters
| timeString | any | - The time string to be formatted. | Â |
| format | string | - The format of the time string. | Â |
Returns
dist/tokens/getCleanCustomTokens.js
getCleanCustomTokens(customTokens)
The function getCleanCustomTokens takes an object customTokens and returns a new object
cleanTokens with filtered values based on certain conditions.
Parameters
| customTokens | ICustomTokensComplex | - The customTokens parameter is an object of type ICustomTokensComplex. | Â |
Returns
- a cleaned version of the customTokens object.
dist/tokens/getCustomTokenBoxParse.js
getCustomTokenBoxParse(customTokens)
The function getCustomTokenBoxParse takes in an object of custom tokens and returns a formatted
list of tokens with aliases and labels.
Parameters
| customTokens | ICustomTokensComplex | - The customTokens parameter is an object that contains custom token groups and their corresponding tokens. Each custom token group is represented by a key in the object, and the value is an array of tokens within that group. | Â |
Returns
- an object called
tokensList.
dist/tokens/getCustomtonTokens.js
getCustomtonTokens(customtonTokensConfig)
The function getCustomtonTokens takes a configuration object and returns a parsed version of the
custom tokens, with keys and values appropriately formatted.
Parameters
| customtonTokensConfig | ICustomTokensSimple ICustomTokensComplex | - The customtonTokensConfig parameter is an object that can have two possible types:
ICustomTokensSimple or ICustomTokensComplex. | Â |
Returns
- an object of type
ICustomTokensComplex.
dist/tokens/getCustomtonTokensWithKeys.js
getCustomtonTokensWithKeys(customTokens)
The function getCustomtonTokensWithKeys takes an array of CustomTokens objects and returns a new
array with each object having a key property that is the camelized version of either the key or
label property.
Parameters
| customTokens | Array.<CustomTokens> | - An array of objects representing custom tokens. Each object should have properties such as "key" and "label". | Â |
Returns
- an array of
CustomTokens objects. Each object in the array has an additional key property, which is generated by camelizing the key or label property of the original
CustomTokens object.
dist/tokens/isTokenLabel.js
isTokenLabel(label)
Get a text and evaluate if it matchs with a token box label.
Parameters
Returns
- True is label matchs; otherwise false
dist/charts/adapters/RequestAdapterMetric.js
getFilterLogic(filters)
If data is truthy, return data.logic, otherwise return an empty array.
Parameters
| filters | | - The data object that is passed to the component. | Â |
Returns
metricMakeValue(data)
It takes a data object and returns a MetricValue object
Parameters
| data | | - The data object that is passed to the component. | Â |
Returns
isComparison(data)
If data is truthy and data.dateColumn is truthy, return true, otherwise return false.
Parameters
| data | | - The data object that is passed to the component. | Â |
Returns
getConfigRelativeObjectBytimeLabel(timeLabel, range)
Given a time label and a custom range, return a relative date config or a metric custom range.
Parameters
| timeLabel | TIME_PERIOD | - TIME_PERIOD.CUSTOM_RANGE | Â |
| range | CustomRangeConfig | - CustomRangeConfig | Â |
Returns
- A relative date config or a metric custom range
makeCustomRangeConfig(customRangeData)
It takes in a custom range config object and returns a custom range object
Parameters
| customRangeData | CustomRangeConfig | - CustomRangeConfig | Â |
Returns
- A function that takes in a customRangeData object and returns a customRange object.
getRangeDataPeriod(metricData)
It takes in a metricData object and returns a CustomRangeConfig object
Parameters
| metricData | | - The metric data object that is returned from the API. | Â |
Returns
- An object with the following properties: startingDate: metricData?.timePeriodDate,
endDate: metricData?.timePeriodEndDate,
label: metricData?.timePeriodCustomRange?.label,
getRangeDataComparison(metricData)
It takes in a metricData object and returns a CustomRangeConfig object
Parameters
| metricData | | - The metric data object that is returned from the API. | Â |
Returns
- An object with the following properties: startingDate: metricData?.comparisonDate,
endDate: metricData?.comparisonEndDate,
label: metricData?.comparisonCustomRange?.label,
dist/filters/classes/FilterInputErrorHandler.js
new FilterInputErrorHandler()
Returns
dist/columns/helpers/getColumnsLabel.js
getColumnLabels(column)
[TODO: Finish the function]
Get an string of the properties of the given column.
Parameters
Returns
- an string with the property, aggregate or calculation label.
dist/columns/helpers/getDatasetColumn.js
getDatasetColumn(column, dataset, getIndex)
Gets the column from the dataset object
Recieves a partial column object and returns a full column object from the Dataset
Parameters
| column | IColumn | a partial column info | Â |
| dataset | IDataset | the dataset info to look for the column | Â |
| getIndex | boolean | flag to get the index of the column array or the complete column info | Â |
Returns
- the dataset column index or the dataset column object
isValidArguments(column, dataset)
Validates the arguments
Parameters
| column | IColumn | a partial column info | Â |
| dataset | IDataset | the dataset info | Â |
Returns
- true: the arguments are valid.
getDatasetColumns(dataset)
Gets the column array
Parameters
| dataset | IDataset | the dataset info | Â |
Returns
dist/columns/helpers/getModelColumn.js
getModelColumn(column, model)
Get a model column by a partial column info.
Parameters
| column | IColumn | The partial column info | Â |
| model | IModel | The model object | Â |
Returns
dist/columns/helpers/getDatasetColumnByDatasets.js
getDatasetColumnByDatasets(column, datasets, getIndex)
Gets a column from a datasets collection.
Recieves a partial column object and returns a full column object from the Dataset
Parameters
| column | IColumn | a partial column object | Â |
| datasets | IDataset | the datasets collection to look for the column | Â |
| getIndex | boolean | flag to get the index of the column array or the complete column info | Â |
Returns
isValidArguments(column, dataset)
Validates the arguments
Parameters
| column | IColumn | a partial column info | Â |
| dataset | IDataset | the datasets collection | Â |
Returns
- true: the arguments are valid.
getModel(qrveyid)
Get the model by Qrvey ID
Parameters
Returns
- a promise with the resulting model
getDatasets(qrveyids)
Get a dataset list from a collection of Qrvey IDs
Parameters
| qrveyids | | Collection of Qrvey IDs | Â |
Returns
getDataValues(uFilter, filterLogic, chartSettings, resetApi)
Get a promise with a preview of resulting data. Depending on the validator, the endpoint will change.
Parameters
| uFilter | | The Filter Builder Filter | Â |
| filterLogic | | Additional filter logic to apply in the preview | Â |
| chartSettings | | | Â |
| resetApi | | flag to determine when the api should be reseted. | Â |
Returns
- a promise with a preview of resulting data.
getAvailableScopeIds()
Gets the available scopes and scope IDs
Returns
- a collection of the pair Scopes and Scope IDs
setConfig(config)
Set the config into the Filter Builder Api class
Parameters
Returns
this.getChartResult(config, uFilter, filterLogic, chartSettings)
Gets a promise with a resulting data
Parameters
| config | | the config | Â |
| uFilter | | The filter Builder filter | Â |
| filterLogic | | Additional filter logic to apply in the preview | Â |
| chartSettings | | The settings of the chart. For Aggregate Columns. | Â |
Returns
- a promise with a resulting data
this._getDataFromResponse(response, uFilter)
Gets the Data from preview Response
Parameters
| response | | The preview presponse | Â |
| uFilter | | The filter Builder filter | Â |
Returns
this._getResponseSummaries(records, values)
Gets summaries from preview response
Parameters
| records | | The data from preview response | Â |
| values | | The values from the preview response | Â |
Returns
_getSearchLogic(uFilter)
Gets the filter object structure for the searching text
Parameters
| uFilter | IFUFlattenedFilter | The filter object | Â |
Returns
- the filter object structure
_getFilterCharts(uFilter, searchLogic, chartSettings)
Gets the filters from the chart settings
Parameters
| uFilter | IFUFlattenedFilter | The filter object | Â |
| searchLogic | OLD_IFilterData | Additional filter object for the searching text | Â |
| chartSettings | IFUChartSettings | The settings of the chart. For Aggregate Columns. | Â |
Returns
- the filters from the chart settings
_getResponse(records)
Tranform response in array of object with value key
Null or undefined values are avoided
Parameters
| records | | The data from preview response | Â |
Returns
UChartApi._getPreviewRequestBody(uFilter, filterLogic, chartSettings)
Gets request body structure
Parameters
| uFilter | IFUFlattenedFilter | The filter object | Â |
| filterLogic | Array.<IFBLogic> | Additional filter logic to apply in the preview | Â |
| chartSettings | IFUChartSettings | The settings of the chart. For Aggregate Columns. | Â |
Returns
- the request body structure
UChartApi._getChartBody(uFilter, chartSettings)
Gets chart body structure
Parameters
| uFilter | | The filter Builder filter | Â |
| chartSettings | | The settings of the chart. For Aggregate Columns. | Â |
Returns
UChartApi._getDimensionsBody(uFilter, chartSettings)
Gets dimension body structure
Parameters
| uFilter | | The filter Builder filter | Â |
| chartSettings | | The settings of the chart. For Aggregate Columns. | Â |
Returns
- the dimension body structure
UChartApi._getMaxDataPoints(column, chartSettings)
Gets max data point number
Parameters
| column | | The column to filter | Â |
| chartSettings | | The settings of the chart. For Aggregate Columns. | Â |
Returns
UChartApi._getSortOption(column)
Gets sort option structure
Parameters
| column | | The column to filter | Â |
Returns
UChartApi._getSummariesBody(uFilter)
Gets summaries body structure
Parameters
| uFilter | | The filter Builder filter | Â |
Returns
UChartApi._refineBodies(bodies, uFilter)
Refines the body structure
Parameters
| bodies | | The body structure | Â |
| uFilter | | The filter Builder filter | Â |
Returns
UChartApi._getValidationType(column, vaildator)
Gets the validation type for the preview request
Parameters
| column | | The column to filter | Â |
| vaildator | | Validator Type | Â |
Returns
- the validator type for the preview request
this.getAfterKey()
Gets afterKey object
Returns
this.getChartResult(config, uFilter, filterLogic, chartSettings)
Gets a promise with a resulting data
Parameters
| config | | the config | Â |
| uFilter | | The filter Builder filter | Â |
| filterLogic | | Additional filter logic to apply in the preview | Â |
| chartSettings | | The settings of the chart. For Aggregate Columns. | Â |
Returns
- a promise with a resulting data
this._getDataFromResponse(response, uFilter)
Gets the Data from preview Response
Parameters
| response | | The preview presponse | Â |
| uFilter | | The filter Builder filter | Â |
Returns
this.refineAfterkey(props)
Refines the afterKey object
Parameters
Returns
this.setAfterKey(afterKey)
Sets the afterKey object
Parameters
| afterKey | | the afterKey object | Â |
Returns
this.setProps(uFilter)
Sets the Filter Builder Filter
Parameters
Returns
_getSearchLogic(uFilter)
Gets the filter object structure for the searching text
Parameters
| uFilter | IFUFlattenedFilter | The filter object | Â |
Returns
- the filter object structure
_getFilterCharts(uFilter, searchLogic, chartSettings)
Gets the filters from the chart settings
Parameters
| uFilter | IFUFlattenedFilter | The filter object | Â |
| searchLogic | OLD_IFilterData | Additional filter object for the searching text | Â |
| chartSettings | IFUChartSettings | The settings of the chart. For Aggregate Columns. | Â |
Returns
- the filters from the chart settings
_getResponse(records)
Tranform response in array of object with value key
Null or undefined values are avoided
Parameters
| records | | The data from preview response | Â |
Returns
UChartPaginationApi._getPreviewRequestBody(uFilter, filterLogic, chartSettings)
Gets request body structure
Parameters
| uFilter | IFUFlattenedFilter | The filter object | Â |
| filterLogic | Array.<IFBLogic> | Additional filter logic to apply in the preview | Â |
| chartSettings | IFUChartSettings | The settings of the chart. For Aggregate Columns. | Â |
Returns
- the request body structure
UChartPaginationApi._getDimensionsBody(uFilter)
Gets dimension body structure
Parameters
| uFilter | | The filter Builder filter | Â |
Returns
- the dimension body structure
UChartPaginationApi._getDimensionsBodyAdapter(dimensions)
Get a dimension body structure foor pagination endpoint
Parameters
Returns
- the dimension body structure
UChartPaginationApi._getMaxDataPoints(column, chartSettings)
Gets max data point number
Parameters
| column | | The column to filter | Â |
| chartSettings | | The settings of the chart. For Aggregate Columns. | Â |
Returns
UChartPaginationApi._getSortOption(column)
Gets sort option structure
Parameters
| column | | The column to filter | Â |
Returns
UChartPaginationApi._getSummariesBody(uFilter)
Gets summaries body structure
Parameters
| uFilter | | The filter Builder filter | Â |
Returns
Refines the body structure
Parameters
| bodies | | The body structure | Â |
| uFilter | | The filter Builder filter | Â |
Returns
UChartPaginationApi._getValidationType(column, vaildator)
Gets the validation type for the preview request
Parameters
| column | | The column to filter | Â |
| vaildator | | Validator Type | Â |
Returns
- the validator type for the preview request
Gets summaries from preview response
Parameters
| records | | The data from preview response | Â |
| values | | The values from the preview response | Â |
Returns
UChartPaginationApi.areColumnsEquals(column1, column2)
Checks if two filter columns are the same.
Parameters
Returns
- True: Columns are equal; False: Columns are not equal
dist/dates/adapters/ISOToNumericOffset.js
ISOToNumericOffset(offset)
Gets the numeric offset (minutes) from the ISO offset (string)
Parameters
| offset | number string | the timezone offset | Â |
Returns
number the offset in minutes
dist/dates/adapters/dateToHms.js
dateToHms(date, settings)
- Transform a Date to [HH:mm:ss] date format.
Parameters
| date | IDate | String, object or millisencond number of the date | Â |
| settings | IDFDateToHmsSettings | the settings of the dateToHms function | Â |
Returns
string string of [HH:mm:ss] date format
getDefaultSettings(settings)
Gets the settings for this function.
Parameters
| settings | IDFDateToHmsSettings | the settings of the dateToHms function | Â |
Returns
IDFDateToHmsSettings a new object for the settings
getHours(date, settings)
Gets the Hours
Parameters
| date | Date | the date object | Â |
| settings | IDFDateToHmsSettings | the settings of the dateToHms function | Â |
Returns
getMinutes(date, settings)
Gets the Minutes
Parameters
| date | Date | the date object | Â |
| settings | IDFDateToHmsSettings | the settings of the dateToHms function | Â |
Returns
getSeconds(date, settings)
Gets the Seconds
Parameters
| date | Date | the date object | Â |
| settings | IDFDateToHmsSettings | the settings of the dateToHms function | Â |
Returns
string the seconds string
dist/dates/adapters/dateToMdyDate.js
dateToMdyDate(date, settings)
Transform a Date to [mm/dd/yyyy] date format.
Parameters
| date | IDate | String, object or millisencond number of the date | Â |
| settings | IDateSettings | the configuration of dates | Â |
Returns
string string of [mm/dd/yyyy] date format
dist/dates/adapters/dateToMonthYear.js
dateToMonthYear(date, settings)
Transform a Date to [Month Year] date format.
Parameters
| date | IDate | String, object or millisencond number of the date | Â |
| settings | IDateSettings | the configuration of dates | Â |
Returns
string string of [Month Year] date format
dist/dates/adapters/dateToQuarterYear.js
dateToQuarterYear(date, settings)
Transform a valid Date to [Quarter Year] date format.
Parameters
| date | IDate | String of a valid date, date object or millisencond number of the date | Â |
| settings | IDateSettings | the configuration of dates | Â |
Returns
string string of [Quarter Year] date format
dist/dates/adapters/dateToWeekYear.js
dateToWeekYear(date, settings)
Transform a Date to [W# Year] date format.
Parameters
| date | IDate | String, object or millisencond number of the date | Â |
| settings | IDateSettings | the configuration of dates | Â |
Returns
string string of [W# Year] date format
dist/dates/adapters/dateToYear.js
dateToYear(date, settings)
Transform a Date to [Year] date format.
Parameters
| date | IDate | String, object or millisencond number of the date | Â |
| settings | IDateSettings | the configuration of dates | Â |
Returns
string string of [Year] date format
dist/dates/adapters/hmsToDate.js
hmsToDate(monthYearDate, settings)
Transforms String time from a [H:m:s] format to Date object.
Parameters
| monthYearDate | string | String of [H:m:s] time | Â |
| settings | IDateSettings | the configuration of dates | Â |
Returns
IDate The date object or the date in milliseconds. If the argument is an unexpected time, the function will return the same value
dist/dates/adapters/mdyDateToDate.js
mdyDateToDate({string}monthYearDate, settings)
Transforms String Date from a [mm/dd/yyyy] format to Date object.
Parameters
| {string}monthYearDate | | String of [mm/dd/yyyy] date | Â |
| settings | IDateSettings | the configuration of dates | Â |
Returns
IDate The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same value
dist/dates/adapters/monthYearToDate.js
monthYearToDate(monthYearDate, settings)
Transforms String Date from a [Month Year] format to Date object.
Parameters
| monthYearDate | string | String of [Month Year] date | Â |
| settings | IDateSettings | the configuration of dates | Â |
Returns
IDate The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same value
dist/dates/adapters/numericOffsetToISO.js
numericOffsetToISO(offset)
Gets the ISO offset From the numeric offset (minutes)
Parameters
| offset | number string | the timezone offset | Â |
Returns
string the offset in minutes
dist/dates/adapters/quarterYearToDate.js
quarterYearToDate(quarterYearDate, settings)
Transforms String Date from a [Quarter Year] format to Date object.
Parameters
| quarterYearDate | string | String of [Quarter Year] date | Â |
| settings | IDateSettings | the configuration of dates | Â |
Returns
IDate The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same value.
dist/dates/adapters/weekYearToDate.js
weekYearToDate(date, settings)
Transforms String Date from a [Week Year] format to Date object.
Parameters
| date | string | String of [Week Year] date | Â |
| settings | IDateSettings | the configuration of dates | Â |
Returns
IDate The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same value.
dist/dates/adapters/yearToDate.js
yearToDate(yearDate, settings)
Transforms String Date from a [Year] format to Date object.
Parameters
| yearDate | string | String of [Year] date | Â |
| settings | IDateSettings | the configuration of dates | Â |
Returns
IDate The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same value.
dist/dates/helpers/areIncludedDateTokens.js
areIncludedDateTokens({string }date, format)
Determines if the given date has tokens. The date is splitted depending on date format.
Undefined date is returning false.
Parameters
| {string }date | | The string of the date. It may contain tokens. | Â |
| format | IDateFormat | The date format | Â |
Returns
boolean true: include tokens; false: otherwise
dist/dates/helpers/getDateByDateFormat.js
getDateByDateFormat(date, format, settings)
Gets a Date Object instance by a Date format
Parameters
| date | string | String with a formatted date | Â |
| format | IDateFormat | The date format | Â |
| settings | IDateSettings | the configuration of dates | Â |
Returns
IDate a Date object, milisecond time or the same value if date format does not match.
dist/dates/helpers/getDateByTimezone.js
getDateByTimezone(date, timezone)
Gets a date value in the given timezone
Parameters
| date | IDate | the date | Â |
| timezone | IDTimezone | the timezone object | Â |
Returns
IDate A transformed value
dist/dates/helpers/getDateByTimezoneOffset.js
getDateByTimezoneOffset(date, offset)
Gets a Date with the given offset of the Timezone.
No given an offset the default is going to be set by the browser
Parameters
| date | IDate | String, object or millisencond number of the date | Â |
| offset | IDTimezoneOffset | the timezone offset | Â |
Returns
IDate the updated Date object
dist/dates/helpers/getDateFormatByProperty.js
getDateFormatByProperty(property)
Gets the date format by the given property
Parameters
| property | IColumnPropertyType | The Column Property | Â |
Returns
IDateFormat The date format
dist/dates/helpers/getDateFormatRegularExpressionInArray.js
getDateFormatRegularExpressionInArray(dateFormat)
Gets an array of regular expressions by the given date format.
Day format is the default date format
Parameters
| dateFormat | IDateFormat | an string of the format | Â |
Returns
Array.<string> an array of regular expressions
dist/dates/helpers/getDatePickerPickLevel.js
getDatePickerPickLevel(format)
Gets the pick level number related to the Date picker element
Parameters
| format | IDateFormat | The date format | Â |
Returns
number A number of the pick level setting
dist/dates/helpers/getDateRange.js
getDateRange(value, dateGroupProperty, withTime)
Get date range object from a string date value
Parameters
| value | String | string date value | Â |
| dateGroupProperty | String | could be 'YEAR', 'QUARTER', 'MONTH' or 'DAY'. Deafult is 'DAY' | Â |
| withTime | Boolean | determines if the date range will include time. Default is true | Â |
Examples
getDateRange('2020', 'YEAR');
{
from: '01/01/2020 00:00:00',
to: '12/31/2020 23:59:59'
}
getDateRange('Q3 2020', 'QUARTER');
{
from: '07/01/2020 00:00:00',
to: '09/30/2020 23:59:59'
}
getDateRange('Oct 2020', 'MONTH');
{
from: '10/01/2020 00:00:00',
to: '10/31/2020 23:59:59'
}
Returns
Object an object with the date range with two string date properties: from and to
getStringDate(dt)
It takes a Date object as an argument and returns a string in the format of MM/DD/YYYY
Parameters
| dt | Date | - Date - The date object to convert to a string | Â |
Returns
- A string in the format of MM/DD/YYYY
dist/dates/helpers/getDefaultDateSettings.js
getDefaultDateSettings(settings)
Gets the default properties for Date Settings object
Parameters
| settings | IDateSettings | the configuration of dates | Â |
Returns
IDateSettings a new object with the date settings.
dist/dates/helpers/getFormattedDateByFormat.js
getFormattedDateByFormat(date, format, settings)
A Date object, string or millisecond number are gotten in order to convert it in an formatted string date
Parameters
| date | IDate | String with a formatted date | Â |
| format | IDateFormat | The date format | Â |
| settings | IDateSettings | the configuration of dates | Â |
Returns
IDate a formmatted date or the same value if format does not match
dist/dates/helpers/getSeparatorByDateFormat.js
getSeparatorByDateFormat(format)
Gets the separator of the date format
Parameters
| format | IDateFormat | the date format | Â |
Returns
string a separator string
dist/dates/helpers/getTimezoneObject.js
getTimezoneObject(timezone, model)
Gets the timezone object by the given argument or the model object
- In any case, the offset is prioritized. It means, offset overrides other properties.
- If the offset is undefined, the type is used to calculate the offset
Parameters
| timezone | IDTimezone | the timezone object | Â |
| model | IModel IDataset | the info of the dataset (model) | Â |
Returns
IDTimezone a new timezone object
getOffset(timezone, model)
Gets the offset of the timezone by the given objects
- Searchs the first argument
- If the timezone is empty, in the model timezone is searched
- If it does not exist in any, a default one is set.
Parameters
| timezone | IDTimezone | The timezone object | Â |
| model | IModel IDataset | The model info | Â |
Returns
IDTimezoneOffset the offset of the objects
getType(timezone, model, offset)
Gets the type of the timezone
- Searchs the first argument
- If it does not exist, asking for the timezone offset in order to prioritized the offset above all.
- If the timezone is empty, in the model timezone is searched.
- If it does not exist in any, a default one is set.
Parameters
| timezone | IDTimezone | The timezone object | Â |
| model | IModel IDataset | The model info | Â |
| offset | IDTimezoneOffset | a default offset if the validation are not satisfied | Â |
Returns
IDTimezoneType the rigth type of the timezone
getTypeByOffset(offset)
Gets the type by a offset
- For a offset=0 the type is default
- For a offset="browser" the type is browser
- For a valid offset different to previous ones, the type is fixed;
- Anything else, it is considered default.
Parameters
| offset | IDTimezoneOffset | a given offset | Â |
Returns
IDTimezoneType the right timezone type for the offset
getUTC(timezone)
Gets the UTC string by the timezone object
Parameters
| timezone | IDTimezone | the timezone object | Â |
Returns
string the label of the UTC value
dist/dates/helpers/getTimezoneOffsetByType.js
getTimezoneOffsetByType(type, timezone)
Gets the timezone offset by the timezone type.
For browser types, it is calculated by a Date instance
Default types is UTC-0
Undefined or Fixed types is gotten by the offset property
Parameters
| type | IDTimezoneType | the timezone type | Â |
| timezone | IDTimezone IBTimezone | the timezone object | Â |
Returns
IDTimezoneOffset the offset of the timezone
dist/dates/helpers/getWeek.js
getWeek(date)
Gets the week number of the year
Additionally, the month and the year
Parameters
Returns
IDateWeek an object with the week, month and year or undefined if the date is not valid.
dist/dates/helpers/getUTCFormatByOffset.js
getUTCFormatByOffset(timezone, minified)
Gets the UTC format dependeing on the given offset
Parameters
| timezone | IDTimezone | the timezone object | Â |
| minified | boolean | Flag to reduce the Zeros | Â |
Returns
string an string with the UTC format
dist/dates/helpers/isValidDateObject.js
isValidDateObject(date)
If the date is a valid Date object, return true, otherwise return false.
Parameters
| date | Date | - The date object to check. | Â |
Returns
boolean True: The Date object is valid
dist/dates/helpers/isValidISOOffset.js
isValidISOOffset(offset)
Validate if offset uses a valid ISO 8601 offset specification
- If the given offset is a numeric, returns an invalid flag.
Parameters
| offset | IDTimezoneOffset | the timezone offset | Â |
Returns
boolean true if the given offset is valid
dist/dates/helpers/isValidPotentialDate.js
isValidPotentialDate(date)
Checks if the given date is allowed to continue the process for adapting dates
- If the string is a token or a combination of tokens is not valid
Parameters
| date | IDate | String, object or millisencond number of the date | Â |
Returns
includingDateTokens(date)
Validates if the given date has tokens
Parameters
| date | IDate | String, object or millisencond number of the date | Â |
Returns
boolean true: the date has tokens
isDateInstance(date)
Validates if the given date is a date instance
Parameters
| date | IDate | String, object or millisencond number of the date | Â |
Returns
boolean true: the date is a date instance
isStringDate(date)
Validates if the given date is a string date
Parameters
| date | IDate | String, object or millisencond number of the date | Â |
Returns
boolean true: the date is a string date
dist/dates/helpers/isValidTimezoneOffset.js
isValidTimezoneOffset(offset)
Validates if the given param is a valid timezone offset
Parameters
| offset | IDTimezoneOffset | the timezone offset | Â |
Returns
boolean true: is valid timezone offset.
isValidOffsetRange(offset)
Validates if the given offset is in the timezone range
Parameters
| offset | IDTimezoneOffset | the timezone offset | Â |
Returns
boolean true: the offset is in the timezone range
dist/dates/helpers/validateDate.js
validateDate(date, format)
Validate a string date depending on giving format
- If the string is a token label, the function lets it pass.
- Otherwise depends of the format
- Some escenarios the string is a mix of token labels and dates
Parameters
| date | string | String of date | Â |
| format | IDateFormat | String of the format to validate | Â |
Returns
boolean True if it is valid or not. Undefined if date is undefined
dist/filters/adapters/FDToFlatUI.js
FDToFlatUI(filterData, datasetsInfo)
Generates a Flattened UI filter structure from Filter Data structure.
Parameters
| filterData | | The filter data object. | Â |
| datasetsInfo | | Collection of datasets information | Â |
Returns
- a flattened UI filters array
FD21ToFlatUI(scopes, datasetsInfo)
Generates a Filter Builder Structure from the Filter Data structure v2.1
Parameters
| scopes | | The filter scope section | Â |
| datasetsInfo | | Collection of datasets information | Â |
Returns
- a flattened UI filters array
dist/filters/adapters/FDToLogic.js
FDToLogic(filterData)
Generates a Filter Logic structure from Filter Data structure.
Parameters
| filterData | | The filter data object. | Â |
Returns
getLogicBodyFromFD21(filterData)
Gets the logic body
Parameters
| filterData | | The filter data object | Â |
Returns
dist/filters/adapters/FDToUI.js
FDToUI(filterData, datasetsInfo)
Generates a UI filter structure from Filter Data structure.
Parameters
| filterData | | The filter data object. | Â |
| datasetsInfo | | Collection of datasets information | Â |
Returns
FD21ToUI(scopes, section, version, datasetsInfo)
Generates a UI filter Structure from the Filter Data structure v2.1
Parameters
| scopes | | The filter scope section | Â |
| section | | The filter section. | Â |
| version | | The version of the filter structure | Â |
| datasetsInfo | | Collection of datasets information | Â |
Returns
dist/filters/adapters/UIToFD.js
UIToFD(filterData)
Generates a Filter Data Structure structure from UI Filter Data structure.
Parameters
| filterData | | The UI filter data object. | Â |
Returns
UI21ToFD(uFilterData, version) private method
Builds the Fitler Data structure from UI filter data
Parameters
| uFilterData | | The UI filter Data object | Â |
| version | | the version of the structure | Â |
Returns
dist/filters/adapters/UIToFlatUI.js
UIToFlatUI(filterData, datasetsInfo)
Generates a Flattened UI filter structure from UI Filter Data structure.
Parameters
| filterData | | The UI filter data object. | Â |
| datasetsInfo | | Collection of datasets information. Optional for updating the datasets info | Â |
Returns
- a flattened UI filters array
UI21ToFlatUI(scopes)
Generates a Flattened UI Filter Structure from the UI Filter Data structure v2.1
Parameters
| scopes | | The filter scope section | Â |
Returns
- a flattened UI filters array
dist/filters/adapters/adaptDateGroupingProperty.js
adaptDateGroupingProperty(property)
[TODO: For 2022, eliminate this adapter]
Get the new property base on the old date grouping properties
Parameters
| property | | the property to be adapted | Â |
Returns
dist/filters/adapters/adaptFilterData.js
adaptFilterData(filterData, getUIFilterData, datasetsInfo)
Checks and adapts the v2.0 Filter Data Structure to the v2.1
Parameters
| filterData | | The filter data structure. Accepts both v2.1 or v2.0 | Â |
| getUIFilterData | | Flag to get a Filter Data (False) or the UI Filter Data (True) | Â |
| datasetsInfo | | Collection of datasets information. If getUIFilterData is true, the datasetsInfo should be mandatory | Â |
Returns
- A new filter data structure v2.1
dist/filters/adapters/adaptFilterValues.js
adaptFilterValues(filter)
[TODO: For 2022, eliminate this adapter]
Gets an adapted filter value array. Validates the enabled property and sets
Parameters
Returns
- A new value array with the filled properties.
dist/filters/adapters/flatUIToFD.js
flatUIToFD(uFilters, version)
Generates a filter data structure from the flatttened UI filters.
Parameters
| uFilters | | Array of flattened filters from UI | Â |
| version | | Tag for the version of the filter data structure | Â |
Returns
buildScopes(fbFilters)
Gets an array of scopes structure for the filter data. The scopes is organized by scope types and scope IDs
Also, adds and organizes filters by datasets
Parameters
| fbFilters | | Array of flat filters from UI | Â |
Returns
- an array of scopes structure.
buildScope(uFilter)
Gets an scope structure for the filter data
Parameters
| uFilter | | UI structure filter | Â |
Returns
buildDataset(uFilter)
Gets an dataset structure for the filter data
Parameters
| uFilter | | a UI structure filter | Â |
Returns
buildFilter(uFilter)
Gets an filter structure for the filter data
Parameters
| uFilter | | a UI structure filter | Â |
Returns
dist/filters/adapters/flatUIToLogic.js
flatUIToLogic(uFilter)
Generates a Logic structure from flattened UI filters
Parameters
| uFilter | | Array of flat filters from UI | Â |
Returns
dist/filters/adapters/flatUIToOldLogic.js
flatUIToOldLogic(uFilters)
Generates a Logic structure from flattened UI filters
Parameters
| uFilters | | Array of flat filters from UI | Â |
Returns
dist/filters/adapters/flatUIToUI.js
flatUIToUI(uFilters, version)
Generates a UI filter data structure from the flatttened UI filters.
Parameters
| uFilters | | Array of flattened filters from UI | Â |
| version | | Tag for the version of the filter data structure | Â |
Returns
buildScopes(fbFilters)
Gets an array of scopes structure for the UI filter data. The scopes is organized by scope types and scope IDs
Also, adds and organizes filters by datasets
Parameters
| fbFilters | | Array of flat filters from UI | Â |
Returns
- an array of scopes structure.
buildScope(uFilter)
Gets an scope structure for the UI filter data
Parameters
| uFilter | | UI structure filter | Â |
Returns
buildDataset(uFilter)
Gets an dataset structure for the UI filter data
Parameters
| uFilter | | a UI structure filter | Â |
Returns
buildFilter(uFilter)
Gets an filter structure for the UI filter data
Parameters
| uFilter | | a UI structure filter | Â |
Returns
dist/filters/adapters/logicToFD.js
logicToFD(filterData, version)
Generates a filter data structure from the old logic structure (v2.0).
Parameters
| filterData | | The old filter data structure with logic (v2.0) | Â |
| version | | Tag for the version of the filter data structure | Â |
Returns
dist/filters/adapters/logicToFlatUI.js
logicToFlatUI(logics)
Adapts the Old logic structure (v2.0) to the flattened UI filter Structure.
Parameters
| logics | | The old logic structure (v2.0) | Â |
Returns
- The Flattened UI Filters array
getFilter(filters, filter, getIndex)
Get the filter or the index of the given array, validating an old filter structure.
Parameters
| filters | | The array of UI filters | Â |
| filter | | The old logic structure filter | Â |
| getIndex | | Determines if the index or returns the UI filter object | Â |
Returns
- the index or the UI filter object
refineRankingValues(values, uiValues)
Refines the values of the Ranking column type.
Parameters
| values | | the Array of Ranking values | Â |
| uiValues | | Object with additional info about the values of the filter. | Â |
Returns
- the array of Ranking values
dist/filters/adapters/logicToUI.js
logicToUI(uFilters, datasetsInfo)
Generates a UI filter structure from the old logic structure (v2.0).
Parameters
| uFilters | | Array of filters from old logic structure | Â |
| datasetsInfo | | Collection of datasets information | Â |
Returns
dist/filters/adapters/modelAnswerToFilterValue.js
modelAnswerToFilterValue(answers)
Adapter for model answer to convert to recognizable values for Filter Builder
Parameters
| answers | | Array of the qrvey model answers | Â |
Returns
dist/dates/relative/RelativeStatementAdapter.js
value()
Resolves statement and returns statement value
Returns
valueAsAnchor()
Resolves statement as an anchor
Returns
_statementToRange() private method
Convert verbal statement to range value
Returns
_resolveAsThis() private method
Apply 'this' cursor logic to statement
Returns
_resolveAsTheLast() private method
Apply 'the last' cursor logic to statement
Returns
_resolveAsTheNext() private method
Apply 'the next' cursor logic to statement
Returns
replaceNowToken(value, now)
Replace '@now' token inside a string
Parameters
Returns
convertRelativeToAbsolute(args)
Returns a range object (date) from a group of statement params
Parameters
| args | RelativeToAbsoluteStruct | | Â |
Examples
pivot = '2021-03-03T12:30:40'
unit = month
steps = 2
setTo = END
resolverAsCalendar: true
=> Returns '2021-05-31T23:59:59'
pivot = '2021-03-03T12:30:40'
unit = month
steps = -2
setTo = START
resolverAsCalendar: false
=> Returns '2021-01-03T00:00:00'
Returns
dist/dates/relative/relative.js
resolveRelative(statements, clock)
Resolve a list of relative statements according to operator
Parameters
| statements | | - Raw statements/values | Â |
| clock | | - Clock/time reference for relative date resolution | Â |
Examples
Input:
{
"cursor": "the_next",
"unit": "year",
"number": 1,
"includeCurrent": false,
"isCalendarDate": false,
"anchor": "03/05/2021"
}
Output:
{ gte: "03/06/2021 00:00:00", lte: "03/05/2022 23:59:59" }
Returns
dist/filters/helpers/OLD_getAggFilters.js
getAggFilters(logics, summaries)
Parameters
Returns
- the filter aggregate structure
getAggregateFilters(logics, formatToFilters)
Filters and gets the filters used for aggregate values.
Parameters
| logics | | The filter logic structure | Â |
| formatToFilters | | Flag to change de way of returning the filter structure. | Â |
Returns
- the aggregate filters in the IFilterFilters way or as logic structure.
dist/filters/helpers/applyHierarchyForAggFilters.js
applyHierarchyForAggFilters(chartSettings, scopes, currentScope)
[TODO: Make a proper description for this function]
Parameters
| chartSettings | | Chart Settings for the Filter Builder | Â |
| scopes | | the pair id/label scopes | Â |
| currentScope | | the scope to be validated | Â |
Returns
dist/filters/helpers/filtersTokensToString.js
filtersTokensToString(tokens)
It takes an array of tokens and returns a string
Parameters
| tokens | Array.<IFFilterTokens> | - IFFilterTokens[] - the tokens to convert to a string | Â |
Returns
dist/filters/helpers/getAggFiltersFromFilterData.js
getAggFiltersFromFilterData(filterData, _summaries) private method
Parameters
Returns
dist/filters/helpers/getAvailableScopesIDsByConfig.js
getAvailableScopesIDsByConfig(config)
Gets the Scopes IDS for the Available Scope function by any config
Parameters
Returns
- a Available Scope IDS config
dist/filters/helpers/getScopesByHierarchy.js
getScopesByHierarchy(scopes, currentScope)
[TODO: Make a description for this]
Parameters
| scopes | | the collection of Scopes/Scope IDs | Â |
| currentScope | | Current scope type | Â |
Returns
- A new array of Scopes/Scope IDs
dist/filters/helpers/getTokensFromFilters.js
getTokensFromFilters(filters, options)
It takes a filter object and returns an array of tokens that represent the filter
Parameters
| filters | IFUData | - The filters object. | Â |
| options | IFTokensFromFiltersSettings | - IFTokensFromFiltersSettings | Â |
Returns
Array.<IFFilterTokens> An array of tokens that represents the filters object
dist/filters/helpers/getVerboseFilter.js
getVerboseFilter(filters, options)
It takes a set of filters and returns a string that describes the filters
Parameters
| filters | IFUData | - The filters object that you want to convert to a string. | Â |
| options | IFTokensFromFiltersSettings | - IFTokensFromFiltersSettings | Â |
Returns
dist/filters/helpers/getAvailableScopes.js
getAvailableScopes(config)
Gets Scopes/Scope IDs by given IDs
Parameters
| config | | given Differnts IDs in order set a available scope | Â |
Returns
dist/format/duration/addDurationFormat.js
addDurationFormat(number, format[, locale, fractionDigits])
[TODO: The decimals dots are not working correctly, we need to reviewing (fractionDigits)]
"Convert a number of seconds to a human readable string."
addDurationFormat is a function that takes a number, a format, an optional locale, and an optional
number of fraction digits, and returns a string
Parameters
| number | number | - The number of milliseconds to format. | Â |
| format | string | - The format string. | Â |
| locale | string | - The locale to use for formatting. If not specified, the default locale is used. | Optional |
| fractionDigits | number | - The number of digits to show after the decimal point. | Optional |
Returns
dist/format/duration/durationFormatter.js
setLocaleFormatter()
It sets the locale formatter for the number.
Returns
getNewNumberFormat(locale)
It returns a new instance of the Intl.NumberFormat class, which is a built-in JavaScript class
that formats numbers
Parameters
| locale | string Array.<string> | - string | string[] |
Returns
- A new instance of the Intl.NumberFormat class.
setParts(template)
It takes a template string and sets the parts property to the result of calling the
parseFormatTemplate function with the template string as an argument
Parameters
| template | string | - The format template string. | Â |
Returns
matchFormatsReplace(template)
It replaces the H and D characters in the template with h and d respectively
Parameters
| template | string | - The template string to be used for the date format. | Â |
Returns
- The template string with all instances of H replaced with h and all instances of D replaced with d.
setNumberFactor()
It sets the numberFactor to the value of the duration part that matches the unit.
Returns
parseFormatTemplate(template)
It takes a string, splits it into an array of strings, then maps each string to a config object,
then filters out any falsy values, then reverses the array
Parameters
| template | string | - string - the template string that we want to parse | Â |
Returns
- An array of objects that have the order and the name of the part of the duration.
format(number)
It takes a number, multiplies it by a factor, then uses the parts array to calculate the number
of each part in the number, then uses the template to format the number
Parameters
| number | number | - The number of milliseconds to format. | Â |
Returns
- The template string with the values replaced.
formatValue(parts, part)
It takes a dictionary of values and a list of keys, and returns a formatted string
Parameters
| parts | | - { [x: string]: any; } | Â |
| part | string `Array.<string | number>` | - This is the part of the date that we're formatting. |
Returns
- The value of the part of the date that is being formatted.
dist/globalization/service/i18nextBuilder.js
new I18nService()
This class allows to use the translation service of the i18next library
Returns
dist/qrvey/helpers/areStaticColumnValues.js
areStaticColumnValues(column)
Determines if the given column is belonging to static values questions.
Static values questions are questions that do not need request an info from backend, instead the info is got from Model, Question/List object.
Parameters
| column | | The question column | Â |
Returns
- true if the column belongs to a static values question; otherwise, false
dist/qrvey/helpers/getCategorizableExpression.js
getCategorizableExpression(column, dataset)
Special function for Expression Columns.
This function allows validating if expression columns have active category option.
This is esential in order to display the asigned property for expression.
Parameters
| column | | The column with info | Â |
| dataset | | the dataset object to search the column | Â |
Returns
- true if expression column is categorizable; otherwise not. If does not exist, undefined is sent.
dist/qrvey/helpers/getDataAnswersByColumn.js
getDataAnswersByColumn(column, model, property)
Get answers located in model object. If column exists in the model, answers will be gotten depending on column type.
For Rating columns, needs a number sequence (From 1 to 5).
For Expression columns, needs a property type attribute for categorizable ones; for non-categorizable expressions is not required this attribute.
For the others columns, answers is located in the property of the same name.
Parameters
| column | | Info of the column | Â |
| model | | The model object | Â |
| property | | Optional Attribute, especially for expression columns. | Â |
Returns
- Formatted answers inside of answer property.
dist/qrvey/helpers/getDatasetByColumn.js
getDatasetByColumn(column, datasets)
Gets a dataset by a given partial column
Parameters
| column | | the partial column | Â |
| datasets | | the collection of dataset to look for one. | Â |
Returns
- the found dataset or undefined
dist/qrvey/helpers/getExpressionAnswers.js
getExpressionAnswers(column, property)
Get the answers of expression columns. Depends of the property attribute and if the column is categorizable.
Parameters
| column | | The column located inside the model object. | Â |
| property | | Optional Attribute, especially for expression columns. | Â |
Returns
- Formatted answers inside of an answer property.
dist/qrvey/helpers/getDropdownAnswers.js
getDropdownAnswers(question)
Get the answers of dropdown columns.
Answers is a direct array of strings so it is necessary to format them.
Parameters
| question | | The column located inside the model object. | Â |
Returns
- Formatted answers inside of an answer property.
dist/qrvey/helpers/getImageAnswers.js
getImageAnswers(column)
Get the answers of image columns.
Parameters
| column | | The column located inside the model object. | Â |
Returns
- Formatted answers inside of an answer property.
dist/qrvey/helpers/getImageUploadHasAnalysis.js
getImageUploadHasAnalysis(column, model)
Special function for Image Upload
This function returns if the current column has object or text analysis as property.
Parameters
| column | | The column with info | Â |
| model | | The model object | Â |
Returns
- true if this column has analysis. Otherwise false.
dist/qrvey/helpers/getRatingAnswers.js
getRatingAnswers(_question)
Get the answers of rating columns.
Parameters
| _question | | The column located inside the model object. | Â |
Returns
- Formatted answers inside of an answer property
dist/qrvey/helpers/getSlidebarAnswers.js
getSlidebarAnswers(_question)
Get the answers of slidebar columns. The quantity of answers depend on the steps chosen in maker.
Parameters
| _question | | The column located inside the model object. | Â |
Returns
- Formatted answers inside of an answer property
dist/qrvey/helpers/getSuffixTranslateByColumn.js
getSuffixTranslateByColumn(column)
Gets a string of the translate structure by the given column
Parameters
| column | | the Info of the column | Â |
Returns
- a string of the translation structure where the label is located.
dist/qrvey/helpers/getValueWithSuffixes.js
getValueWithSuffixes(value, suffixes)
Get a string value with suffixes if available.
Add suffix into the value string. Prioritized for numeric values.
Parameters
| value | | a number or string | Â |
| suffixes | | An object with singular or plural suffix string. | Â |
Returns
- a string value with suffix
dist/qrvey/helpers/getYesNoAnswers.js
getYesNoAnswers(column)
Get the answers of Yes/No columns.
Yes/No answers from model object are capitalized but the filters need values in lowercase.
Parameters
| column | | The column located inside the model object. | Â |
Returns
- Formatted answers inside of an answer property
dist/qrvey/helpers/transformValue.js
transformValue(value, settings)
Transforms a value depending of localization/globalization and extras settings.
Parameters
| value | | A value to transform | Â |
| settings | | The settings of the transformValue function | Â |
Returns
getDefaultSettings(settings)
Gets the default settings properties
Parameters
| settings | ITransformValueSettings | the given settings | Â |
Returns
ITransformValueSettings the settings with default properties
getOutputFormat(settings)
Gets the outputformat settings
Parameters
| settings | | The settings of the transformValue function | Â |
Returns
- the outputformat settings
getFormatConfig(settings)
Gets the format config if the locale exists in i18n settings
Parameters
| settings | | The settings of the transformValue function | Â |
Returns
getOutputFormatByPoperty(settings)
If the property is a day, return the date format without the time, otherwise return the original
format.
Parameters
| settings | ITransformValueSettings | - ITransformValueSettings | Â |
Returns
- The outputFormat of the column.
isDateWithTime(property)
Get the format related to the columnn property.
If the property is hour, minute, second, or undefined, return true.
Parameters
| property | IColumnPropertyType | - The property of the date to group by. | Â |
Returns
dist/general/mix/compareDeep.js
compareDeep(object1, object2)
Compares two objects to know if they are equals. Go across nested objects.
Includes arrays in the comparison.
Parameters
| object1 | | First Object to compare | Â |
| object2 | | Second Object to compare | Â |
Returns
- True: objects are equal. False: Objects are not equal. Undefined: invalid
dist/general/mix/getTag.js
getTag(value)
Gets the toStringTag of value.
Parameters
| value | | The value to query. | Â |
Returns
string Returns the toStringTag.
dist/general/mix/importScripts.js
importScripts(scripts)
Import a set of external Scripts given the URL in both serie and cascade way
Parameters
| scripts | Array.<String> Array.<Object> | can be an array of string or an array of object with the follow structure: | Â |
| scripts.url | String | CDN URL | Â |
| scripts.namespace | String Function | (Optional) if is a String, that name is evaluated on Window[namespace] object otherwise the Function is invoked expecting a Thrutly value | Â |
| scripts.type | String | (Optional) it could be module of text/javascript. Default text/javascript | Â |
| scripts.noModule | Boolean | (Optional) add momodule attribute to script tag. Default false | Â |
| scripts.dependencies | Array.<Object> | an array with the same structure to load in cascade mode | Â |
Examples
importScripts(['http://myscript.js', 'http://another.js']);
importScripts([
{ url: 'http://myscript.esm.js', type: 'module' },
{ url: 'http://myscript.js', noModule: true }
]);
importScripts([
{ url: 'http://myscript.js', dependencies: ['http://myscript.plugin.js'] }
]);
importScripts([
{ url: 'http://myscript.js', dependencies: ['http://myscript.plugin.js'] },
{ url: 'http://another.esm.js', type: 'module' },
{ url: 'http://another.js', noModule: true },
'http://simplescript.js'
]);
Returns
Promise Promise when all script have been loaded
loadScript(url, type, noModule)
Creates the script element and appends to document.head
return a Promise that is resolved when the script is loaded
Parameters
| url | String | Cdn Url | Â |
| type | String | (Optional) it could be module of text/javascript. Default text/javascript | Â |
| noModule | boolean | (Optional) add momodule attribute to script tag. Default false | Â |
Returns
dist/general/mix/isEmpty.js
isEmpty(variable, includeFalsy)
Validates if the given argument is empty
Parameters
| variable | | the given variable | Â |
| includeFalsy | | flag to determine include the falsy variables into the validation | Â |
Returns
- true: the given argument is empty; false: is not.
dist/general/mix/isNaNV2.js
isNaNV2(variable)
Validates if the recieved number is NaN type.
Conditions:
- This function recieves any variable but will return true if it is different to number.
- Empty variables as undefined, null, empty string will return true.
Special case for isNaN
- The isNaN('') is considered as false statement. The empty string is converted to 0 which is not NaN.
- Boolean variables is considered as false statement.
- Date objects is considered as true.
Parameters
| variable | | the variable to validate | Â |
Returns
- True: variable is a NaN; False: The variable is a number
dist/general/mix/isNull.js
isNull(arg)
return if a given variable is either null or undefined
useful to avoid falsify validating Number Zero (0)
Parameters
Returns
dist/general/mix/randomId.js
randomId(length, exclude)
Creates a random string
- If the first given argument is different than a length number, the variable is replaced by a default number
- If the optional second given argument is passed the random string is permutated.
Parameters
| length | Number | size of the generated string. Default 8 | Â |
| exclude | Array | collection of strings that is going to be excluded of the random string. | Â |
Returns
dist/general/mix/size.js
size(obj)
Gets the length of the given array.
- Useful for Object, Array and string type.
- For
null or undefined or else argument the returned value will be 0.
Parameters
| obj | Any | Any object-type variable | Â |
Returns
Number the size of the given variable
dist/general/numeric/getSign.js
getSign(num)
Gets the numeric sign of a given number
Parameters
Returns
string an string with the sign
dist/general/string/capitalize.js
capitalize(text)
Upper case the first letter of a given text
Parameters
Returns
String a capitalized text
dist/general/string/padLeadingZeros.js
padLeadingZeros(num, size, padding)
Sets an amount of zeros as prefix of the given number by its length
Parameters
| num | number string | the number | Â |
| size | number | the quantity of zeros to add | Â |
| padding | number | True: to pad with missing zeros; depending on the num length. False: to fill zeros by the amount. | Â |
Examples
num = 100
size = 2
padding = true
=> Returns "100"
num = 100
size = 5
padding = true
=> Returns "00100"
num = 100
size = 2
padding = false
=> Returns "00100"
num = 100
size = 5
padding = false
=> Returns "00000100"
Returns
- the string of the number with the prefixed zeros
getAbsoluteNum(num, sign)
Gets the absolute number of the giving parameters
Parameters
| num | number string | the number | Â |
| sign | string | the sign of the number | Â |
Returns
string the absolute number
getNumSign(num)
Gets the number sign
Parameters
| num | number string | the number | Â |
Returns
dist/general/array/addPropertyToArrayOfObjects.js
addPropertyToArrayOfObjects(info)
It takes an array of objects, adds a property to each object, and returns the new array.
Parameters
| info | Object | - Information needed to add property to the array of objects. | Â |
| info.array | Array | - The array of objects you want to add a property to. | Â |
| info.property | string | - The property you want to add to the object. | Â |
| info.value | any | - - The value to be added to the array of objects. ---------------------------------------------------------------------------------------------- | Â |
Examples
<caption>Example usage of addPropertyToArrayOfObjects.</caption> addPropertyToArrayOfObjects({
array: [{ name: "John", lastName: "Doe" }, { name: "Chris", lastName: "Musk" }],
property: "lastName",
value: 'Peck'
});
Returns
dist/general/array/delete.js
ArrayDelete(array, index)
Inmutable Array Item deletion
Parameters
| array | Array | a collection of items to delete | Â |
| index | Number | the position of the item to delete | Â |
Returns
- a new Array or the given parameter when is empty or not an array
dist/general/array/filterNestedTree.js
filterNestedTree(arr, childArrKey, condition)
Filters a nested tree array by a custom condition on the last child node
- If the given arguments are not valid, the function returns the first argument.
- If the childArrKey is not matched in the object, the condition tries to resolve the filter anyway and returns an empty array.
- If the condition is not fulfilled, the function returns a filtered array, probably a empty array inside of the child array
Parameters
| arr | | nested tree array | Â |
| childArrKey | | property representing the children array on the nested tree | Â |
| condition | | function callback that determines if the filter is applied on the last child node of the nested tree | Â |
Returns
dist/general/array/flattenDeep.js
flattenDeep(arr)
Flat deeply an array
Parameters
Returns
dist/general/array/getArrayByProperty.js
getArrayByProperty(arr, property)
Gets a collection of object values by the given property
Parameters
| arr | | An array | Â |
| property | | the property to get the value collection | Â |
Returns
- a collection of values by property
dist/general/array/getFirstIndexFromArray.js
getFirstIndexFromArray(array, callback)
Gets the first index from the array by a callback condition
Parameters
| array | | | Â |
| callback | | function callback | Â |
Returns
- the first index of the array. -1 when the condition is not satisfied
dist/general/array/getLastIndexFromArray.js
getLastIndexFromArray(array, callback)
Gets the last index from the array by a callback condition
Parameters
| array | | | Â |
| callback | | function callback | Â |
Returns
- the last index of the array. -1 when the condition is not satisfied
dist/general/array/getUniqueArray.js
getUniqueArray(arr, prop)
Remove duplicated items from a given array by property name
// 1. Store the keys of the unique objects
// 2. Eliminate the dead keys & store unique objects
Parameters
| arr | | The array | Â |
| prop | | Property name to search duplicated values | Â |
Returns
- Array without duplicated items.
dist/general/object/applyTimezoneDeep.js
applyTimezoneDeep(obj, timezone)
Transforms the date+times propertiesof the given object by the Timezone object
Parameters
| obj | any | the object | Â |
| timezone | IDTimezone | the timezone object | Â |
Returns
IFSData IFUData the new filter data with the transformed datetime values
dist/general/object/cloneDeep.js
cloneDeep(obj)
A simple Deep Cloning function. Valid only for primivite values and object with primitive values.
Not to use this function with inner objects and functions
Parameters
Returns
- The new reference object or the given object if the parsing is incorrect or empty
dist/general/object/get.js
_get(baseObject, path, defaultValue)
Like lodash _.get.
Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place.
Empty arrays and empty objects are returned but the defaultValue is not
Undefined and null values will return the defaultValue.
Parameters
| baseObject | | The object to query | Â |
| path | | The string path or collection of string paths of the property to get. | Â |
| defaultValue | | The value returned for undefined resolved values. | Â |
Examples
_get({ item1: 'Hello', item2: 'World' }, 'item1')
_get({ item1: 'Hello', item2: 'World' }, 'item3', 'A simple Hello')
_get({ item1: { item11: 'Hello Again' }, item2: {} }, 'item1.item11')
_get({ item1: ['Hello 1', 'Hello 2' }, item2: [] }, 'item1[1]')
_get({ item1: { item11: 'Hello Again' }, item2: {} }, ['item1', 'item11'])
Returns
dist/general/object/getAttribute.js
getAttribute(obj, key)
Searchs for properties in different case styles such as: lower, upper, camel and pascal
- To optimize the searching, it is required a key in a snake_case style
- List of cases that do not match
-- From lower to snake case
-- From upper to snake case
-- From lower to camel case
-- From upper to camel case
-- From lower to pascal case
-- From upper to pascal case
Parameters
| obj | object | object to look for | Â |
| key | string | String attribute in snake_case style | Â |
Examples
getAttribute(obj, 'snake_case')
Returns
dist/general/object/hasProperty.js
_hasProperty(obj, property)
Use the hasOwnProperty in order to verify if the given property exists in the object.
Parameters
| obj | object | an object | Â |
| property | string | String to verify if exists in the object as property | Â |
Examples
const prop = 'prop2'
const obj1 = { prop1: 'hello', prop2: 'world'}
_hasProperty(ob1, prop1)
const obj2 = { prop1: 'hello world' }
_hasProperty(ob1, prop2)
Returns
- True if the object has the given property; otherwise, false.
dist/general/object/isObject.js
isObject(obj)
Checks if the given argument is an object type
Parameters
| obj | | the variable to check | Â |
Returns
- True: It is an object; False: It is not.
dist/general/object/mapValues.js
mapValues(baseObject, iteratee)
Invoke iteratee (function) for each object key-value pair
and return a mapped object
Parameters
| baseObject | Object | Base object. | Â |
| iteratee | Function | The executed per iteration. | Â |
Returns
Object New mapped object.
dist/general/object/mergeDeep.js
mergeDeep(obj1, obj2, settings)
Merges two objects into a new one.
The second given argument to the first given argument.
Parameters
| obj1 | | The target object | Â |
| obj2 | | The object to be merged | Â |
| settings | | Object settings for this function | Â |
Returns
isValid(obj1, obj2)
Validates if the two arguments are objects
Parameters
| obj1 | | The target object | Â |
| obj2 | | The object to be merged | Â |
Returns
- true: they are valid; false: they are not
getParamsToMergeDeep(settings)
Validates and gets the settings with all set parameters.
Parameters
| settings | | the settings object | Â |
Returns
- a new settings object with all set parameters.
dist/general/object/objectCopy.js
objectCopy(entity, cache)
Created a new reference of the given argument
Parameters
| entity | | The variable to be copied | Â |
| cache | | | Â |
Returns
- A new reference of the given argument
dist/general/object/omit.js
omit(obj, props)
return a new Object excluding attributes in props list
Parameters
| obj | Object | base object | Â |
| props | Array.<String> | list of attribute to exclude | Â |
Returns
dist/general/object/removeUndefinedDeep.js
removeUndefinedDeep(obj)
Removes and returns the given object cleaning the undefined values
Parameters
Returns
- the new object with no undefined values
dist/general/object/pick.js
pick(baseObject, keys)
return a new object just with attributes in keys list
Parameters
| baseObject | Object | base object | Â |
| keys | Array.<String> | list of attributes to preserve | Â |
Returns
Object new object just with desired attributes
dist/general/object/serialize.js
serialize(obj)
serialize object to url param
Parameters
| obj | | - Object to be serialized | Â |
Returns
dist/services/adapters/BBranchesMapToUIBranchesMap.adapter.js
BBranchesMapToUIBranchesMap(branchesMap)
Adapts the branches map from backend to the UI branches map
Parameters
| branchesMap | | the backend branches map | Â |
Returns
dist/services/adapters/BTimezoneToUITimezone.js
BTimezoneToUITimezone(timezone)
Transforms the backenc timezone structure to UI timezone structure
Parameters
| timezone | IBTimezone | the backend timezone object | Â |
Returns
IDTimezone the UI timezone object
dist/services/api/getAllDatasets.api.js
getAllDatasets(config, qrveyids)
Get a dataset list from a collection of Qrvey IDs
Considerations for qrveyids second argument:
- If it is a undefined argument, the function will return all available datasets of the app
- If it is a empty array argument, the function will return an empty dataset list. (A request will not be executed)
- If it is a non-empty array argument, the function will return a set of available datasets
Parameters
| config | | the widget config. Includes general configuration properties | Â |
| qrveyids | | Collection of Qrvey IDs for returning a set of available datasets | Â |
Returns
- a promise that if it is resolved displays a collection of dataset info.
dist/services/api/getAllQrveys.api.js
getAllQrveys(config, params)
Request function for getting Qrveys such as Web Forms and Datasets. Use params for getting precise data
Parameters
| config | | Configuration | Â |
| params | | Object for getting precise data | Â |
Returns
dist/services/api/getDatasetColumns.api.js
getDatasetColumns(qrveyid)
Get a dataset by Qrvey ID
Parameters
Returns
dist/services/api/getDatasetsByIds.api.js
getDatasetsByIds(qrveyid)
Get a dataset by Qrvey ID
Parameters
Returns
dist/general/function/debounce.js
debounce(fn, time)
Delays invoking fn until after time milliseconds have elapsed since the last time the debounced function was invoked.
Parameters
| fn | Function | original Function | Â |
| time | Number | default 500ms | Â |
Returns
Function debounced functions
dist/general/function/throttled.js
throttled(fn, time)
Make sure to only invokes fn at most once per every time milliseconds
Parameters
| fn | Function | original Function | Â |
| time | Number | default 500ms | Â |
Returns
Function throttled function
dist/themes/helpers/calculateHSP.js
calculateHSP(rgbaChannel)
Calculates the HSP Color Mode from the RGBA channels
- If the calculation are wrong or the given parameter is undefined, the function will return a default for light colors
Parameters
| rgbaChannel | | the rgba channel object | Â |
Returns
dist/themes/helpers/getCSSVariablesByDestination.js
getCSSVariablesByDestination(destination)
Gets CSS variables depending on the destination of them.
- Destination is the place where the CSS variables are going to be applied. With this, the right CSS variables are searched and set.
Parameters
| destination | | the string of the destination. | Â |
Returns
- the CSS variables and their values.
dist/themes/helpers/getChannelsByHexadecimalColor.js
getChannelsByHexadecimalColor(color)
Gets the RGBA channels based on the given string Hexadecimal color
- If the given argument is undefined or invalid, the function will return a channel related to white color
Parameters
| color | | the Hexadecimal color | Â |
Returns
dist/themes/helpers/getChannelsByNameColor.js
getChannelsByNameColor(color)
Gets the RGBA channels based on the given string name color
- If the given argument is undefined or invalid, the function will return a channel related to white color
Parameters
Returns
dist/themes/helpers/getChannelsByRgbaColor.js
getChannelsByRgbaColor(color)
Gets the RGBA channels based on the given string RGBA color
- If the given argument is undefined or invalid, the function will return a channel related to white color
Parameters
Returns
dist/themes/helpers/getHexadecimalOpacity.js
getHexadecimalOpacity(hexadecimal)
Gets the Alpha channel (opacity) base on the hexadecimal color
- If the alpha channel is not set into the given parameter or the calculation is NaN, the function will return 1
Parameters
| hexadecimal | | hexadecimal color | Â |
Returns
- the Alpha channel (opacity)
dist/themes/helpers/getRgbaOpacity.js
getRgbaOpacity(hexadecimal)
Gets the Alpha channel (opacity) base on the RGBA color
-
- If the alpha channel is not set into the given parameter or the calculation is NaN, the function will return 1
Parameters
Returns
- the Alpha channel (opacity)
dist/themes/helpers/isDarkColor.js
isDarkColor(color)
Determines if the Color is dark or light.
Uses the lightOrDark module.
Parameters
| color | | the string of the color (RGBA, or Hexadecimal) | Â |
Returns
dist/themes/helpers/isHexadecimalColor.js
isHexadecimalColor(color)
Validates if the given color is an hexadecimal structure
Parameters
| color | | the string of the color | Â |
Returns
- true: the color is an hexadecimal type
dist/themes/helpers/isRGBAColor.js
isRGBAColor(color)
Validates if the given color is an RGBA structure
Parameters
| color | | the string of the color | Â |
Returns
- true: the color is an RGBA type
dist/themes/helpers/lightOrDark.js
lightOrDark(color)
Validates if the given color is light or dark
The module extracts the rgba channels and calculate the brightness or darkness by a threshold
- If there is not color provided, the returning will be Light
Parameters
| color | | the string of the color. | Â |
Returns
- the color type (Dark or Light)
setAutomaticCSSVariablesForDark(colorType, wrapperTags)
Sets CSS Variables into a given wrapper collection.
For the Dark Theme feature.
Parameters
| colorType | | the color type | Â |
| wrapperTags | | the html elements to set the CSS variables | Â |
Returns
setCSSVariable(colorType, wrapper, cssVariables)
Sets CSS Variables into a given wrapper collection.
For the Dark Theme feature.
Parameters
| colorType | | the color type | Â |
| wrapper | | the html element to set the CSS variables | Â |
| cssVariables | | the CSS variables name to apply the style property | Â |
Returns
dist/typescript/decorators/Debounce.js
Debounce(time)
(Method Decorator) Debounce Class Method
Parameters
| time | | (optional) deafult 500 | Â |
Returns
dist/typescript/decorators/Throttled.js
Throttled(time)
(Method Decorator) Throttled Class Method
Parameters
| time | | (optional) deafult 500 | Â |
Returns
dist/stencil/decorators/Config.js
Config()
Stencil.js - Prop Decorator
Get and Parse the Widget Configuration Object and also provide the ability to get properties in different case styles such as: lower, upper, camel and pascal
But for this, is required ask for a property in snake_case style
Examples
\ @Config() @Prop() settings;
someMethod() {
this.settings.snake_case
}
Returns
dist/stencil/util/createRef.js
createRef()
lit implementation of React createRef (https://reactjs.org/docs/refs-and-the-dom.html)
Returns
- function - Function to use in ref prop in html elements
dist/stencil/util/getConfig.js
getConfig(cfg)
verify the Config object type and try to return a parsed Object
- In case cfg is a string, first try to make a JSON parse in other case
try to find this string as a variable on Windows object
- If cfg is a fuction, tis is invoked and parsed
- Finally, if is an object, cfg is inmediatly returned
Parameters
Returns
dist/filters/helpers/common/areFiltersEquals.js
areFiltersEquals(filter1, filter2)
Validates if both filters are the same
Parameters
| filter1 | | filter 1 | Â |
| filter2 | | filter 2 | Â |
Returns
- true: the filters are equal; false: the filters are NOT equal
dist/filters/helpers/common/excludeFiltersByAggregateColumn.js
excludeFiltersByAggregateColumn(filterData)
Excludes Aggregate Filters in the Filter Data. Excluding filters when the column.aggregate is included.
Parameters
| filterData | | The filter data object | Â |
Returns
- The new filter data object that were excluded the aggregate filters
dist/filters/helpers/common/excludeFiltersByParams.js
excludeFiltersByParams(filterData, params)
Excludes filters from the given Filters.
The validation to filter the stored filter is depending on:
- Column
- Qrvey ID
- Scope type
- Scope ID
- Panel ID
- Validator type
- Property type
- Enabled flags
Parameters
| filterData | | The Filter Data or the UI Filter Data | Â |
| params | | given parameters to validate the filter data | Â |
Returns
- a new Filter object structure
dist/filters/helpers/common/excludeFiltersByScopes.js
excludeFiltersByScopes(filterData, scopes)
Excludes and returns a filter data without filters by the given scopes
Parameters
| filterData | | The Filter Data | Â |
| scopes | | collection of scopes to be as filtering parameters | Â |
Returns
- The new Filter Data without filters by the given scopes.
dist/filters/helpers/common/getFilterColumnLabel.js
getFilterColumnLabel(column)
Get an string of the properties of the given filter column.
Parameters
Returns
- an string with the property, aggregate or calculation label.
dist/filters/helpers/common/getFilterLabel.js
getFilterLabel(filter)
Gets the Filter Label + Column label
Parameters
Returns
dist/filters/helpers/common/getFilterid.js
getFilterid(filter)
Get the Filter ID by the filter structure
The order of the epression ID is:
- Scope Type
- scopeid
- qrveyid
- panelid
- columnid
- validator
- property
- Column Aggregate
- Column Calculation
- Optional Index
Parameters
| filter | | the filter structure | Â |
Returns
- a text to identify the filter
dist/filters/helpers/common/getFiltersByAggregateColumn.js
getFiltersByAggregateColumn(filterData)
Gets Aggregate Filters in the Filter Data. Gets the filters when the column.aggregate is included.
Parameters
| filterData | | The filter data object | Â |
Returns
- The new filter data object that were get the aggregate filters
dist/filters/helpers/common/getFiltersByDatasetsColumns.js
getFiltersByDatasetsColumns(data, datasets)
Filtering the filters by the columns of datasets.
Module specially for CLS.
Parameters
| data | | the filter data | Â |
| datasets | | the collection of datasets and their columns | Â |
Returns
- A new filter data with the filtered filters by columns
dist/filters/helpers/common/getFiltersByParams.js
getFiltersByParams(filterData, params)
Gets filters from the given params.
The validation to filter the stored filter is depending on:
- Column
- Qrvey ID
- Scope type
- Scope ID
- Panel ID
- Validator type
- Property type
- Enabled flags
Parameters
| filterData | | The Filter Data or the UI Filter Data | Â |
| params | | given parameters to validate the dataset | Â |
Returns
- a new Filter object structure
dist/filters/helpers/common/getFiltersByScopes.js
getFiltersByScopes(filterData, scopes)
Filters and gets a Filter Data by the given scopes
Parameters
| filterData | | The Filter Data | Â |
| scopes | | collection of scopes types | Â |
Returns
dist/filters/helpers/common/getFiltersByTimezone.js
getFiltersByTimezone(filterData, timezone)
Gets and transforms the Filter Data by the Timezone object
Parameters
| filterData | IFSData IFUData | the filter data | Â |
| timezone | IDTimezone | the timezone object | Â |
Returns
IFSData IFUData the new filter data with the transformed datetime values
dist/filters/helpers/common/getFiltersByVisibility.js
getFiltersByVisibility(filterData, scopes)
Get a new Filter Data by filtering scopes/scope IDs and enabled flags
Parameters
| filterData | | a Filter Data or UI Filter Data | Â |
| scopes | | a Scopes/Scope IDs array | Â |
Returns
dist/filters/helpers/common/getFiltersByScopesIds.js
getFiltersByScopesIds(filterData, scopes)
Gets filters from Filter Data by Scopes/Scope IDs.
Parameters
| filterData | | The filter data | Â |
| scopes | | The collection of Scopes/Scope IDs | Â |
Returns
Transforms the given MergeFilters settings object. Adds the missing properties if they do not exist.
Parameters
| settings | | an object to the MergeFilters settings | Â |
Returns
- a new MergeFilters settings object.
dist/filters/helpers/common/getParamsToGetFilterSettings.js
getParamsToGetFilterSettings(settings)
Transforms the given ParamsToGetFilter settings object. Adds the missing properties if they do not exist.
Parameters
| settings | | an object to the ParamsToGetFilter settings | Â |
Returns
- a new ParamsToGetFilter settings object.
dist/filters/helpers/common/getMergeValuesSettings.js
getMergeValuesSettings(settings)
Transforms the given MergeFilters settings object. Adds the missing properties if they do not exist.
Parameters
| settings | | an object to the MergeFilters settings | Â |
Returns
- a new MergeFilters settings object.
dist/filters/helpers/common/getValuesFromDataset.js
getValuesFromDataset(props)
Gets the values from the model object that will be used to filter. Static values are values to belong from static values questions. Static values questions are questions that do not need request an info from backend, instead the info is got from Model object.
Parameters
| props | | Configuration to get static values from the given dataset. | Â |
Returns
dist/filters/helpers/common/getValuesFromModel.js
getValuesFromModel(props)
Gets the values from the model object that will be used to filter. Static values are values to belong from static values questions. Static values questions are questions that do not need request an info from backend, instead the info is got from Model object.
Parameters
| props | | Configuration to get static values from the given model. | Â |
Returns
dist/filters/helpers/common/getVerboseFilterDatasets.js
getVerboseFilterDatasets(filters, settings)
Gets an string that describes the filter datasets content
Parameters
| filters | Array.<IFUDataset> | The filter datasets to verbose | Â |
| settings | IFFGetVerboseFilters | the settings to the function | Â |
Returns
- the description of the datasets array
getDatasets(filters, settings)
Gets the datasets by some conditions
Parameters
| filters | Array.<IFUDataset> | The filtered datasets to verbose | Â |
| settings | IFFGetVerboseFilters | the settings to the function | Â |
Returns
Array.<IFUDataset> the collection of the datasets
getTitle(dataset, settings)
Gets the title of the filter dataset
Parameters
| dataset | IFUDataset | the filter dataset object | Â |
| settings | IFFGetVerboseFilters | the settings to the function | Â |
Returns
string the title of the filter dataset
getTitleSeparator(settings)
Gets the separators for the title. It would be
- New Line
- An string from argument
Parameters
| settings | IFFGetVerboseFilters | the settings of the module | Â |
Returns
string the string of the separator
getSeparator(settings)
Gets the separators of each filter. It would be
- New Line
- The operator
- An string from argument
Parameters
| settings | IFFGetVerboseFilters | the settings of the module | Â |
Returns
string the string of the separator
dist/filters/helpers/common/getVerboseFilterFilters.js
getVerboseFilterFilters(filters, settings)
Gets an string that describes the filter filters content
Parameters
| filters | Array.<IFUFilter> | The filter filters to verbose | Â |
| settings | IFFGetVerboseFilters | the settings to the function | Â |
Returns
- the description of the filters array
getFilters(filters, settings)
Gets the filters by some conditions
Parameters
| filters | Array.<IFUFilter> | The filtered filters to verbose | Â |
| settings | IFFGetVerboseFilters | the settings to the function | Â |
Returns
Array.<IFUFilter> the collection of the filters
getTitle(filter, settings)
Gets the title of the filter
Parameters
| filter | IFUFilter | the filter object | Â |
| settings | IFFGetVerboseFilters | the settings to the function | Â |
Returns
string the title of the filter
getSeparator(currentIndex, filter, settings)
Gets the separators of each filter. It would be
- New Line
- The operator
- An string from argument
Parameters
| currentIndex | number | the iteration index of the value | Â |
| filter | IFUFilter | the filter object | Â |
| settings | IFFGetVerboseFilters | the settings of the module | Â |
Returns
string the string of the separator
getTitleSeparator(settings)
Gets the separators for the title. It would be
- New Line
- An string from argument
Parameters
| settings | IFFGetVerboseFilters | the settings of the module | Â |
Returns
string the string of the separator
dist/filters/helpers/common/getVerboseFilterValues.js
getVerboseFilterValues(filters, settings)
Gets an string that describes the filter values content
Parameters
| filters | Array.<IFValue> | The filter values to verbose | Â |
| settings | IFFGetVerboseFilters | the settings to the function | Â |
Returns
- the description of the filter values
getValues(filter, settings)
Gets the value collection of the filter by some conditions
Parameters
| filter | IFValue | The filter to get the values | Â |
| settings | IFFGetVerboseFilters | the settings to the function | Â |
Returns
Array.<string> the collection of the filter values
getSeparator(currentIndex, values, settings)
Gets the separators of each values. It would be
- New Line
- The operator
- An string from argument
Parameters
| currentIndex | number | the iteration index of the value | Â |
| values | Array.<IFUValue> | the collection of values | Â |
| settings | IFFGetVerboseFilters | the settings of the module | Â |
Returns
string the string of the separator
getValue(filter, value)
Gets the value according to the filter info
- When the filter column type is image the URL should be returned in case value is undefined.
Parameters
| filter | IFUFilter | the filter object | Â |
| value | IFUValue | the value item | Â |
Returns
string the resulting value
dist/filters/helpers/common/getVerboseFilters.js
getVerboseFilters(filters, settings)
Gets an string that describes the filter data content
Parameters
| filters | IFUData | The filters object to verbose | Â |
| settings | IFFGetVerboseFilters | the settings for the function | Â |
Returns
getVerboseFilterDatasetsSettings(settings)
Gets the dataset settings by the given settings
Parameters
| settings | IFFGetVerboseFilters | the settings for the function | Â |
Returns
Gets the filter settings by the given settings
Parameters
| settings | IFFGetVerboseFilters | the settings for the function | Â |
Returns
getVerboseFilterScopesSettings(settings)
Gets the scope settings by the given settings
Parameters
| settings | IFFGetVerboseFilters | the settings for the function | Â |
Returns
getVerboseFilterValuesSettings(settings)
Gets the value settings by the given settings
Parameters
| settings | IFFGetVerboseFilters | the settings for the function | Â |
Returns
dist/filters/helpers/common/haveFiltersByDataset.js
haveFiltersByDataset(filterData, qrveyid)
Validates if the filter data has filters by a dataset ID (Qrvey ID).
Parameters
| filterData | | the filter data or the UI filter data. | Â |
| qrveyid | | The Qrvey ID | Â |
Returns
- true: the filter data has filters by the Qrvey ID
dist/filters/helpers/common/isBetweenValidator.js
isBetweenValidator(validator)
Validates if the given validator is a Between type
Parameters
Returns
- true: it is a between validator; false: it is not a between validator
dist/filters/helpers/common/getVerboseFilterScopes.js
getVerboseFilterScopes(filters, settings)
Gets an string that describes the filter scopes content
Parameters
| filters | Array.<IFUScope> | The filters scopes to verbose | Â |
| settings | IFFGetVerboseFilters | the settings to the function | Â |
Returns
getScopes(filters, settings)
Gets the scopes by some conditions
Parameters
| filters | Array.<IFUScope> | The filtered scopes to verbose | Â |
| settings | IFFGetVerboseFilters | the settings to the function | Â |
Returns
Array.<IFUScope> the collection of the scopes
getTitle(scope, settings)
Gets the title of the filter scope
Parameters
| scope | IFUScope | the filter scope info | Â |
| settings | IFFGetVerboseFilters | the settings of the function | Â |
Returns
string the title of the filter scope
getTitleSeparator(settings)
Gets the separators for the title. It would be
- New Line
- An string from argument
Parameters
| settings | IFFGetVerboseFilters | the settings of the module | Â |
Returns
string the string of the title separator
getSeparator(settings)
Gets the separators of each filter. It would be
- New Line
- The operator
- An string from argument
Parameters
| settings | IFFGetVerboseFilters | the settings of the module | Â |
Returns
string the string of the separator
dist/filters/helpers/common/isDateDistinctProperty.js
isDateDistinctProperty(column, property)
Determines if the filter column and property is a distinct group dates type
Parameters
| column | | The filter column | Â |
| property | | The filter property | Â |
Returns
- True if the given property is included from distinct group dates type
dist/filters/helpers/common/isInValidator.js
isInValidator(validator)
Validates if the given validator is a In type
Parameters
Returns
- true: it is a In validator; false: it is not a In validator
dist/filters/helpers/common/isRangeValidator.js
isRangeValidator(validator)
Validates if the given validator is a Range type. Range type means the value has min and max values to filter
Parameters
| validator | | The filter validator | Â |
Returns
- true: it is a range validator
dist/filters/helpers/common/isRankingFilter.js
isRankingFilter(filter)
Validates if the given filter is considering a ranking filter type.
- Filters with Null and Is Not Null for ranking column are not considering as Ranking Filters.
Parameters
Returns
- a true if the filter is a ranking filter.
dist/filters/helpers/common/isNullValidator.js
isNullValidator(validator)
Checks if the given validator is a Null type.
Parameters
| validator | | The Filter Validator | Â |
Returns
- True: It is a Null Validator; False: It is not a Null Validator.
dist/filters/helpers/common/isRegularValidator.js
isRegularValidator(validator)
Validates if the given validator is a regular type. Regular type means the filter object has a value as string to filter
Parameters
| validator | | The filter validator | Â |
Returns
- true: it is a range validator
dist/filters/helpers/common/mergeValues.js
mergeValues(filter1, filter2, settings)
Gets a new value structure array by merging two value structures
Parameters
| filter1 | | the target filter structure | Â |
| filter2 | | the filter to be used to merge the values | Â |
| settings | | configuration of the mergeFilter | Â |
Returns
- a new value structure array
dist/filters/helpers/common/mergeFilters.js
mergeFilters(filterData1, filterData2, settings)
Merges the second filter data into the first one; the first Filter Data passed in the argument has the priority.
Conditions:
- If the info in the second filter data does not exist in the first one, the info will be added
- If the info in the second filter data exists in the first one, the info will be merged
Parameters
| filterData1 | IFUData | The target filter data | Â |
| filterData2 | IFUData | the filter data to be merged | Â |
| settings | IFFiltersMergeFilters | configuration of the mergeFilters | Â |
Returns
IFUData a new filter data structure
mergeScopes(scopes1, scopes2, settings)
Gets a new scope array structure by merging both scope structures
- If the info in the second scope does not exist in the first one, the scope will be added
- If the info in the second scope exists in the first one, the scope will be merged
Parameters
| scopes1 | Array.<IFUScope> | the target scope structure | Â |
| scopes2 | Array.<IFUScope> | the scope to be merged | Â |
| settings | IFFiltersMergeFilters | configuration of the mergeFilters | Â |
Returns
Array.<IFUScope> a new scope array structure
mergeDatasets(datasets1, datasets2, settings)
Gets a new dataset structure array by merging both dataset structures
- If the info in the second dataset does not exist in the first one, the dataset will be added
- If the info in the second dataset exists in the first one, the dataset will be merged
Parameters
| datasets1 | Array.<IFUDataset> | the target dataset structure | Â |
| datasets2 | Array.<IFUDataset> | the dataset to be merged | Â |
| settings | IFFiltersMergeFilters | configuration of the mergeFilter | Â |
Returns
Array.<IFUDataset> a new dataset structure array
Gets a new filter structure array by merging two filter structures
Parameters
| filters1 | Array.<IFUFilter> | the target filter structure | Â |
| filters2 | Array.<IFUFilter> | the filter to be merged | Â |
| settings | IFFiltersMergeFilters | configuration of the mergeFilters | Â |
Returns
Array.<IFUFilter> a new filter structure array
mergeScopeProps(scope1, scope2, settings)
Gets a new scope structure for the configured settings
Parameters
| scope1 | IFUScope | the target scope structure | Â |
| scope2 | IFUScope | the scope to be used to merge the values | Â |
| settings | IFFiltersMergeFilters | configuration of the mergeFilters | Â |
Returns
IFUScope a new filter structure with overwritted props
mergeDatasetProps(dataset1, dataset2, settings)
Gets a new dataset structure for the configured settings
Parameters
| dataset1 | IFUDataset | the target dataset structure | Â |
| dataset2 | IFUDataset | the dataset to be used to merge the values | Â |
| settings | IFFiltersMergeFilters | configuration of the mergeFilters | Â |
Returns
IFUDataset a new filter structure with overwritted props
mergeFilterProps(filter1, filter2, settings)
Gets a new filter structure for the configured settings
Parameters
| filter1 | IFUFilter | the target filter structure | Â |
| filter2 | IFUFilter | the filter to be used to merge the values | Â |
| settings | IFFiltersMergeFilters | configuration of the mergeFilters | Â |
Returns
- a new filter structure with overwritted props
dist/filters/helpers/common/resolveDatasetConditions.js
resolveDatasetConditions(filter, params, letPassUndefinedProperties, letPassUndefinedParams)
Resolves the conditions by given params
Parameters
| filter | | The dataset structure | Â |
| params | | given parameters to validate the dataset | Â |
| letPassUndefinedProperties | | Flag to avoid applying the condition when the filter properties are undefined | Â |
| letPassUndefinedParams | | Flag to avoid applying the condition when the param properties are explicit undefined. | Â |
Returns
- true: the condition is satisfied
dist/filters/helpers/common/resolveFilterConditions.js
resolveFilterConditions(filter, params, letPassUndefinedProperties, letPassUndefinedParams)
Resolves the conditions by given params
Parameters
| filter | | The filter | Â |
| params | | given parameters to validate the filter | Â |
| letPassUndefinedProperties | | Flag to avoid applying the condition when the filter properties are undefined | Â |
| letPassUndefinedParams | | Flag to avoid applying the condition when the param properties are explicit undefined. | Â |
Returns
- true: the condition is satisfied
dist/filters/helpers/common/resolveScopeConditions.js
resolveScopeConditions(filter, params, letPassUndefinedProperties, letPassUndefinedParams)
Resolves the conditions by given params
Parameters
| filter | | The filter scope structure | Â |
| params | | given parameters to validate the filter | Â |
| letPassUndefinedProperties | | Flag to avoid applying the condition when the properties of the properties are undefined | Â |
| letPassUndefinedParams | | Flag to avoid applying the condition when the properties of the params are explicit undefined. | Â |
Returns
- true: the condition is satisfied
dist/dates/relative/helpers/formatStatement.js
formatStatement(statement)
Build a proper relative date statement type
Parameters
| statement | RelativeStatement | | Â |
Returns
dist/dates/relative/helpers/getStatementCase.js
getStatementCase(includeCurrent, isCalendarDate)
Returns a number/constant that identifies a relative date case
Parameters
| includeCurrent | boolean | | Â |
| isCalendarDate | boolean | | Â |
Returns
dist/dates/relative/helpers/parseDate.js
parseDate(date)
Parses a string date and returns a dayjs date
Parameters
Returns
dist/filters/helpers/builder/getFilterBuilderGeneralConfig.js
getFilterBuilderGeneralConfig(config)
Returns a filter builder config object by a any given config
Parameters
Returns
- The filter builder config object
dist/filters/helpers/backend/buildExpression.js
buildExpression(filter)
Builds filter expression by the filter data.
- If the resulting value array is empty the enabled property will be false.
Parameters
| filter | | The filter to transform | Â |
Returns
dist/filters/helpers/backend/buildUserFilters.js
buildUserFilters(userFilters)
Transform user Filters array into Filter Logic structure
Parameters
| userFilters | | The filters that the user defined. | Â |
Returns
- The filter logic for the given user filters. if No a given object is recieved, it will return an empty array.
dist/filters/helpers/backend/getAggFiltersBySummaryIndex.js
getAggFiltersBySummaryIndex(aggFilters, summaryIndex)
Parameters
| aggFilters | | The aggFilter Structure | Â |
| summaryIndex | | an index | Â |
Returns
- a new aggFilters structure
dist/filters/helpers/backend/getBackendGroupValue.js
getBackendGroupValue(filter)
Gets a group value for the backend logic structure
Parameters
Returns
dist/filters/helpers/backend/getBackendProperty.js
getBackendProperty(filter)
Gets a property for the logic structure
Parameters
Returns
dist/filters/helpers/backend/getBackendValidator.js
getBackendValidator(validator)
Gets the Validator that is used in requests
Parameters
| validator | | Filter Validator used in UI | Â |
Returns
- Filter Validator used in Backend
dist/filters/helpers/backend/getBackendValues.js
getBackendValues(filter)
Gets the expresion values in the logic format
Parameters
| filter | | The filter structure | Â |
Returns
- A collection of backend expression value
getResultValues(values, filter) private method
Gets the expression values. Depending on the column type
Parameters
| values | | a collection of filter values | Â |
| filter | | The filter structure | Â |
Returns
getRankingValues(values, rankingGroupIndex) private method
Gets the Ranking values.
Parameters
| values | | a collection of filter values in the ranking structure | Â |
| rankingGroupIndex | | determine the value by this index to build and return it | Â |
Returns
- Expression values for ranking
dist/filters/helpers/backend/getLogicByDatasets.js
getLogicByDatasets(logic, datasets)
[TODO: Add filterEmptyArrays to the filterNestedTree filter condition. Firstly, that function should accept this argument]
Filters the logic by a qrveyids array
If an qrveyid is not provided in the expression the filter passes normally
Parameters
| logic | | The logic of the filter | Â |
| datasets | | The collection of qrveyids | Â |
Returns
dist/filters/helpers/backend/getLogicByDatasetsColumns.js
getLogicByDatasetsColumns(logic, datasets)
Parameters
| logic | Array.<IFBLogic> | The logic of the filters | Â |
| datasets | Array.<IDataset> | The collection of datasets | Â |
Returns
filterCallback(settings, datasets)
Runs the function for the callback
Parameters
| settings | IFFGetLogicByDatasetsColumns | the settings for the helper | Â |
| datasets | Array.<IDataset> | The dataset collection | Â |
Returns
getLetQrveyidPass(expression, settings)
Gets the letQrveyidPass flag
Parameters
| expression | IFBExpression | the logic expression of the filter | Â |
| settings | IFFGetLogicByDatasetsColumns | the settings for the helper | Â |
Returns
boolean true: the qrveyid will be passed
getLetQuestionidPass(expression, settings)
Gets the letQuestionidPass flag
Parameters
| expression | IFBExpression | the logic expression of the filter | Â |
| settings | IFFGetLogicByDatasetsColumns | the settings for the helper | Â |
Returns
boolean true: the questionid will be passed
getDataset(expression, letQrveyidPass, datasets)
Gets the dataset related to the expression
Parameters
| expression | IFBExpression | the logic expression of the filter | Â |
| letQrveyidPass | boolean | flag that allows perform the condition to compare the qrveyid with the datasets | Â |
| datasets | Array.<IDataset> | The dataset collection | Â |
Returns
IDataset the dataset object
getGetLogicByDatasetsSettings(settings)
Gets the default settings for the getLogicByDatasetsColumn function
Parameters
| settings | IFFGetLogicByDatasetsColumns | the settings for the helper given by the implementer | Â |
Returns
IFFGetLogicByDatasetsColumns an object with all properties set
dist/filters/helpers/backend/getLogicByScopes.js
getLogicByScopes(logics, scopes)
Gets the filters from logic data by Scopes/Scope IDs.
Parameters
| logics | | The logic array | Â |
| scopes | | The collection of Scopes/Scope IDs | Â |
Returns
dist/filters/helpers/backend/getLogicByScopesHierarchy.js
getLogicByScopesHierarchy(filterData, scopes, currentScope)
Gets filters from the logic by the scopes hierarchy.
Parameters
| filterData | | | Â |
| scopes | | | Â |
| currentScope | | | Â |
Returns
areMultipleScopesByProperties(settings, scopeProperties, condition)
Validates if the scope settings is satisfied by properties in multiple scopes
Parameters
| settings | IFSettings | the filter setting | Â |
| scopeProperties | string | the property or the string path of the scope settings | Â |
| condition | string | validate with AND or OR condition | Â |
Returns
- true iif there are scopes to be satisfied; false: one or none scopes to be satisfied
areMultipleScopesByProperty(settings, property)
Validates if the scope settings is satisfied the property in multiple scopes
Parameters
| settings | IFSettings | the filter setting | Â |
| property | string | the property or the string path of the scope settings | Â |
Returns
- true if there are scopes to be satisfied; false: one or none scopes to be satisfied
getFilterSettings(filterSettings, allowedScopes, otherSettings)
Gets a new filter settings object according to various conditions
- By allowed scopes. Different implementation could accept some scopes, so the forbidden scopes into the filter settings will be skipped
- If there is not filter settings provived, a default one is returned
- The returned filter settings depend on the coexisting scopes
Parameters
| filterSettings | IFSettings | the given filter settings | Â |
| allowedScopes | Array.<IFScope> | a collection of scope types that are permitted | Â |
| otherSettings | IFSettings | another filter settings object to be merged with the filterSettings param | Â |
Returns
- a new filter settings object
getFilterSettingsByMultipleScopes(settings, allowedScopes)
Gets the filter settings by multiple scopes conditions
Parameters
| settings | IFSettings | the given filter settings | Â |
| allowedScopes | Array.<IFScope> | a collection of scope types that are permitted | Â |
Returns
- a new filter settings object
getFilterSettingsByOnlyScope(settings, allowedScopes)
Gets the filter settings when a single scope is permitted
Parameters
| settings | IFSettings | the given filter settings | Â |
| allowedScopes | Array.<IFScope> | a collection of scope types that are permitted | Â |
Returns
- a new filter settings object
getFilterSettingsByNoScopes(settings)
Gets the filter settings when there is not scope to accept
Parameters
| settings | IFSettings | the given filter settings | Â |
Returns
- a new filter settings object
getFilterSettingsByGeneralOnlyScope(settings)
Gets the filter settings when a general scope are only permitted
The general scopes could be the GLOBAL, PAGE, TAB and PANEL types.
Parameters
| settings | IFSettings | the given filter settings | Â |
Returns
- a new filter settings object
getFilterSettingsByNoDefaultScope(settings)
Gets the filter settings when there is not a default scope type
Parameters
| settings | IFSettings | the given filter settings | Â |
Returns
- a new filter settings object
getFilterSettingsByOnlyDefaultScope(settings)
Gets the filter settings when there is only a default scope type
Parameters
| settings | IFSettings | the given filter settings | Â |
Returns
- a new filter settings object
getFilterSettingsByDefaultWithOneAdditionalScope(settings)
Gets the filter settings when there are a default scope and other single scope
Parameters
| settings | IFSettings | the given filter settings | Â |
Returns
- a new filter settings object
getFilterSettingsByOnlyPanelScope(settings)
Gets the filter settings when there is only the panel scope
Parameters
| settings | IFSettings | the given filter settings | Â |
Returns
- a new filter settings object
getFilterSettingsByOnlyDataScope(settings)
Gets the filter settings when there is only the data scope
Parameters
| settings | IFSettings | the given filter settings | Â |
Returns
- a new filter settings object
getFilterSettingsBySkippingGeneralScopes(settings)
Gets the filter settings when there are not general scopes allowed
The general scopes could be the GLOBAL, PAGE, TAB and PANEL types.
Parameters
| settings | IFSettings | the given filter settings | Â |
Returns
- a new filter settings object
getFilterSettingsByMultipleNoPanelGlobalScopes(settings)
Gets the filter settings when there are no panel scopes and multiple scopes allowed.
Parameters
| settings | IFSettings | the given filter settings | Â |
Returns
- a new filter settings object
getFilterSettingsByMultipleNoPanelScopes(settings)
Gets the filter settings when there are no panel scopes and multiple scopes allowed.
Parameters
| settings | IFSettings | the given filter settings | Â |
Returns
- a new filter settings object
getScopeSettings(settings, scope)
Gets the scope settings by the scope type
Parameters
| settings | IFSettings | the filter settings | Â |
| scope | IFScope | the scope type | Â |
Returns
getScopeColorSetting(settings, scope)
Gets the color of the scope in the settings object
Parameters
| settings | IFSettings | the filter settings | Â |
| scope | IFScope | the scope type | Â |
Returns
- an string with the color.
getScopesSettings(scopes)
Gets the scopes settings as array
Parameters
| scopes | IFSettingsScopes | the scopes settings | Â |
Returns
- an array of the scopes settings
getScopesToDisplay(settings)
Gets the scope allowed to display
Parameters
| settings | IFSettings | the filter settings | Â |
Returns
- an array of the scopes settings
isLeastSingleScopeByProperties(settings, scopeProperties, condition)
Validates if the scope settings is satisfied by properties at least in one scope
Parameters
| settings | IFSettings | the filter setting | Â |
| scopeProperties | string | the property or the string path of the scope settings | Â |
| condition | string | validate with AND or OR condition | Â |
Returns
- true if there is one scope to be satisfied; false: none scopes to be satisfied
isLeastSingleScopeByProperty(settings, property)
Validates if the scope settings is satisfied by a property at least in one scope
Parameters
| settings | IFSettings | the filter setting | Â |
| property | string | the property or the string path of the scope settings | Â |
Returns
- true if there is one scope to be satisfied; false: none scopes to be satisfied
dist/filters/helpers/ui/excludeUIFiltersByAggregate.js
excludeUIFiltersByAggregate(uFilters)
Excludes Aggregate Filters in the Flattened UI Filters array
Parameters
| uFilters | | Collection of Flat UI Filters | Â |
Returns
- a new Flat UI Filters that were excluded the aggregate filters
dist/filters/helpers/ui/excludeUIFlatFiltersByScopes.js
excludeUIFlatFiltersByScopes(uFilters, scopes)
Excludes and returns a UI Flat Filters without filters by the given scopes
Parameters
| uFilters | | The Flatten UI Filters | Â |
| scopes | | collection of scopes types | Â |
Returns
- The new array of UI Flattened filters
dist/filters/helpers/ui/getFilterPropertyLabel.js
getFilterPropertyLabel(filter)
Gets the label of the filter property
Parameters
Returns
- a string of the filter property label
dist/filters/helpers/ui/getOutputFormatByColumn.js
getOutputFormatByColumn(column, datasets)
Gets output format object from Datasets by the given column. Item of the datasets array must have outputformat item in order to be returned
Parameters
| column | | The column | Â |
| datasets | | array of datasets | Â |
Returns
dist/filters/helpers/ui/getQrveyIdsByUIFilters.js
getQrveyIdsByUIFilters(uiFilter)
Gets a collection of Qrvey IDs in the UI Filter structure.
Looks around all filter structure finding the qrveyid propertty in each dataset
Parameters
Returns
dist/filters/helpers/ui/getUIFlatFilterByParams.js
getUIFlatFilterByParams()
Gets a filter from the given Flattened UI Filters by given params. Return a index of the array or an object
The validation to filter the stored filter is depending on:
- Column
- Qrvey ID,
- Scope type
- Scope ID
- Panel ID
- Validator type
- Property type
Returns
- The index of the uFilter array or the Filter object s
dist/filters/helpers/ui/getUIFlatFiltersByParams.js
getUIFlatFiltersByParams()
Gets a filter from the given Flattened UI Filters by given params. Return a index of the array or an object
The validation to filter the stored filter is depending on:
- Column
- Qrvey ID,
- Scope type
- Scope ID
- Panel ID
- Validator type
- Property type
- Enabled flags
Returns
- The index of the uFilter array or the Filter object s
dist/filters/helpers/ui/getUIFlatFiltersByScopes.js
getUIFlatFiltersByScopes(uFilters, scopes)
Filters and gets a UI Flatten Filters by the given scopes
Parameters
| uFilters | | The Flatten UI Filters | Â |
| scopes | | collection of scopes types | Â |
Returns
- The new array of UI Flattened filters
dist/filters/helpers/ui/getUIValues.js
getUIValues(filter, settings)
Gets the UI Values generated depending on the validator
Parameters
| filter | | the filter structure | Â |
| settings | | a settings for this function | Â |
Returns
dist/filters/helpers/ui/getUpdatedUIFilters.js
getUpdatedUIFilters(data, datasets)
Gets a new UI Filter structure with a datasets/columns info updates
Parameters
| data | | The UI Filter structure | Â |
| datasets | | An array of datasets/column info used for updating the data | Â |
Returns
- A new UI FIlter structure
dist/filters/helpers/ui/resolveUIFlatFilterByParams.js
resolveUIFlatFilterByParams(filter, params)
Resolves conditions between UI flattened filter and given parameters
Parameters
| filter | | UI Flatten Filter | Â |
| params | | Parameters to validate | Â |
Returns
- true: the conditions are satisfied.
Documentation generated with doxdox.