Data types
A DataType describes one piece of typed data: how it renders as an input, how it validates, and which filter operators apply. The same instance drives a Form field (Forms), a TableView column (Tables), and that column's filters — declare the type once and behaviour stays consistent everywhere.
A field's type is always a DataType instance, constructed with per-field options:
import { DefaultDataTypes } from "@antelopejs-private/cms/interfaces/cms-base/data-types";
{
id: "quantity",
label: "Quantity",
type: new DefaultDataTypes.NumberType({ min: 0, max: 1000, step: 1 }),
}
The standard catalog lives in the DefaultDataTypes namespace, with StatusType, DataType, DefaultDataCompareTypes, RegisterDataType, and RegisterDataCompareMode exported alongside it.
The built-in catalog
Each entry is registered with @RegisterDataType("<id>"). "Renders" names the FormComponents.* widget the type produces; "Compare modes" lists its filter operators (default in bold). Most types share one of four operator sets:
- text —
contains,is,is_not,not_contains,is_empty,is_not_empty - numeric —
is,is_not,greater_than,greater_than_or_equal_to,less_than,less_than_or_equal_to,is_empty,is_not_empty - equality —
is,is_not,is_empty,is_not_empty - membership —
include,exclude
| Id | Class | Renders | Key options | Compare modes |
|---|---|---|---|---|
string | StringType | text input, or textarea when textarea: true | placeholder, minLength, maxLength, textarea, rows | text |
number | NumberType | numeric input | min, max, step, placeholder | numeric |
price | PriceType (extends NumberType) | numeric input | inherits NumberType; defaults min: 0, step: 0.01 | numeric |
percentage | PercentageType (extends NumberType) | percentage input (value stored 0–1, shown ×100) | inherits NumberType; defaults min: 0, max: 1, step: 0.01 | numeric |
string_time | StringTimeType | time input | placeholder, min, max (milliseconds) | numeric |
boolean | BooleanType | toggle switch (filter uses a checked/unchecked select) | — | equality |
select | SelectType | dropdown | items: { label, value }[], placeholder, multiple, deselectable | single: is, is_not; multiple: include, exclude; plus is_empty, is_not_empty |
date | DateType | date picker (range picker for is_between) | range, multiple, minDate, maxDate | is, greater_than, less_than, is_between, is_empty, is_not_empty |
email | EmailType | email input | placeholder | text |
url | UrlType | text input | placeholder | equality |
phone | PhoneType | phone input | placeholder, requiredPrefix | text |
password | PasswordType | masked input (optional confirm) | placeholder, minLength, confirmPassword, confirmPlaceholder | none (not filterable) |
color | ColorType | color picker | placeholder | equality |
rich_text | RichTextType | rich-text editor | placeholder | none (not filterable) |
file | FileType | file upload | multiple, constraints (UploadConstraints), path, storage | none (not filterable) |
image | ImageType | image upload with alt text / principal flag | multiple, max, constraints, path, storage, resize ({ maxWidth, maxHeight, fit? }, client-side downscale before upload) | none (not filterable) |
tree | TreeType | hierarchical tree selector | items, fetchUrl, placeholder, multiple | membership |
relation | RelationType | searchable relation picker | dataApiController, keyMapping (label/value/avatar/disabled), index, multiple, deselectable, placeholder, filterOnly | equality |
cascader_relation | CascaderRelationType | cascading picker for a self-referencing table | dataApiController, keyMapping (with parent), maxDepth, leafOnly, index, multiple, deselectable, placeholder | equality |
address | AddressType | structured postal address (optional autocomplete) | placeholder (per-field), autocomplete, dataApiController, keyMapping | is_empty, is_not_empty |
permissions | PermissionsType | permission checkbox tree | fetchUrl | membership |
status | StatusType | online/offline status badge | onlineLabel, offlineLabel, onlineColor, offlineColor | is, is_not |
RelationType's keyMapping.avatar accepts either a URL string or a stored image value ({ key } from an ImageType field on the related record — e.g. a CMS member's profile avatar); image keys are resolved to read URLs by the picker.
How a type is consumed
The same instance works as a form field type and a table column type; on a table it also supplies the column's filter operators. Table columns are declared with the @Column({ … }) property decorator on the data-api controller class (Data controller), not on the page:
// Form field (on a page)
{ id: "email", label: "Email", type: new DefaultDataTypes.EmailType({ placeholder: "[email protected]" }) }
// TableView column (on the data-api controller) — the type drives the cell, the filter widget, and the operators
@Column({ name: "Unit Price", type: new DefaultDataTypes.PriceType(), filterable: true })
price!: number;
Compare modes
A compare mode is one filter operator — the is in "status is done". Each type declares the modes it supports and a default; the built-ins live in the DefaultDataCompareTypes namespace:
- Equality —
is,is_not. - Ordering —
greater_than,greater_than_or_equal_to,less_than,less_than_or_equal_to,is_between. - Text —
contains,not_contains. - Sets —
include,exclude,array_contains_string. - Emptiness —
is_empty,is_not_empty. These take no value: selecting the mode is the filter.
Writing a custom DataType
The catalog is extensible: register your own type and it behaves like any built-in — as a form field, as a table column, and in that column's filters. A custom type has two halves. The backend class declares the type's validation, compare modes, and input widget; an optional frontend half formats its values for table cells and read views. The full contract, with annotated status and rating walkthroughs, is Custom data types.
Permissions
DataTypes carry no permission logic of their own — access is enforced at the page/component level, so gate field visibility by configuring permissions on the owning page (see Auth & permissions). The one type that touches permissions as data is PermissionsType, whose value is an array of permission-id strings selected from a permission tree.