Skip to main content
Version: Next (5.0)

Numbers and dates

The number and date criteria collect a quantity (numeric), a day (date), a period (date-range), a time of day (time) or a day from the list the server allows (filtered-calendar). Below are the real criteria of the AWE React client: pick a type, change its attributes and the XML below follows. Try them, too: they are real fields.

Live preview
XML
<criteria id="demo" component="numeric" label="Field" unit="EUR" />

The controls above write these attributes. The reference lists every attribute, its type and default. Attributes in the XSD reference

AttributeControlValues
componentComponentnumericdatedate-rangetimefiltered-calendar
labelLabeltext
placeholderPlaceholdertext
iconIconlucide:userlucide:maillucide:searchlucide:calendar
sizeSizesmlg
unitUnittext
show-sliderSlidertrue / false
presetsPresetstext
time-formatTime formatHH:mmHH:mm:sshh:mm ahh:mm:ss a
validationRequiredtrue / false
readonlyRead onlytrue / false

The attributes shared by every criterion (label, placeholder, icon, size, validation) are in the criteria overview. A date-range sends two parameters, id.from and id.to, and its presets add one button per code that fills the range from today. The days a filtered-calendar allows come from a query of the server (here a static list of Mondays and Thursdays), and the others are disabled.

Recipes​

Common fields, rendered by the same components.

Number with a slider​

show-slider adds a slider under the input and number-format sets its range and step.

<criteria id="discount" component="numeric" label="Discount" show-slider="true"
number-format="{min: 0, max: 100, step: 5, aSign: ' %', pSign: 's'}" value="20" />

Period with quick presets​

Each code of presets is a button: 1M is one month back from today, YTD is the year to date and ALL clears both dates.

<criteria id="period" component="date-range" label="Period" presets="1M,3M,YTD,ALL" />

Time with a 12-hour clock​

time-format chooses how the time is shown. The value sent to the server is always a 24-hour time.

<criteria id="start" component="time" label="Start time" time-format="hh:mm a" />

Events and actions​

A criterion has no event of its own to listen to: every change of its value checks the dependencies whose dependency-element names it, and pressing Enter in a text field runs the submit button of its window. The actions that work on criteria:

ActionDescription
resetEmpties the value of the criterion
restorePuts back the initial value of the criterion
validateRuns the validation of the criterion and shows its error
set-invalidMarks the criterion as invalid with the message of the action
set-validClears the validation error of the criterion
copy-criterion-value-clipboardCopies the value of the criterion to the clipboard

More​