@enso-ui/filters
v3.3.15
Published
Renderless filter primitives and Bulma filter components for Enso UI
Readme
Filters
Description
Filters provides the interactive filter widgets used across Enso tables, dashboards, and list pages.
The package is split into two layers:
- Bulma UI components such as
InputFilter,DateFilter, andSelectFilter - renderless primitives such as
FilterState,CoreInputFilter,CoreDateFilter, andCoreIntervalFilter
The Bulma layer gives you ready-made controls. The renderless layer exposes bindings, events, and state so you can build custom filter interfaces on top of the same contract.
Installation
Install the package:
yarn add @enso-ui/filtersFeatures
- exports dedicated filter components for text, date, interval, select, toggle, and boolean use cases
- includes Enso-aware wrappers that inject app-level translation and select behavior
- persists filter state through
FilterState - exposes date interval helpers for quick presets such as today, this week, next month, and custom ranges
- supports compact toolbar-style rendering and full panel rendering
Usage
Basic text and date filters:
<script setup>
import { DateFilter, InputFilter } from '@enso-ui/filters/bulma';
</script>
<InputFilter
v-model="filters.query"
name="Query"
label="Search" />
<DateFilter
:filter="filters.created_at.filter"
:interval="filters.created_at.interval"
name="Created At"
@update:filter="filters.created_at.filter = $event"
@update:interval="filters.created_at.interval = $event" />Persisting a filter bag:
<filter-state
:api-version="1"
:filters="filters"
:intervals="intervals"
name="orders.filters"
@ready="load"
@state-updated="dirty = $event" />API
Bulma Exports
Import from @enso-ui/filters/bulma.
Exported components:
InputFilterIntervalFilterDateFilterSelectFilterToggleFilterBooleanFilterVueFilterEnsoFilterEnsoInputFilterEnsoIntervalFilterEnsoDateFilterEnsoSelectFilterEnsoToggleFilter
InputFilter
Single-value input filter built on top of CoreInputFilter.
Props:
compact: boolean = falsei18n: Function = value => valuelabel: string = ''name: string | null = null- passes additional attrs such as
modelValue,type,min,max, andsteptoCoreInputFilter
Rendered behavior:
- shows the header when
compactis disabled - shows a clear button when
modelValueis not empty - translates the header and placeholder through
i18n
IntervalFilter
Two-ended min/max filter for numeric or lexical ranges.
Props:
compact: boolean = falsei18n: Function = value => valueminLabel: string = 'Min'maxLabel: string = 'Max'name: string | null = null- passes
modelValueandtypetoCoreIntervalFilter
Slot contract inherited from CoreIntervalFilter:
modelValueinvalidminBindingsmaxBindingsminEventsmaxEventsminClearEventsmaxClearEvents
DateFilter
Preset and custom date interval filter.
Props:
altFormat: string | null = nullaltInput: boolean = falsecompact: boolean = falsei18n: Function = value => valuename: string | null = null- passes
filter,interval,future,excluded,direction,format,locale, andweekStartsOntoCoreDateFilter
Behavior:
- displays quick presets such as today, yesterday, this week, this month, and custom
- optionally toggles between past and future ranges when
directionis enabled - exposes two datepickers for custom intervals
SelectFilter
Bulma wrapper around @enso-ui/select.
Props:
compact: boolean = falsei18n: Function = value => valuename: string | null = null- forwards the rest of its attrs to
VueSelect
Public methods:
clear()fetch()
ToggleFilter
Binary or tri-state toggle rendered as a single switch-style tab.
Props:
compact: boolean = falsei18n: Function = value => valuereadonly: boolean = falsetranslatable: boolean = falselabel: string | null = nullname: string | null = nullmodelValue: boolean | null
Emits:
update:modelValuechange
BooleanFilter
Preconfigured VueFilter with success and danger icons for true/false values.
Props:
numeric: boolean = false
Behavior:
- emits boolean values by default
- emits
1and0whennumericis enabled
VueFilter
Generic option-tab filter used by BooleanFilter and custom multi-option filters.
Props:
compact: boolean = falsehideOff: boolean = falsei18n: Function = value => valueicons: boolean = falseoffLabel: string = ''options: Array = []readonly: boolean = falsename: string | null = nullmultiple: boolean = falsemodelValue
Behavior:
- supports single and multi-select models
- supports icon mode and text mode
- renders a power-off tab to clear the current value unless
hideOffis enabled
Enso Wrappers
The Enso wrappers keep the same visual contracts as the base Bulma components, but wire them to app-level providers:
EnsoFilterinjectsi18nintoVueFilterEnsoInputFilterinjectsi18nintoInputFilterEnsoIntervalFilterinjectsi18nintoIntervalFilterEnsoToggleFilterinjectsi18nintoToggleFilterEnsoSelectFilterswapsVueSelectforEnsoSelectand keepsclear()/fetch()EnsoDateFilterreads locale and display format from Enso Pinia stores and enablesaltInputby default
Renderless Primitives
FilterState
Persistent state container for filters, intervals, and extra params.
Props:
apiVersion: numberfilters: object | nullintervals: object | nullname: stringparams: object | null
Emits:
readystate-updated
Behavior:
- persists state to
localStorageundername - restores only states created for the same
apiVersion - exposes a
reset()method that clears stored state and restores defaults
CoreInputFilter
Renderless primitive for a single scalar input.
Props:
modelValue: number | string | nulltype: string = 'text'min: number | null = nullmax: number | null = nullstep: number | null = null
Emits:
update:modelValue
Slot props:
modelValuebindingseventsclearEvents
CoreDateFilter
Renderless preset and custom date interval engine.
Props:
direction: boolean = falseexcluded: string[] = []filter: stringformat: string = 'Y-m-d H:i:s'future: boolean = falseinterval: { min: string | null, max: string | null }locale: string = 'en'weekStartsOn: number = 1
Emits:
update:filterupdate:interval
Slot props:
backEventscustomdirectiondirectionBindingsdirectionEventsfilterfiltersfilterEvents(filter)minBindingsminEventsmaxBindingsmaxEvents
CoreIntervalFilter
Renderless min/max primitive.
Props:
modelValue: { min: string | number | null, max: string | number | null }type: string = 'number'
Emits:
changeupdate:modelValue
Slot props:
invalidmodelValueminBindingsminEventsmaxBindingsmaxEventsminClearEventsmaxClearEvents
Depends On
@enso-ui/datepicker↗@enso-ui/select↗@enso-ui/strings↗@enso-ui/vue-switch↗@enso-ui/transitions↗@enso-ui/ui↗
Contributions
are welcome. Pull requests are great, but issues are good too.
Thank you to all the people who already contributed to Enso!
