Methods

[undefined](event)

Parameters:
NameTypeDescription
eventEvent

[undefined](event)

Parameters:
NameTypeDescription
eventEvent

[undefined](event)

Parameters:
NameTypeDescription
eventEvent

[undefined](event)

Parameters:
NameTypeDescription
eventEvent

[undefined](event)

Parameters:
NameTypeDescription
eventEvent

[undefined](event)

Parameters:
NameTypeDescription
eventEvent

[undefined](event)

Parameters:
NameTypeDescription
eventEvent

[undefined](event)

Parameters:
NameTypeDescription
eventEvent

[undefined](event)

Parameters:
NameTypeDescription
eventEvent

[undefined](event)

Parameters:
NameTypeDescription
eventEvent

[undefined](event)

Parameters:
NameTypeDescription
eventEvent

buildPagination(current, max) → {object}

Parameters:
NameTypeDescription
current
max
Returns:
Type: 
object

calculateDateRangeFromToday(date, unit) → {number}

function, that calculates starting from a date a range of days, months, weeks or years

.

function, that calculates starting from a date a range of days, months, weeks or years

Parameters:
NameTypeDescription
datestring
unitstring

(day, month, year, week)

Returns:

range

Type: 
number
Example
// if today is 2020-10-12
calculateDateRangeFromToday("2020-10-12", "days") // 0
calculateDateRangeFromToday("2020-10-13", "days") // 1
calculateDateRangeFromToday("2020-12-14", "days") // 63
calculateDateRangeFromToday("2020-10-12", "months") // 0
calculateDateRangeFromToday("2020-11-12", "months") // 1
calculateDateRangeFromToday("2021-10-12", "months") // 11

callControlCallback(callBackFunctionName, …args) → {any}

Parameters:
NameTypeAttributesDescription
callBackFunctionNamestring
args*<repeatable>
Returns:
Type: 
any

clearObjectStore() → {Promise.<unknown>}

Returns:
Type: 
Promise.<unknown>

createBracketedKeyValueHash(object, addHashPrefix) → {string}

Creates a hash selector string from an object.

Creates a hash selector string from an object.

Parameters:
NameTypeDefaultDescription
objectObject

The object containing selectors and key-value pairs.

addHashPrefixbooleantrue

Whether to add the hash prefix # to the beginning of the string.

Since
  • 3.37.0
Returns:

The hash selector string.

Type: 
string

escapeAttributeValue(input) → {*}

Parameters:
NameTypeDescription
inputstring
Returns:
Type: 
*

executeAPIButton(event, button, element)

Parameters:
NameTypeDescription
eventEvent
buttonHTMLElement
elementMonster.Components.Form.ApiButton

generateUniqueConfigKey(componentName, id, prefix) → {string}

Generate a unique configuration key based on the current browser location, component name, id, and a prefix.

Generate a unique configuration key based on the current browser location, component name, id, and a prefix.

Parameters:
NameTypeDescription
componentNamestring

The name of the component.

idstring

A unique identifier for the component.

prefixstring

A prefix to use in the unique key.

Since
  • 3.55.0 the function remove the hash from the key
Returns:

The generated unique configuration key.

Type: 
string

getObjectStore(mode)

Parameters:
NameTypeDescription
modestring

either "readonly" or "readwrite"

getVisibilityFromSlotAttribute(element) → {boolean}

Parameters:
NameTypeDescription
elementHTMLElement
Returns:
Type: 
boolean

initFromCallbackHost()

Initializes the custom element based on the provided callback function.

Initializes the custom element based on the provided callback function.

This function is called when the element is attached to the DOM. It checks if the data-monster-option-callback attribute is set, and if not, the default callback initCustomControlCallback is called. The callback function is searched for in this element and in the host element. If the callback is found, it is called with the element as a parameter.

This:
  • CustomElement
Since
  • 1.8.0

initOptionsFromAttributes(element, options, mapping, prefix) → {Object}

Initializes the given options object based on the attributes of the current DOM element.

Initializes the given options object based on the attributes of the current DOM element. The function looks for attributes with the prefix 'data-monster-option-', and maps them to properties in the options object. It replaces the dashes with dots to form the property path. For example, the attribute 'data-monster-option-url' maps to the 'url' property in the options object.

With the mapping parameter, the attribute value can be mapped to a different value. For example, the attribute 'data-monster-option-foo' maps to the 'bar' property in the options object.

