mapp.ui.layers.filters[type](layer, filter)

The ui/layers/filters module exports a lookup object for the different layer filter type methods.

  • like
  • match
  • numeric
  • integer
  • in
  • ni
  • date
  • datetime
  • boolean
  • null

Methods

(inner) applyFilter(layer)

The applyFilter method is used to debounce the layer.reload() from filter. This is required in order to not fire layer [data] reload in quick succession by moving a slider element.

The reloadCallback method is provided as callback argument to the layer.reload()

The 'changeEnd' event is dispatched the layer.mapview in order to trigger the update of dataviews with the mapChange flag.

Parameters:
NameTypeDescription
layerObject

The layer to reload.

(inner) deleteFilter(layer, filter)

The deleteFilter function deletes the filter in the layer.filter.current object. And applies the changes to the layer.

Parameters:
NameTypeDescription
layerlayer

The layer to reload.

filterObject

The filter definition.

Properties
NameTypeDescription
layer.filterObject

The filter thats active on the layer.

filter.fieldObject

The field the filter works on.

filter.typeString

The filters' type e.g like, in, etc.

(inner) filter_boolean(layer, filter) → {HTMLElement}

Creates a checkbox element for filtering boolean values.

Parameters:
NameTypeDescription
layerObject

The layer object to apply the filter to.

filterObject

The filter configuration object.

Returns:

The checkbox element for boolean filtering.

Type: 
HTMLElement

(inner) filter_date(layer, filter) → {HTMLElement}

Creates input elements for filtering date values.

Parameters:
NameTypeDescription
layerObject

The layer object to apply the filter to.

filterObject

The filter configuration object.

Returns:

The input elements for date filtering.

Type: 
HTMLElement

(inner) filter_in(layer, filter) → {Promise.<HTMLElement>}

Filter interface elements for in and ni type layer filter are returned from the filter_in() method.

The method is async to wait for a distinct values query to populate the filter type [eg. in or ni] values array.

A list of checkbox elements will be returned as default interface without a dropdown, dropdown_pills, or searchbox flag.

Parameters:
NameTypeDescription
layerObject

Decorated MAPP Layer Object.

filterObject

The filter object.

Properties
NameTypeDescription
fieldstring

The filter field.

Properties
NameTypeAttributesDescription
filter.inArray<optional>

Array of values for in type filter.

filter.niArray<optional>

Array of values for ni type filter.

filter.dropdownBoolean<optional>

Create dropdown [pills] filter interface.

filter.dropdown_pillsBoolean<optional>

Create dropdown [pills] filter interface.

filter.searchboxBoolean<optional>

Create searchbox [pills] filter interface.

Returns:

Filter interface elements.

Type: 
Promise.<HTMLElement>

(inner) filter_null(layer, filter) → {HTMLElement}

Creates a checkbox element for filtering null values.

Parameters:
NameTypeDescription
layerObject

The layer object to apply the filter to.

filterObject

The filter configuration object.

Returns:

The checkbox element for null filtering.

Type: 
HTMLElement

(inner) filter_numeric(layer, filter) → {Promise.<HTMLElement>}

Returns numeric inputs and range slider element as UI for numeric layer filter.

Numeric layer filter are a combination of an LTE (less-than-[or]equal) and GTE (greater-than-[or]equal) filter for a field defined in a matching entry field.

Parameters:
NameTypeDescription
layerlayer

MAPP layer typedef object.

filterObject

Filter object.

Properties
NameTypeAttributesDescription
filter.fieldstring

Field to filter.

filter.minnumeric<optional>

Min bounds.

filter.maxnumeric<optional>

Max bounds.

filter.stepnumeric<optional>

Step for renage slider.

Returns:

The filter UI elements.

Type: 
Promise.<HTMLElement>

(inner) filter_text(layer, filter) → {HTMLElement}

Creates an input element for filtering text values.

Parameters:
NameTypeDescription
layerObject

The layer object to apply the filter to.

filterObject

The filter configuration object.

Returns:

The input element for text filtering.

Type: 
HTMLElement

(inner) generateMinMax(layer, filter)

Query the min and max values for a numeric filter field.

Parameters:
NameTypeDescription
layerlayer

MAPP layer typedef object.

filterObject

Filter object.

Properties
NameTypeAttributesDescription
filter.fieldstring

Field to filter.

filter.minnumeric<optional>

Min bounds.

filter.maxnumeric<optional>

Max bounds.

filter.minmax_querystring<optional>

Query template for min max values.

(inner) reloadCallback(layer) → {Object}

The reloadCallback renders the layer.style.legend. The legend may reflect changes to the layer.filter.current. The applyFilter method used debounce the layer.reload() provides the reloadCallback as callback argument.

Parameters:
NameTypeDescription
layerObject

The layer to reload.

Returns:

layer - To allow for functional compostion of itself.

Type: 
Object

(inner) removeFilter(layer, filter)

The removeFilter function removes the selected filter from the panel. Calls module:/ui/layers/filters~applyFilter once the card has been removed to update the layer.

Hides the clearAll and resetAll button if they are no more cards in the panel.

Parameters:
NameTypeDescription
layerlayer

The layer to reload.

filterObject

The filter definition.

Properties
NameTypeAttributesDescription
filter.cardHTMLElement<optional>

The html element of the filter.

filter.liHTMLElement<optional>

The list element if applicable.

(inner) resetFilter(layer, filter)

The resetFilter method deletes the filter and replaces the filter.card with a new card with initial filter config.

Parameters:
NameTypeDescription
layerlayer

The layer to reload.

filterObject

The filter definition.

Properties
NameTypeDescription
filter.cardHTMLElement

The html element of the filter.