@mapeo/schema
Version:
JSON schema and flow types for Mapeo
73 lines (72 loc) • 2.81 kB
TypeScript
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
/**
* A field defines a form field that will be shown to the user when creating or editing a map entity. Presets define which fields are shown to the user for a particular map entity. The field definition defines whether the field should show as a text box, multiple choice, single-select, etc. It defines what tag-value is set when the field is entered.
*/
export interface Field {
/**
* Unique value that identifies this element
*/
id: string;
/**
* They key in a tags object that this field applies to. For nested properties, key can be an array e.g. for tags = `{ foo: { bar: 1 } }` the key is `['foo', 'bar']`
*/
key: string | string[];
/**
* Type of field - defines how the field is displayed to the user.
*/
type: "text" | "localized" | "number" | "select_one" | "select_multiple" | "date" | "datetime";
/**
* Default language label for the form field label
*/
label?: string;
/**
* Field is displayed, but it can't be edited
*/
readonly?: boolean;
/**
* For text fields, display as a single-line or multi-line field
*/
appearance?: "singleline" | "multiline";
/**
* Convert field value into snake_case (replace spaces with underscores and convert to lowercase)
*/
snake_case?: boolean;
/**
* List of options the user can select for single- or multi-select fields
*/
options?: (string | boolean | number | null | {
/**
* Label in default language to display to the user for this option
*/
label?: string;
/**
* Value for tag when this option is selected
*/
value: string | boolean | number | null;
[k: string]: unknown;
})[];
/**
* If true, this field will appear in the Add Field list for all presets
*/
universal?: boolean;
/**
* Displayed as a placeholder in an empty text or number field before the user begins typing. Use 'helperText' for important information, because the placeholder is not visible after the user has entered data.
*/
placeholder?: string;
/**
* Additional context about the field, e.g. hints about how to answer the question.
*/
helperText?: string;
/**
* Minimum field value (number, date or datetime fields only). For date or datetime fields, is seconds since unix epoch
*/
min_value?: number;
/**
* Maximum field value (number, date or datetime fields only). For date or datetime fields, is seconds since unix epoch
*/
max_value?: number;
}