The mapping object would look like this: { 'foo': (value) => value + 'bar' // the value of the attribute 'data-monster-option-foo' is appended with 'bar' // and assigned to the 'bar' property in the options object. // e.g.

'bar.baz': (value) => value + 'bar' // the value of the attribute 'data-monster-option-bar-baz' is appended with 'bar' // and assigned to the 'bar.baz' property in the options object. // e.g.
}

This:
  • HTMLElement
Parameters:
NameTypeDefaultDescription
elementHTMLElement

The DOM element to be used as the source of the attributes.

optionsObject

The options object to be initialized.

mappingObject

A mapping between the attribute value and the property value.

prefixstringdata-monster-option-

The prefix of the attributes to be considered.

Since
  • 3.38.0
Returns:
  • The initialized options object.
Type: 
Object

parseBracketedKeyValueHash(hashString) → {Object}

Parses a string containing bracketed key-value pairs and returns an object representing the parsed result.

Parses a string containing bracketed key-value pairs and returns an object representing the parsed result.

  • The string starts with a hash symbol #.
  • After the hash symbol, there are one or more selector strings, separated by a semicolon ;.
  • Each selector string has the format selectorName(key1=value1,key2=value2,...).
  • The selector name is a string of one or more alphanumeric characters.
  • The key-value pairs are separated by commas , and are of the form key=value.
  • The key is a string of one or more alphanumeric characters.
  • The value can be an empty string or a string of one or more characters.
  • If the value contains commas, it must be enclosed in double quotes ".
  • The entire key-value pair must be URL-encoded.
  • The closing parenthesis ) for each selector must be present, even if there are no key-value pairs.
Parameters:
NameTypeDescription
hashStringstring

The string to parse, containing bracketed key-value pairs.

Since
  • 3.37.0
Returns:
  • An object representing the parsed result, with keys representing the selectors and values representing the key-value pairs associated with each selector. - Returns an empty object if there was an error during parsing.
Type: 
Object
Examples
```javascript
// Example 1:
const hashString = '#selector1(key1=value1,key2=value2);selector2(key3=value3)';
const result = parseBracketedKeyValueHash(hashString);
// result => { selector1: { key1: "value1", key2: "value2" }, selector2: { key3: "value3" } }
```
```javascript
// Example 2:
const hashString = '#selector1(key1=value1,key2=value2);selector2(';
const result = parseBracketedKeyValueHash(hashString);
// result => {}
```

setOptionFromAttribute(element, name, options, mapping, prefix) → {Object}

Set the given options object based on the attributes of the current DOM element.

Set the given options object based on the attributes of the current DOM element. The function looks for attributes with the prefix 'data-monster-option-', and maps them to properties in the options object. It replaces the dashes with dots to form the property path. For example, the attribute 'data-monster-option-url' maps to the 'url' property in the options object.

With the mapping parameter, the attribute value can be mapped to a different value. For example, the attribute 'data-monster-option-foo' maps to the 'bar' property in the options object.

The mapping object would look like this: { 'foo': (value) => value + 'bar' // the value of the attribute 'data-monster-option-foo' is appended with 'bar' // and assigned to the 'bar' property in the options object. // e.g.

'bar.baz': (value) => value + 'bar' // the value of the attribute 'data-monster-option-bar-baz' is appended with 'bar' // and assigned to the 'bar.baz' property in the options object. // e.g.
}

This:
  • HTMLElement
Parameters:
NameTypeDefaultDescription
elementHTMLElement

The DOM element to be used as the source of the attributes.

nameObject

The attribute object to be used as the source of the attributes.

optionsObject

The options object to be initialized.

mappingObject

A mapping between the attribute value and the property value.

prefixstringdata-monster-option-

The prefix of the attributes to be considered.

Since
  • 3.45.0
Returns:
  • The initialized options object.
Type: 
Object

updateMainFilterValueFromPopperChange(group, type)

Parameters:
NameTypeDescription
groupHTMLElement
typestring

updateOptionsFromArguments(options)

Parameters:
NameTypeDescription
optionsObject

updateOptionsFromArguments(options)

Parameters:
NameTypeDescription
optionsObject

updateOptionsFromArguments(options)

Parameters:
NameTypeDescription
optionsObject

Events

monster-action-button-show-dialog