Data types are data attributes that help to interpret their values and define the operations that the users can do and the values that can be stored. In the context of Mathesar, functionality and options will vary according to selected data types.
It is part of Mathesar’s future strategy to offer data modeling recommendations based on data types. This goal will be dependent on the user’s adoption and understanding of data type functionality. For this reason, users must have a consistent experience when manipulating different data types within Mathesar. This document goes over the design elements and components common across data types to ensure cohesive design implementation.
The data type options menu contains all of the configurations for a data type. These settings include database and display options. Most options are exclusive to each data type, except for setting a default value.
Database options are those that define how the data is stored in the database. Users cannot always undo changes made to database options once they have applied them. Warnings need to be displayed to users to prevent data from being lost.
Display options change how the data is presented in the columns and can be changed without affecting the underlying data.
The Set Default Value field in all database options should allow data input using the same specialized input components available for the table interface.
Filtering, grouping, and sorting operators and fields will be different according to each data type. Some options, like grouping by range, will only be available for number-based types, such as Number, Money, and Duration.
Group by range in duration types will allow users to select a unit measure to create ranges with increments such as '5 years,‘15 minutes’, etc.
Filter operators for Date/Time will allow natural language values such as ‘Today,’ ‘Yesterday,’ ‘Last Month.’
When a data type is set for a column, additional functionality might be present at the field level to facilitate data input in the correct format.
For Date, Time or DateTime input, a specialized component will be available so that users can enter dates using a calendar-like interface and unit-specific inputs with increment controls for time.
For boolean values input, a specialized component will be available according to the display options set by the user. In the case of dropdown, clicking on the cell will display a menu with options for TRUE, FALSE, or NULL. Users will be able to copy and paste the values from the dropdown as true or false, but not the custom labels if enabled.
For currency values input, the formatting will be automatically added after a value has been entered. For example, if the user enters 10000 and the currency locale settings are set to US dollars, the displayed value will be $10,000.00.
For number values input, the percentage formatting will be automatically added after a value has been entered. For example, if the user enters 0.20 and the number format settings are set to a percentage, the displayed value will be 20%.
The cell input control will be automatically resized when active if a value exceeds a specific length for text values input. This adjustment will allow users to view the contents of a cell that has multi-line text. When inactive, the overflowing content should be indicated by adding an ellipsis icon in the cell.
Contents of number type cells (number, duration, money) should be right-aligned for easier reading and data comparison.
Number types should be displayed using a font variant that supports tabular figures (numbers are all of the same size), allowing them to be easily aligned.
In number types, decimal precision is a database setting and in money type it is set as a display option.