DateRange

A date range filter control

Import
the javascript logo
import { DateRange } from "@schukai/monster/source/components/datatable/filter/date-range.mjs";
Source
the git logo
Package
Since
1.0.0

Purpose and scope

A date range filter control

This page documents the <monster-filter-date-range> custom element. Use the Usage examples for a working starting point and the API tab for the complete public contract.

When to use it

Use this module when its focused responsibility matches the surrounding workflow. Prefer its public options, properties, methods and events over reaching into rendered internals.

Date Range Filter

In this example, a simple filter with two filtering options is demonstrated. The example is not yet connected to a data source.

Javascript

//import '@schukai/monster/source/components/datatable/filter.mjs';<script type="module">//import '@schukai/monster/source/components/datatable/filter.mjs';</script>

HTML

<monster-datatable-filter>
    <!-- the attribute "data-monster-label" is used to define the label for the select element -->
    <!-- The text node inside the label is the label for the filter element -->
    <label data-monster-label="Input">Input Filter
        <monster-filter-input></monster-filter-input>
    </label>

    <!-- the next filter is hidden, because the attribute "slot" and the value "hidden" are used -->
    <label slot="hidden" data-monster-label="Date Range">Date Range Filter
        <monster-filter-date-range></monster-filter-date-range>
    </label>

</monster-datatable-filter>

Stylesheet

/** no additional stylesheet is defined **/
Open in playground

Advanced Date Ranges

In this example, we link the filter to a data source.

Javascript

//import '@schukai/monster/source/components/datatable/filter.mjs';<script type="module">//import '@schukai/monster/source/components/datatable/filter.mjs';</script>

HTML

<monster-datatable-filter>
    <!-- the attribute "data-monster-label" is used to define the label for the select element -->
    <!-- The text node inside the label is the label for the filter element -->
    <label data-monster-label="Input">Input Filter
        <monster-filter-input></monster-filter-input>
    </label>

    <!-- the next filter is hidden, because the attribute "slot" and the value "hidden" are used -->
    <label slot="hidden" data-monster-label="Date Range">Date Range Filter
        <monster-filter-date-range></monster-filter-date-range>
    </label>

</monster-datatable-filter>

Stylesheet

/** no additional stylesheet is defined **/
Open in playground

Component Design

monster-filter-date-range combines a filter trigger with a floating panel for entering lower and upper date boundaries.

Interaction

The trigger, popper, content, and filter areas remain separate so responsive layouts and focus handling can be styled without replacing the template.

Customizing With Parts

You can adapt the visual appearance through exported parts instead of modifying the internal template. This reference is generated from the current component source.

The component exposes these part names:

  • button: Primary interactive button.
  • content: Main content region.
  • control: Outer wrapper of the component.
  • filter: Element representing the filter.
  • popper: Floating popper container.

HTML Structure

<monster-filter-date-range></monster-filter-date-range>

JavaScript Initialization

const element = document.createElement('monster-filter-date-range');
document.body.appendChild(element);

Exported

DateRange

Derived from

AbstractBase

Options

The Options listed in this section are defined directly within the class. This class is derived from several parent classes, including the CustomElement class. Therefore, it inherits Options from these parent classes. If you cannot find a specific Options in this list, we recommend consulting the documentation of the AbstractBase.

Option
Type
Default
Description
object
templates
string
templates.main
object
labels
object
features
boolean
features.moreThan
boolean
features.within
boolean
features.today

  • since
  • deprecated

Properties and Attributes

The Properties and Attributes listed in this section are defined directly within the class. This class is derived from several parent classes, including the CustomElement class and ultimately from HTMLElement. Therefore, it inherits Properties and Attributes from these parent classes. If you cannot find a specific Properties and Attributes in this list, we recommend consulting the documentation of the AbstractBase.

  • data-monster-options: Sets the configuration options for the collapse component when used as an HTML attribute.
  • data-monster-option-[name]: Sets the value of the configuration option [name] for the collapse component when used as an HTML attribute.

Methods

The methods listed in this section are defined directly within the class. This class is derived from several parent classes, including the CustomElement class and ultimately from HTMLElement. Therefore, it inherits methods from these parent classes. If you cannot find a specific method in this list, we recommend consulting the documentation of the AbstractBase.

Behavioral methods

hideDialog()
Returns
  • {Monster.Datatable.Filter.Range}
No description available.
showDialog()
Returns
  • {Monster.Datatable.Filter.Range}
No description available.
toggleDialog()
Returns
  • {Monster.Datatable.Filter.Range}
No description available.

State query methods

value(value)
Parameters
  • value {*}: value
This is a method of [internal api](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals)
value()
Returns
  • {*}
No description available.

Static methods

[instanceSymbol]()
Returns
  • {symbol}
This method is called by the instanceof operator.
getCSSStyleSheet()
Returns
  • {CSSStyleSheet[]}
No description available.
getTag()
Returns
  • {string}
No description available.

Lifecycle methods

Lifecycle methods are called by the environment and are usually not intended to be called directly.

[assembleMethodSymbol]()
Returns
  • {FilterButton}
No description available.
connectedCallback()
Returns
  • {void}
No description available.
disconnectedCallback()
Returns
  • {void}
No description available.

Events

This component does not fire any public events. It may fire events that are inherited from its parent classes.

The current width of the area is too small to display the content correctly.